summaryrefslogtreecommitdiff
path: root/src/udp_wrap.h
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2015-02-25 16:40:40 +0100
committerBen Noordhuis <info@bnoordhuis.nl>2015-08-27 17:44:15 +0200
commita43af39ffc369776f776c69e5287c9632349fc2b (patch)
treeac696bab827f3e431377bb0554f4be1a571408e0 /src/udp_wrap.h
parentd6714ff1a48de5dcd9d3dfbb4b2e036efcd92b7c (diff)
downloadnode-new-a43af39ffc369776f776c69e5287c9632349fc2b.tar.gz
src: DRY getsockname/getpeername code
Extract the common logic into a template function. No functional changes, just code cleanup. PR-URL: https://github.com/nodejs/node/pull/956 Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Diffstat (limited to 'src/udp_wrap.h')
-rw-r--r--src/udp_wrap.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/udp_wrap.h b/src/udp_wrap.h
index 3373cb9a2d..1582fb46ce 100644
--- a/src/udp_wrap.h
+++ b/src/udp_wrap.h
@@ -40,6 +40,12 @@ class UDPWrap: public HandleWrap {
size_t self_size() const override { return sizeof(*this); }
private:
+ typedef uv_udp_t HandleType;
+
+ template <typename T,
+ int (*F)(const typename T::HandleType*, sockaddr*, int*)>
+ friend void GetSockOrPeerName(const v8::FunctionCallbackInfo<v8::Value>&);
+
UDPWrap(Environment* env, v8::Handle<v8::Object> object, AsyncWrap* parent);
static void DoBind(const v8::FunctionCallbackInfo<v8::Value>& args,