Skip to content

Commit a4a0c6e

Browse files
knizhnikkelvich
authored andcommitted
Print more infomation ni sockhub
1 parent b978360 commit a4a0c6e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

contrib/multimaster/sockhub/sockhub.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,10 @@ void ShubLoop(Shub* shub)
379379
/* read as much as possible */
380380
rc = ShubReadSocketEx(chan, &shub->in_buffer[pos + available], sizeof(ShubMessageHdr) - available, buffer_size - pos - available);
381381
if (rc < sizeof(ShubMessageHdr) - available) {
382-
shub->params->error_handler("Failed to read local socket", SHUB_RECOVERABLE_ERROR);
382+
char buf[1024];
383+
sprintf(buf, "Failed to read local socket rc=%d, min requested=%ld, max requested=%d, errno=%d", rc, sizeof(ShubMessageHdr) - available, buffer_size - pos - available, errno);
384+
shub->params->error_handler(buf, SHUB_RECOVERABLE_ERROR);
385+
//shub->params->error_handler("Failed to read local socket", SHUB_RECOVERABLE_ERROR);
383386
close_socket(shub, i);
384387
shub->in_buffer_used = pos;
385388
notify_disconnect(shub, i);
@@ -415,7 +418,10 @@ void ShubLoop(Shub* shub)
415418
do {
416419
unsigned int n = processed + size > buffer_size ? buffer_size - processed : size;
417420
if (chan >= 0 && !ShubReadSocket(chan, shub->in_buffer + processed, n)) {
418-
shub->params->error_handler("Failed to read local socket", SHUB_RECOVERABLE_ERROR);
421+
char buf[1024];
422+
sprintf(buf, "Failed to read local socket rc=%d, len=%d, errno=%d", rc, n, errno);
423+
shub->params->error_handler(buf, SHUB_RECOVERABLE_ERROR);
424+
//shub->params->error_handler("Failed to read local socket", SHUB_RECOVERABLE_ERROR);
419425
close_socket(shub, chan);
420426
if (hdr != NULL) { /* if message header is not yet sent to the server... */
421427
/* ... then skip this message */

0 commit comments

Comments
 (0)