/[svn]/ircd-hybrid/branches/8.1.x/src/s_bsd.c
ViewVC logotype

Diff of /ircd-hybrid/branches/8.1.x/src/s_bsd.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2630 by michael, Sat Aug 17 20:37:43 2013 UTC revision 2631 by michael, Sun Dec 8 18:33:35 2013 UTC
# Line 52  static const char *comm_err_str[] = { "C Line 52  static const char *comm_err_str[] = { "C
52    "Error during DNS lookup", "connect timeout", "Error during connect()",    "Error during DNS lookup", "connect timeout", "Error during connect()",
53    "Comm Error" };    "Comm Error" };
54    
 struct Callback *setup_socket_cb = NULL;  
   
55  static void comm_connect_callback(fde_t *, int);  static void comm_connect_callback(fde_t *, int);
56  static PF comm_connect_timeout;  static PF comm_connect_timeout;
57  static void comm_connect_dns_callback(void *, const struct irc_ssaddr *, const char *);  static void comm_connect_dns_callback(void *, const struct irc_ssaddr *, const char *);
# Line 139  report_error(int level, const char* text Line 137  report_error(int level, const char* text
137   *   *
138   * Set the socket non-blocking, and other wonderful bits.   * Set the socket non-blocking, and other wonderful bits.
139   */   */
140  static void *  static void
141  setup_socket(va_list args)  setup_socket(int fd)
142  {  {
   int fd = va_arg(args, int);  
143    int opt = 1;    int opt = 1;
144    
145    setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &opt, sizeof(opt));    setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &opt, sizeof(opt));
# Line 153  setup_socket(va_list args) Line 150  setup_socket(va_list args)
150  #endif  #endif
151    
152    fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONBLOCK);    fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONBLOCK);
   
   return NULL;  
 }  
   
 /*  
  * init_comm()  
  *  
  * Initializes comm subsystem.  
  */  
 void  
 init_comm(void)  
 {  
   setup_socket_cb = register_callback("setup_socket", setup_socket);  
   init_netio();  
153  }  }
154    
155  /*  /*
# Line 712  comm_open(fde_t *F, int family, int sock Line 695  comm_open(fde_t *F, int family, int sock
695    if (fd < 0)    if (fd < 0)
696      return -1; /* errno will be passed through, yay.. */      return -1; /* errno will be passed through, yay.. */
697    
698    execute_callback(setup_socket_cb, fd);    setup_socket(fd);
699    
700    /* update things in our fd tracking */    /* update things in our fd tracking */
701    fd_open(F, fd, 1, note);    fd_open(F, fd, 1, note);
# Line 753  comm_accept(struct Listener *lptr, struc Line 736  comm_accept(struct Listener *lptr, struc
736    pn->ss_len = addrlen;    pn->ss_len = addrlen;
737  #endif  #endif
738    
739    execute_callback(setup_socket_cb, newfd);    setup_socket(newfd);
740    
741    /* .. and return */    /* .. and return */
742    return newfd;    return newfd;

Legend:
Removed from v.2630  
changed lines
  Added in v.2631

svnadmin@ircd-hybrid.org
ViewVC Help
Powered by ViewVC 1.1.28