ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/fdlist.c
(Generate patch)

Comparing ircd-hybrid-7.2/src/fdlist.c (file contents):
Revision 436 by michael, Sat Feb 11 21:35:16 2006 UTC vs.
Revision 1001 by michael, Sat Aug 29 22:44:44 2009 UTC

# Line 74 | Line 74 | fdlist_init(void)
74   void
75   recalc_fdlimit(void *unused)
76   {
77 – #ifdef _WIN32
78 –  /* this is what WSAStartup() usually returns. Even though they say
79 –   * the value is for compatibility reasons and should be ignored,
80 –   * we actually can create even more sockets... */
81 –  hard_fdlimit = 32767;
82 – #else
77    int fdmax;
78    struct rlimit limit;
79  
# Line 101 | Line 95 | recalc_fdlimit(void *unused)
95  
96    if (fdmax != hard_fdlimit)
97      execute_callback(fdlimit_cb, fdmax);
104 – #endif
98   }
99  
100   static inline unsigned int
101   hash_fd(int fd)
102   {
110 – #ifdef _WIN32
111 –  return ((((unsigned) fd) >> 2) % FD_HASH_SIZE);
112 – #else
103    return (((unsigned) fd) % FD_HASH_SIZE);
114 – #endif
104   }
105  
106   fde_t *
# Line 162 | Line 151 | fd_close(fde_t *F)
151    if (F->flags.is_socket)
152      comm_setselect(F, COMM_SELECT_WRITE | COMM_SELECT_READ, NULL, NULL, 0);
153  
154 <  if (F->dns_query != NULL)
166 <  {
167 <    delete_resolver_queries(F->dns_query);
168 <    MyFree(F->dns_query);
169 <  }
154 >  delete_resolver_queries(F);
155  
156   #ifdef HAVE_LIBCRYPTO
157    if (F->ssl)
# Line 185 | Line 170 | fd_close(fde_t *F)
170    }
171  
172    /* Unlike squid, we're actually closing the FD here! -- adrian */
188 – #ifdef _WIN32
189 –  if (F->flags.is_socket)
190 –    closesocket(F->fd);
191 –  else
192 –    CloseHandle((HANDLE)F->fd);
193 – #else
173    close(F->fd);
195 – #endif
174    number_fd--;
175  
176    memset(F, 0, sizeof(fde_t));
# Line 238 | Line 216 | fd_note(fde_t *F, const char *format, ..
216   /* Make sure stdio descriptors (0-2) and profiler descriptor (3)
217   * always go somewhere harmless.  Use -foreground for profiling
218   * or executing from gdb */
241 – #ifndef _WIN32
219   void
220   close_standard_fds(void)
221   {
# Line 251 | Line 228 | close_standard_fds(void)
228        exit(-1); /* we're hosed if we can't even open /dev/null */
229    }
230   }
254 – #endif
231  
232   void
233   close_fds(fde_t *one)
# Line 262 | Line 238 | close_fds(fde_t *one)
238    for (i = 0; i < FD_HASH_SIZE; i++)
239      for (F = fd_hash[i]; F != NULL; F = F->hnext)
240        if (F != one)
265 –      {
266 – #ifdef _WIN32
267 –        if (F->flags.is_socket)
268 –          closesocket(F->fd);
269 –        else
270 –          CloseHandle((HANDLE)F->fd);
271 – #else
241          close(F->fd);
273 – #endif  
274 –      }
242   }

Diff Legend

– Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)