[sylverant] r763 committed - Fix (hopefully) the bug that makes the shipgate go berserk every few m...

1 view
Skip to first unread message

sylv...@googlecode.com

unread,
Dec 13, 2014, 12:26:35 AM12/13/14
to sylverant-...@googlegroups.com
Revision: 763
Author: bluecrab
Date: Sat Dec 13 05:26:28 2014 UTC
Log: Fix (hopefully) the bug that makes the shipgate go berserk every
few months.

That code was... very wrong. Not sure why I had it correct in ship_server,
but so wrong in shipgate still.


https://code.google.com/p/sylverant/source/detail?r=763

Modified:
/trunk/shipgate/src/packets.c

=======================================
--- /trunk/shipgate/src/packets.c Sat Mar 29 22:50:30 2014 UTC
+++ /trunk/shipgate/src/packets.c Sat Dec 13 05:26:28 2014 UTC
@@ -40,11 +40,13 @@
while(total < len) {
rv = ship_send(c, sendbuf + total, len - total);

- if(rv == -1 && errno != EAGAIN) {
- return -1;
- }
- else if(rv == -1) {
- break;
+ /* Did the data send? */
+ if(rv < 0) {
+ /* Is it an error code that might be correctable? */
+ if(rv == GNUTLS_E_AGAIN || rv == GNUTLS_E_INTERRUPTED)
+ continue;
+ else
+ return -1;
}

total += rv;
@@ -290,7 +292,7 @@
pkt->guildcard = htonl(gc);
pkt->slot = htonl(slot);
pkt->block = block;
- memcpy(pkt->data, cdata, sz);
+ memcpy(pkt->data, cdata, sz);

/* Send it away. */
return send_crypt(c, sizeof(shipgate_char_data_pkt) + sz);
Reply all
Reply to author
Forward
0 new messages