diff options
author | James M Snell <jasnell@gmail.com> | 2020-08-12 22:34:42 +0300 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2020-08-21 19:18:44 +0300 |
commit | c6e1edcc2802224cb9b312e9051e6bcdfc7935e4 (patch) | |
tree | 3bd3ab7c96ce1ac0142eb756f1c798febbcebd3f /src/node_sockaddr-inl.h | |
parent | 757bac671117f8fbb68f808d4bbbe83035e4940d (diff) |
src: add Update(const sockaddr*) variant
Signed-off-by: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/34752
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'src/node_sockaddr-inl.h')
-rw-r--r-- | src/node_sockaddr-inl.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/node_sockaddr-inl.h b/src/node_sockaddr-inl.h index e5d8985771e..b5ae5acb5fd 100644 --- a/src/node_sockaddr-inl.h +++ b/src/node_sockaddr-inl.h @@ -152,6 +152,11 @@ void SocketAddress::Update(uint8_t* data, size_t len) { memcpy(&address_, data, len); } +void SocketAddress::Update(const sockaddr* data, size_t len) { + CHECK_LE(len, sizeof(address_)); + memcpy(&address_, data, len); +} + v8::Local<v8::Object> SocketAddress::ToJS( Environment* env, v8::Local<v8::Object> info) const { |