Skip to content

Commit 62a3bb5

Browse files
committed
Correctly handle error of output socket in sockhub
1 parent 2ec3827 commit 62a3bb5

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

contrib/multimaster/sockhub/sockhub.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,10 +335,14 @@ void ShubLoop(Shub* shub)
335335
for (j = 0; j < n; j++) {
336336
i = events[j].data.fd;
337337
if (events[j].events & EPOLLERR) {
338-
if (i != shub->input && i != shub->output) {
338+
if (i == shub->input) {
339+
shub->params->error_handler("Input socket error", SHUB_FATAL_ERROR);
340+
} else if (i == shub->output) {
341+
reconnect(shub);
342+
} else {
339343
notify_disconnect(shub, i);
344+
close_socket(shub, i);
340345
}
341-
close_socket(shub, i);
342346
} else if (events[j].events & EPOLLIN) {
343347
#else
344348
for (i = 0; i <= max_fd; i++) {

0 commit comments

Comments
 (0)