- Timestamp:
- 2006-05-13T23:28:31Z (19 years ago)
- Branches:
- master
- Children:
- df70eafa
- Parents:
- 0356ae3
- Location:
- protocols
- Files:
-
- 2 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 }
Note: See TracChangeset
for help on using the changeset viewer.