Mercurial > pidgin.yaz
changeset 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 | 10f702a4d3dc |
children | a679f7700ff0 |
files | src/ft.c src/protocols/irc/dcc_send.c src/protocols/jabber/si.c src/proxy.c |
diffstat | 4 files changed, 14 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ft.c Wed May 24 17:38:42 2006 +0000 +++ b/src/ft.c Fri May 26 03:26:03 2006 +0000 @@ -794,6 +794,8 @@ else if ((gaim_xfer_get_size(xfer) > 0) && ((gaim_xfer_get_bytes_sent(xfer)+r) >= gaim_xfer_get_size(xfer))) gaim_xfer_set_completed(xfer, TRUE); + else if (r == 0) + r = -1; } return r; @@ -835,7 +837,7 @@ r = gaim_xfer_read(xfer, &buffer); if (r > 0) { fwrite(buffer, 1, r, xfer->dest_fp); - } else if(r < 0) { + } else if(r <= 0) { gaim_xfer_cancel_remote(xfer); return; }
--- a/src/protocols/irc/dcc_send.c Wed May 24 17:38:42 2006 +0000 +++ b/src/protocols/irc/dcc_send.c Fri May 26 03:26:03 2006 +0000 @@ -178,7 +178,7 @@ if (len < 0 && errno == EAGAIN) return; - else if (len < 0) { + else if (len <= 0) { /* XXX: Shouldn't this be canceling the transfer? */ gaim_input_remove(xd->inpa); xd->inpa = 0;
--- a/src/protocols/jabber/si.c Wed May 24 17:38:42 2006 +0000 +++ b/src/protocols/jabber/si.c Fri May 26 03:26:03 2006 +0000 @@ -273,7 +273,7 @@ len = read(source, buffer, 5 - jsx->rxlen); if(len < 0 && errno == EAGAIN) return; - else if(len < 0) { + else if(len <= 0) { gaim_input_remove(xfer->watcher); xfer->watcher = 0; close(source); @@ -297,7 +297,7 @@ len = read(source, buffer, jsx->rxqueue[4] + 5 + 2 - jsx->rxlen); if(len < 0 && errno == EAGAIN) return; - else if(len < 0) { + else if(len <= 0) { gaim_input_remove(xfer->watcher); xfer->watcher = 0; close(source); @@ -415,7 +415,7 @@ len = read(source, buffer, 2 - jsx->rxlen); if(len < 0 && errno == EAGAIN) return; - else if(len < 0) { + else if(len <= 0) { gaim_input_remove(xfer->watcher); xfer->watcher = 0; close(source); @@ -431,7 +431,7 @@ len = read(source, buffer, jsx->rxqueue[1] + 2 - jsx->rxlen); if(len < 0 && errno == EAGAIN) return; - else if(len < 0) { + else if(len <= 0) { gaim_input_remove(xfer->watcher); xfer->watcher = 0; close(source);
--- a/src/proxy.c Wed May 24 17:38:42 2006 +0000 +++ b/src/proxy.c Fri May 26 03:26:03 2006 +0000 @@ -1119,7 +1119,7 @@ len = read(source, p, max_read); if(len < 0 && errno == EAGAIN) return; - else if(len < 0) { + else if(len <= 0) { close(source); source = -1; g_free(phb->read_buffer); @@ -1508,7 +1508,7 @@ len = read(source, buf, max_read); - if ((len < 0 && errno == EAGAIN) || len + phb->read_len < 4) + if ((len < 0 && errno == EAGAIN) || (len > 0 && len + phb->read_len < 4)) return; else if (len + phb->read_len >= 4) { if (phb->read_buffer[1] == 90) { @@ -1663,7 +1663,7 @@ len = read(source, dest, (phb->read_buf_len - phb->read_len)); if(len < 0 && errno == EAGAIN) return; - else if(len < 0) { + else if(len <= 0) { gaim_debug_warning("socks5 proxy", "or not...\n"); close(source); gaim_input_remove(phb->inpa); @@ -1775,7 +1775,7 @@ phb->read_buf_len - phb->read_len); if(len < 0 && errno == EAGAIN) return; - else if(len < 0) { + else if(len <= 0) { close(source); gaim_input_remove(phb->inpa); g_free(phb->read_buffer); @@ -1867,7 +1867,7 @@ if(len < 0 && errno == EAGAIN) return; - else if(len < 0) { + else if(len <= 0) { close(source); gaim_input_remove(phb->inpa); g_free(phb->read_buffer); @@ -1994,7 +1994,7 @@ phb->read_buf_len - phb->read_len); if(len < 0 && errno == EAGAIN) return; - else if(len < 0) { + else if(len <= 0) { close(source); gaim_input_remove(phb->inpa); g_free(phb->read_buffer);