Mercurial > pidgin
comparison src/protocols/jabber/si.c @ 13786:5ddde4ad1ca2
[gaim-migrate @ 16198]
Fix some places where a closed socket isn't being dealt with correctly. This may be the cause of the high CPU usage that some people have noticed.
Most of these were reported by Eduardo Prez.
committer: Tailor Script <tailor@pidgin.im>
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Fri, 26 May 2006 03:26:03 +0000 |
parents | 59ea9ddd408b |
children | 25e63008d3bb |
comparison
equal
deleted
inserted
replaced
13785:10f702a4d3dc | 13786:5ddde4ad1ca2 |
---|---|
271 if(jsx->rxlen < 5) { | 271 if(jsx->rxlen < 5) { |
272 gaim_debug_info("jabber", "reading the first 5 bytes\n"); | 272 gaim_debug_info("jabber", "reading the first 5 bytes\n"); |
273 len = read(source, buffer, 5 - jsx->rxlen); | 273 len = read(source, buffer, 5 - jsx->rxlen); |
274 if(len < 0 && errno == EAGAIN) | 274 if(len < 0 && errno == EAGAIN) |
275 return; | 275 return; |
276 else if(len < 0) { | 276 else if(len <= 0) { |
277 gaim_input_remove(xfer->watcher); | 277 gaim_input_remove(xfer->watcher); |
278 xfer->watcher = 0; | 278 xfer->watcher = 0; |
279 close(source); | 279 close(source); |
280 gaim_xfer_cancel_remote(xfer); | 280 gaim_xfer_cancel_remote(xfer); |
281 return; | 281 return; |
295 } else if(jsx->rxlen - 5 < jsx->rxqueue[4] + 2) { | 295 } else if(jsx->rxlen - 5 < jsx->rxqueue[4] + 2) { |
296 gaim_debug_info("jabber", "reading umpteen more bytes\n"); | 296 gaim_debug_info("jabber", "reading umpteen more bytes\n"); |
297 len = read(source, buffer, jsx->rxqueue[4] + 5 + 2 - jsx->rxlen); | 297 len = read(source, buffer, jsx->rxqueue[4] + 5 + 2 - jsx->rxlen); |
298 if(len < 0 && errno == EAGAIN) | 298 if(len < 0 && errno == EAGAIN) |
299 return; | 299 return; |
300 else if(len < 0) { | 300 else if(len <= 0) { |
301 gaim_input_remove(xfer->watcher); | 301 gaim_input_remove(xfer->watcher); |
302 xfer->watcher = 0; | 302 xfer->watcher = 0; |
303 close(source); | 303 close(source); |
304 gaim_xfer_cancel_remote(xfer); | 304 gaim_xfer_cancel_remote(xfer); |
305 return; | 305 return; |
413 if(jsx->rxlen < 2) { | 413 if(jsx->rxlen < 2) { |
414 gaim_debug_info("jabber", "reading those first two bytes\n"); | 414 gaim_debug_info("jabber", "reading those first two bytes\n"); |
415 len = read(source, buffer, 2 - jsx->rxlen); | 415 len = read(source, buffer, 2 - jsx->rxlen); |
416 if(len < 0 && errno == EAGAIN) | 416 if(len < 0 && errno == EAGAIN) |
417 return; | 417 return; |
418 else if(len < 0) { | 418 else if(len <= 0) { |
419 gaim_input_remove(xfer->watcher); | 419 gaim_input_remove(xfer->watcher); |
420 xfer->watcher = 0; | 420 xfer->watcher = 0; |
421 close(source); | 421 close(source); |
422 gaim_xfer_cancel_remote(xfer); | 422 gaim_xfer_cancel_remote(xfer); |
423 return; | 423 return; |
429 } else if(jsx->rxlen - 2 < jsx->rxqueue[1]) { | 429 } else if(jsx->rxlen - 2 < jsx->rxqueue[1]) { |
430 gaim_debug_info("jabber", "reading the next umpteen bytes\n"); | 430 gaim_debug_info("jabber", "reading the next umpteen bytes\n"); |
431 len = read(source, buffer, jsx->rxqueue[1] + 2 - jsx->rxlen); | 431 len = read(source, buffer, jsx->rxqueue[1] + 2 - jsx->rxlen); |
432 if(len < 0 && errno == EAGAIN) | 432 if(len < 0 && errno == EAGAIN) |
433 return; | 433 return; |
434 else if(len < 0) { | 434 else if(len <= 0) { |
435 gaim_input_remove(xfer->watcher); | 435 gaim_input_remove(xfer->watcher); |
436 xfer->watcher = 0; | 436 xfer->watcher = 0; |
437 close(source); | 437 close(source); |
438 gaim_xfer_cancel_remote(xfer); | 438 gaim_xfer_cancel_remote(xfer); |
439 return; | 439 return; |