pike.git / src / modules / _Stdio / socket.c

version» Context lines:

pike.git/src/modules/_Stdio/socket.c:230:    *! nonblocking and the callback funcition is called whenever    *! something connects to it. The callback will receive the id for    *! this port as argument and should typically call @[accept] to    *! establish a connection.    *!    *! If the optional argument @[ip] is given, @[bind] will try to bind    *! to an interface with that host name or IP number. Omitting this    *! will bind to all available IPv4 addresses; specifying "::" will    *! bind to all IPv4 and IPv6 addresses.    *! +  *! If the OS supports TCP_FASTOPEN it is enabled automatically. +  *!    *! @returns    *! 1 is returned on success, zero on failure. @[errno] provides    *! further details about the error in the latter case.    *!    *! @seealso    *! @[accept], @[set_id]    */   static void port_bind(INT32 args)   {    struct port *p = THIS;
pike.git/src/modules/_Stdio/socket.c:300: Inside #if defined(IPV6_V6ONLY) && defined(IPPROTO_IPV6)
   * cf http://msdn.microsoft.com/en-us/library/windows/desktop/bb513665(v=vs.85).aspx    */    int o = 0;    fd_setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, (char *)&o, sizeof(int));    }   #endif       my_set_close_on_exec(fd,1);       THREADS_ALLOW_UID(); -  tmp=fd_bind(fd, (struct sockaddr *)&addr, addr_len) < 0 || fd_listen(fd, 16384) < 0; +  if( !(tmp=fd_bind(fd, (struct sockaddr *)&addr, addr_len) < 0) ) + #ifdef TCP_FASTOPEN +  tmp = 256, +  setsockopt(fd,SOL_TCP, TCP_FASTOPEN, &tmp, sizeof(tmp)), + #endif +  (tmp = fd_listen(fd, 16384) < 0);    THREADS_DISALLOW_UID();       if(!Pike_fp->current_object->prog)    {    if (fd >= 0)    while (fd_close(fd) && errno == EINTR) {}    Pike_error("Object destructed in Stdio.Port->bind()\n");    }       if(tmp)