Changeset b642f381 for protocols/events_libevent.c
- Timestamp:
- 2006-05-13T09:23:49Z (19 years ago)
- Branches:
- master
- Children:
- fc2ee0f
- Parents:
- 09f8cd1
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/events_libevent.c
r09f8cd1 rb642f381 81 81 } 82 82 83 event_debug( "b_event_passthrough( %d, %d, 0x%x ) (%d)\n", fd, event, (int) data, b_ev->id ); 84 83 85 if( !b_ev->function( b_ev->data, fd, cond ) ) 86 { 87 event_debug( "Handler returned FALSE: " ); 84 88 b_event_remove( b_ev->id ); 89 } 85 90 } 86 91 87 gint b_input_add( gint source, b_input_condition condition, b_event_handler function, gpointer data )92 gint b_input_add( gint fd, b_input_condition condition, b_event_handler function, gpointer data ) 88 93 { 89 94 struct b_event_data *b_ev = g_new0( struct b_event_data, 1 ); 90 GIOCondition cond;95 GIOCondition out_cond; 91 96 92 97 b_ev->id = id_next++; … … 94 99 b_ev->data = data; 95 100 96 cond = EV_PERSIST;101 out_cond = EV_PERSIST; 97 102 if( condition & GAIM_INPUT_READ ) 98 cond |= EV_READ;103 out_cond |= EV_READ; 99 104 if( condition & GAIM_INPUT_WRITE ) 100 cond |= EV_WRITE;105 out_cond |= EV_WRITE; 101 106 102 event_set( &b_ev->evinfo, source,cond, b_event_passthrough, b_ev );107 event_set( &b_ev->evinfo, fd, out_cond, b_event_passthrough, b_ev ); 103 108 event_add( &b_ev->evinfo, NULL ); 109 110 event_debug( "b_input_add( %d, %d, 0x%x, 0x%x ) = %d\n", fd, condition, function, data, b_ev->id ); 104 111 105 112 g_hash_table_insert( id_hash, &b_ev->id, b_ev ); … … 124 131 evtimer_add( &b_ev->evinfo, &tv ); 125 132 133 event_debug( "b_timeout_add( %d, %d, 0x%x ) = %d\n", timeout, function, data, b_ev->id ); 134 126 135 g_hash_table_insert( id_hash, &b_ev->id, b_ev ); 127 136 … … 129 138 } 130 139 131 void b_event_remove( gint tag)140 void b_event_remove( gint id ) 132 141 { 133 struct b_event_data *b_ev = g_hash_table_lookup( id_hash, & tag);142 struct b_event_data *b_ev = g_hash_table_lookup( id_hash, &id ); 134 143 144 event_debug( "b_event_remove( %d )\n", id ); 135 145 if( b_ev ) 136 146 { … … 139 149 g_free( b_ev ); 140 150 } 151 else 152 { 153 event_debug( "Invalid?\n" ); 154 } 141 155 } 142 156 … … 144 158 { 145 159 /* FIXME! */ 160 event_debug( "FALSE!\n" ); 146 161 return FALSE; 147 162 }
Note: See TracChangeset
for help on using the changeset viewer.