Changes in lib/proxy.c [242f280:dbca297]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/proxy.c
r242f280 rdbca297 87 87 } 88 88 89 /* calls phb->func safely by ensuring that the phb struct doesn't exist in the90 * case that proxy_disconnect() is called down there */91 static gboolean phb_connected(struct PHB *phb, gint source)92 {93 /* save func and data here */94 b_event_handler func = phb->func;95 gpointer data = phb->data;96 97 /* free the struct so that it can't be freed by the callback */98 phb_free(phb, TRUE);99 100 /* if any proxy_disconnect() call happens here, it will use the101 * fd (still open), look it up in the hash table, get NULL, and102 * proceed to close the fd and do nothing else */103 func(data, source, B_EV_IO_READ);104 105 return FALSE;106 }107 108 89 static gboolean proxy_connected(gpointer data, gint source, b_input_condition cond) 109 90 { … … 144 125 phb->proxy_func(phb->proxy_data, source, B_EV_IO_READ); 145 126 } else { 146 phb_connected(phb, source); 127 phb->func(phb->data, source, B_EV_IO_READ); 128 phb_free(phb, TRUE); 147 129 } 148 130 … … 240 222 if ((memcmp(HTTP_GOODSTRING, inputline, strlen(HTTP_GOODSTRING)) == 0) || 241 223 (memcmp(HTTP_GOODSTRING2, inputline, strlen(HTTP_GOODSTRING2)) == 0)) { 242 return phb_connected(phb, source); 224 phb->func(phb->data, source, B_EV_IO_READ); 225 return phb_free(phb, TRUE); 243 226 } 244 227 … … 312 295 memset(packet, 0, sizeof(packet)); 313 296 if (read(source, packet, 9) >= 4 && packet[1] == 90) { 314 return phb_connected(phb, source); 297 phb->func(phb->data, source, B_EV_IO_READ); 298 return phb_free(phb, TRUE); 315 299 } 316 300 … … 400 384 } 401 385 402 return phb_connected(phb, source); 386 phb->func(phb->data, source, B_EV_IO_READ); 387 return phb_free(phb, TRUE); 403 388 } 404 389
Note: See TracChangeset
for help on using the changeset viewer.