Mercurial > pidgin
diff src/protocols/simple/simple.c @ 12748:dd271caf25b0
[gaim-migrate @ 15095]
Deal with recv being unable to read anything. I also noticed that this kinda sucks because it assumes that it'll be able to read everything in one shot and doesn't buffer until the next read - somebody should fix that... wink, wink, nudge, nudge.
committer: Tailor Script <tailor@pidgin.im>
| author | Daniel Atallah <daniel.atallah@gmail.com> |
|---|---|
| date | Sat, 07 Jan 2006 03:56:15 +0000 |
| parents | 4f7dab030b1a |
| children | 1deb504f069a |
line wrap: on
line diff
--- a/src/protocols/simple/simple.c Fri Jan 06 06:34:49 2006 +0000 +++ b/src/protocols/simple/simple.c Sat Jan 07 03:56:15 2006 +0000 @@ -1111,12 +1111,15 @@ int len; time_t currtime; + /** XXX: eek! What if we can't receive everything right now? + (need to maintain buffer for next read) */ static char buffer[65536]; - len = recv(source, buffer, 65536, 0); - buffer[len] = 0; - gaim_debug_info("simple","\n\nreceived - %s\n######\n%s\n#######\n\n",ctime(&currtime), buffer); - msg = sipmsg_parse_msg(buffer); - if(msg) process_input_message(sip, msg); + if((len = recv(source, buffer, 65536, 0))) { + buffer[len] = '\0'; + gaim_debug_info("simple","\n\nreceived - %s\n######\n%s\n#######\n\n",ctime(&currtime), buffer); + msg = sipmsg_parse_msg(buffer); + if(msg) process_input_message(sip, msg); + } } static void simple_input_cb(gpointer data, gint source, GaimInputCondition cond)
