/[svn]/ircd-hybrid-7.2/src/s_bsd.c
ViewVC logotype

Diff of /ircd-hybrid-7.2/src/s_bsd.c

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

revision 1000 by michael, Mon Aug 17 19:19:16 2009 UTC revision 1001 by michael, Sat Aug 29 22:44:44 2009 UTC
# Line 23  Line 23 
23   */   */
24    
25  #include "stdinc.h"  #include "stdinc.h"
 #ifndef _WIN32  
26  #include <netinet/in_systm.h>  #include <netinet/in_systm.h>
27  #include <netinet/ip.h>  #include <netinet/ip.h>
28  #include <netinet/tcp.h>  #include <netinet/tcp.h>
 #endif  
29  #include "fdlist.h"  #include "fdlist.h"
30  #include "s_bsd.h"  #include "s_bsd.h"
31  #include "client.h"  #include "client.h"
# Line 80  check_can_use_v6(void) Line 78  check_can_use_v6(void)
78    else    else
79    {    {
80      ServerInfo.can_use_v6 = 1;      ServerInfo.can_use_v6 = 1;
 #ifdef _WIN32  
     closesocket(v6);  
 #else  
81      close(v6);      close(v6);
 #endif  
82    }    }
83  #else  #else
84    ServerInfo.can_use_v6 = 0;    ServerInfo.can_use_v6 = 0;
# Line 100  check_can_use_v6(void) Line 94  check_can_use_v6(void)
94  int  int
95  get_sockerr(int fd)  get_sockerr(int fd)
96  {  {
 #ifndef _WIN32  
97    int errtmp = errno;    int errtmp = errno;
 #else  
   int errtmp = WSAGetLastError();  
 #endif  
98  #ifdef SO_ERROR  #ifdef SO_ERROR
99    int err = 0;    int err = 0;
100    socklen_t len = sizeof(err);    socklen_t len = sizeof(err);
# Line 166  setup_socket(va_list args) Line 156  setup_socket(va_list args)
156    setsockopt(fd, IPPROTO_IP, IP_TOS, &opt, sizeof(opt));    setsockopt(fd, IPPROTO_IP, IP_TOS, &opt, sizeof(opt));
157  #endif  #endif
158    
 #ifndef _WIN32  
159    fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONBLOCK);    fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONBLOCK);
 #endif  
160    
161    return NULL;    return NULL;
162  }  }
# Line 658  comm_connect_tryconnect(fde_t *fd, void Line 646  comm_connect_tryconnect(fde_t *fd, void
646    /* Error? */    /* Error? */
647    if (retval < 0)    if (retval < 0)
648    {    {
 #ifdef _WIN32  
     errno = WSAGetLastError();  
 #endif  
649      /*      /*
650       * If we get EISCONN, then we've already connect()ed the socket,       * If we get EISCONN, then we've already connect()ed the socket,
651       * which is a good thing.       * which is a good thing.
# Line 719  comm_open(fde_t *F, int family, int sock Line 704  comm_open(fde_t *F, int family, int sock
704     */     */
705    fd = socket(family, sock_type, proto);    fd = socket(family, sock_type, proto);
706    if (fd < 0)    if (fd < 0)
   {  
 #ifdef _WIN32  
     errno = WSAGetLastError();  
 #endif  
707      return -1; /* errno will be passed through, yay.. */      return -1; /* errno will be passed through, yay.. */
   }  
708    
709    execute_callback(setup_socket_cb, fd);    execute_callback(setup_socket_cb, fd);
710    
# Line 759  comm_accept(struct Listener *lptr, struc Line 739  comm_accept(struct Listener *lptr, struc
739     */     */
740    newfd = accept(lptr->fd.fd, (struct sockaddr *)pn, (socklen_t *)&addrlen);    newfd = accept(lptr->fd.fd, (struct sockaddr *)pn, (socklen_t *)&addrlen);
741    if (newfd < 0)    if (newfd < 0)
   {  
 #ifdef _WIN32  
     errno = WSAGetLastError();  
 #endif  
742      return -1;      return -1;
   }  
743    
744  #ifdef IPV6  #ifdef IPV6
745    remove_ipv6_mapping(pn);    remove_ipv6_mapping(pn);

Legend:
Removed from v.1000  
changed lines
  Added in v.1001

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