[core] fixed bug with endless loop on master accept;

v0.5.xx
Alexander Vdolainen 9 years ago
parent 6db8841382
commit 0756386c48

@ -41,4 +41,6 @@
#define MAX_LINKS 32768
#define MAX_SXMP_SYNC_ITERATIONS 6
#endif /* __SXMP_LIMITS_H__ */

@ -986,6 +986,7 @@ sxlink_t *sxlink_master_accept(sxhub_t *hub, int sck, struct in_addr *addr)
}
bbuf = (char *)buf;
bbuf += sizeof(sxmplv2_head_t);
i = 0;
while(link->flags & SXMP_BATCHMODE) {
rd = __conn_read(link, buf, sizeof(sxmplv2_head_t));
@ -995,11 +996,18 @@ sxlink_t *sxlink_master_accept(sxhub_t *hub, int sck, struct in_addr *addr)
/* check for returns */
if(head->opcode != SXE_SUCCESS) { r = head->opcode; goto __fail3; }
else { /* opcode is fine */
i++;
/* if we're ready for messaging mode, turn off batch mode */
if(link->flags & SXMP_MESSAGINGMODE) {
link->flags &= ~SXMP_BATCHMODE;
break;
}
/* if count too big - fail */
if(i > MAX_SXMP_SYNC_ITERATIONS) { /* ugly */
r = SXE_FAILED;
goto __fail3;
}
}
if(!head->payload_length) continue; /* pass the following check up */

Loading…
Cancel
Save