Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

uv: upgrade to 16124bb

  • Loading branch information...
bnoordhuis committed Jan 27, 2012
1 parent 3865152 commit 22e23473ea7fd1a083c43aa33fe4d09c1b6bd34e
Showing with 33 additions and 2 deletions.
  1. +33 −2 deps/uv/src/unix/udp.c
@@ -528,13 +528,44 @@ int uv_udp_set_membership(uv_udp_t* handle, const char* multicast_addr,
}

X(multicast_loop, IPPROTO_IP, IP_MULTICAST_LOOP)
X(multicast_ttl, IPPROTO_IP, IP_MULTICAST_TTL)
X(broadcast, SOL_SOCKET, SO_BROADCAST)
X(ttl, IPPROTO_IP, IP_TTL)

#undef X


static int uv__udp_set_ttl(uv_udp_t* handle, int option, int ttl) {
#if __sun
char arg = ttl;
#else
int arg = ttl;
#endif

#if __sun
if (ttl < 0 || ttl > 255) {
uv__set_sys_error(handle->loop, EINVAL);
return -1;
}
#endif

if (setsockopt(handle->fd, IPPROTO_IP, option, &arg, sizeof(arg))) {
uv__set_sys_error(handle->loop, errno);
return -1;
}

return 0;
}


int uv_udp_set_ttl(uv_udp_t* handle, int ttl) {
return uv__udp_set_ttl(handle, IP_TTL, ttl);
}


int uv_udp_set_multicast_ttl(uv_udp_t* handle, int ttl) {
return uv__udp_set_ttl(handle, IP_MULTICAST_TTL, ttl);
}


int uv_udp_getsockname(uv_udp_t* handle, struct sockaddr* name, int* namelen) {
socklen_t socklen;
int saved_errno;

0 comments on commit 22e2347

Please sign in to comment.
You can’t perform that action at this time.