From: Josh G. <ja...@us...> - 2004-05-14 00:02:51
|
Update of /cvsroot/gift/giFT/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16544 Modified Files: tcpc.c Log Message: updated debug line for shift_queue() to provide more useful information in the event that tcp_send() fails Index: tcpc.c =================================================================== RCS file: /cvsroot/gift/giFT/lib/tcpc.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- tcpc.c 10 Feb 2004 14:03:44 -0000 1.9 +++ tcpc.c 14 May 2004 00:02:40 -0000 1.10 @@ -25,7 +25,10 @@ { unsigned char *data; size_t len; - size_t off; /* number of bytes we already sent successfully */ + + /* number of bytes we already sent successfully, for the ultimate purpose + * of handling short send()'s for queued messages */ + size_t off; }; /*****************************************************************************/ @@ -157,7 +160,8 @@ { if ((sent = tcp_send (c, msg->data + msg->off, msg->len - msg->off)) < 0) { - GIFT_TRACE (("tcp_send() failed!")); + GIFT_TRACE (("tcp_send(%p,%u): %s", msg->data + msg->off, + (unsigned int)msg->len - msg->off, GIFT_NETERROR())); free (msg->data); free (msg); @@ -166,20 +170,20 @@ } if (msg->off + sent < msg->len) - { - /* short send, adjust msg->off and unshift */ + { + /* short send, adjust msg->off and add the shifted message back */ msg->off += sent; - if (!array_unshift (&c->wqueue, msg)) + if (array_unshift (&c->wqueue, msg) == NULL) { GIFT_TRACE (("array_unshift() failed!")); - + free (msg->data); free (msg); return FALSE; } - + /* send the rest later */ return TRUE; } |