comparison libpurple/protocols/msn/soap.c @ 24018:40a4e02027f4

shuffle some code around to make sure are using the right errno, References #7032
author Ka-Hing Cheung <khc@hxbc.us>
date Thu, 11 Sep 2008 04:19:37 +0000
parents cb60838756e7
children 9bdaf273c0ff
comparison
equal deleted inserted replaced
24017:ad88d875cdd8 24018:40a4e02027f4
282 while ((cnt = purple_ssl_read(conn->ssl, buf, sizeof(buf))) > 0) { 282 while ((cnt = purple_ssl_read(conn->ssl, buf, sizeof(buf))) > 0) {
283 purple_debug_info("soap", "read %d bytes\n", cnt); 283 purple_debug_info("soap", "read %d bytes\n", cnt);
284 count += cnt; 284 count += cnt;
285 g_string_append_len(conn->buf, buf, cnt); 285 g_string_append_len(conn->buf, buf, cnt);
286 } 286 }
287
288 perrno = errno;
289 if (cnt < 0 && perrno != EAGAIN)
290 purple_debug_info("soap", "read: %s\n", g_strerror(perrno));
291
287 #ifndef MSN_UNSAFE_DEBUG 292 #ifndef MSN_UNSAFE_DEBUG
288 if (conn->current_request->secure) 293 if (conn->current_request->secure)
289 purple_debug_misc("soap", "Received secure request.\n"); 294 purple_debug_misc("soap", "Received secure request.\n");
290 else 295 else
291 #endif 296 #endif
297 discussion on this and the above buffer size issues */ 302 discussion on this and the above buffer size issues */
298 if(cnt < 0 && errno == EAGAIN && count == 0) 303 if(cnt < 0 && errno == EAGAIN && count == 0)
299 return; 304 return;
300 305
301 /* msn_soap_process could alter errno */ 306 /* msn_soap_process could alter errno */
302 perrno = errno;
303 msn_soap_process(conn); 307 msn_soap_process(conn);
304 308
305 if (cnt < 0 && perrno != EAGAIN) { 309 if (cnt < 0 && perrno != EAGAIN) {
306 purple_debug_info("soap", "read: %s\n", g_strerror(perrno));
307 /* It's possible msn_soap_process closed the ssl connection */ 310 /* It's possible msn_soap_process closed the ssl connection */
308 if (conn->ssl) { 311 if (conn->ssl) {
309 purple_ssl_close(conn->ssl); 312 purple_ssl_close(conn->ssl);
310 conn->ssl = NULL; 313 conn->ssl = NULL;
311 msn_soap_connection_handle_next(conn); 314 msn_soap_connection_handle_next(conn);