Changeset 3f199fc
- Timestamp:
- 2006-05-13T23:28:31Z (19 years ago)
- Branches:
- master
- Children:
- df70eafa
- Parents:
- 0356ae3
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/events.h
r0356ae3 r3f199fc 61 61 G_MODULE_EXPORT gboolean b_event_remove_by_data(gpointer data); 62 62 63 #ifdef EVENTS_LIBEVENT 64 G_MODULE_EXPORT void closesocket(int fd); 65 #endif 66 63 67 #endif /* _EVENTS_H_ */ -
protocols/events_libevent.c
r0356ae3 r3f199fc 30 30 #include <stdlib.h> 31 31 #include <string.h> 32 #include <unistd.h> 32 33 #include <sys/types.h> 33 34 #include "proxy.h" … … 217 218 return FALSE; 218 219 } 220 221 void closesocket( int fd ) 222 { 223 struct b_event_data *b_ev; 224 225 /* Since epoll() (the main reason we use libevent) automatically removes sockets from 226 the epoll() list when a socket gets closed and some modules have a habit of 227 closing sockets before removing event handlers, our and libevent's administration 228 get a little bit messed up. So this little function will remove the handlers 229 properly before closing a socket. */ 230 231 if( ( b_ev = g_hash_table_lookup( read_hash, &fd ) ) || ( b_ev = g_hash_table_lookup( write_hash, &fd ) ) ) 232 b_event_remove( b_ev->id ); 233 234 close( fd ); 235 } -
sock.h
r0356ae3 r3f199fc 18 18 #define sock_make_blocking(fd) fcntl(fd, F_SETFL, 0) 19 19 #define sockerr_again() (errno == EINPROGRESS || errno == EINTR) 20 #ifndef EVENTS_LIBEVENT 20 21 #define closesocket(a) close(a) 22 #endif 21 23 #else 22 24 # include <winsock2.h>
Note: See TracChangeset
for help on using the changeset viewer.