| 419 if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) |
419 if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) |
| 420 /* No worries */ |
420 /* No worries */ |
| 421 return; |
421 return; |
| 422 |
422 |
| 423 if (conn->ready) |
423 if (conn->ready) |
| |
424 { |
| |
425 gaim_input_remove(conn->watcher_outgoing); |
| |
426 conn->watcher_outgoing = 0; |
| |
427 close(conn->fd); |
| |
428 conn->fd = -1; |
| 424 peer_connection_schedule_destroy(conn, |
429 peer_connection_schedule_destroy(conn, |
| 425 OSCAR_DISCONNECT_LOST_CONNECTION, NULL); |
430 OSCAR_DISCONNECT_LOST_CONNECTION, NULL); |
| |
431 } |
| 426 else |
432 else |
| 427 { |
433 { |
| 428 /* |
434 /* |
| 429 * This could happen when unable to send a negotiation |
435 * This could happen when unable to send a negotiation |
| 430 * frame to a peer proxy server. |
436 * frame to a peer proxy server. |
| 448 { |
454 { |
| 449 /* Add everything to our outgoing buffer */ |
455 /* Add everything to our outgoing buffer */ |
| 450 gaim_circ_buffer_append(conn->buffer_outgoing, bs->data, bs->len); |
456 gaim_circ_buffer_append(conn->buffer_outgoing, bs->data, bs->len); |
| 451 |
457 |
| 452 /* If we haven't already started writing stuff, then start the cycle */ |
458 /* If we haven't already started writing stuff, then start the cycle */ |
| 453 if (conn->watcher_outgoing == 0) |
459 if ((conn->watcher_outgoing == 0) && (conn->fd != -1)) |
| 454 { |
460 { |
| 455 conn->watcher_outgoing = gaim_input_add(conn->fd, |
461 conn->watcher_outgoing = gaim_input_add(conn->fd, |
| 456 GAIM_INPUT_WRITE, send_cb, conn); |
462 GAIM_INPUT_WRITE, send_cb, conn); |
| 457 send_cb(conn, conn->fd, 0); |
463 send_cb(conn, conn->fd, 0); |
| 458 } |
464 } |
| 706 conn = data; |
712 conn = data; |
| 707 |
713 |
| 708 gaim_debug_info("oscar", "Peer connection timed out after 5 seconds. " |
714 gaim_debug_info("oscar", "Peer connection timed out after 5 seconds. " |
| 709 "Trying next method...\n"); |
715 "Trying next method...\n"); |
| 710 |
716 |
| 711 peer_connection_close(conn); |
|
| 712 |
|
| 713 peer_connection_trynext(conn); |
717 peer_connection_trynext(conn); |
| 714 |
718 |
| 715 /* Cancel this timer. It'll be added again, if needed. */ |
719 /* Cancel this timer. It'll be added again, if needed. */ |
| 716 return FALSE; |
720 return FALSE; |
| 717 } |
721 } |