From 677f704de4f04bae34108bb1c91a9454c0b05daa Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Thu, 18 Jan 2018 09:17:57 -0500 Subject: [PATCH] zebra: Add some more debug information on read issues in FPM When we receive a read failure in handling a FPM read let's add a bit more information to what we think has gone wrong, in a hope that debugging will be a bit easier. Signed-off-by: Donald Sharp --- zebra/zebra_fpm.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/zebra/zebra_fpm.c b/zebra/zebra_fpm.c index 0d0a2cb3bf..a6e0882ff8 100644 --- a/zebra/zebra_fpm.c +++ b/zebra/zebra_fpm.c @@ -713,7 +713,15 @@ static int zfpm_read_cb(struct thread *thread) nbyte = stream_read_try(ibuf, zfpm_g->sock, FPM_MSG_HDR_LEN - already); if (nbyte == 0 || nbyte == -1) { - zfpm_connection_down("closed socket in read"); + if (nbyte == -1) { + char buffer[1024]; + + sprintf(buffer, "closed socket in read(%d): %s", + errno, safe_strerror(errno)); + zfpm_connection_down(buffer); + } + else + zfpm_connection_down("closed socket in read"); return 0; } @@ -743,7 +751,15 @@ static int zfpm_read_cb(struct thread *thread) nbyte = stream_read_try(ibuf, zfpm_g->sock, msg_len - already); if (nbyte == 0 || nbyte == -1) { - zfpm_connection_down("failed to read message"); + if (nbyte == -1) { + char buffer[1024]; + + sprintf(buffer, "failed to read message(%d) %s", + errno, safe_strerror(errno)); + zfpm_connection_down(buffer); + } + else + zfpm_connection_down("failed to read message"); return 0; } -- 2.39.5