comparison 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
comparison
equal deleted inserted replaced
12747:b62d685cf841 12748:dd271caf25b0
1109 struct simple_account_data *sip = gc->proto_data; 1109 struct simple_account_data *sip = gc->proto_data;
1110 struct sipmsg *msg; 1110 struct sipmsg *msg;
1111 int len; 1111 int len;
1112 time_t currtime; 1112 time_t currtime;
1113 1113
1114 /** XXX: eek! What if we can't receive everything right now?
1115 (need to maintain buffer for next read) */
1114 static char buffer[65536]; 1116 static char buffer[65536];
1115 len = recv(source, buffer, 65536, 0); 1117 if((len = recv(source, buffer, 65536, 0))) {
1116 buffer[len] = 0; 1118 buffer[len] = '\0';
1117 gaim_debug_info("simple","\n\nreceived - %s\n######\n%s\n#######\n\n",ctime(&currtime), buffer); 1119 gaim_debug_info("simple","\n\nreceived - %s\n######\n%s\n#######\n\n",ctime(&currtime), buffer);
1118 msg = sipmsg_parse_msg(buffer); 1120 msg = sipmsg_parse_msg(buffer);
1119 if(msg) process_input_message(sip, msg); 1121 if(msg) process_input_message(sip, msg);
1122 }
1120 } 1123 }
1121 1124
1122 static void simple_input_cb(gpointer data, gint source, GaimInputCondition cond) 1125 static void simple_input_cb(gpointer data, gint source, GaimInputCondition cond)
1123 { 1126 {
1124 GaimConnection *gc = data; 1127 GaimConnection *gc = data;