diff --git a/sources/frontend.c b/sources/frontend.c index e025afeb..5ae8fd3a 100644 --- a/sources/frontend.c +++ b/sources/frontend.c @@ -831,8 +831,8 @@ od_frontend_cleanup(od_client_t *client, char *context, od_getpeername(client->io.io, peer, sizeof(peer), 1, 1); od_log(&instance->logger, context, client, server, - "client disconnected (read/write error, addr %s): %s", - peer, od_io_error(&client->io)); + "client disconnected (read/write error, addr %s): %s, status %s", + peer, od_io_error(&client->io),od_status_to_str(status)); if (! client->server) break; rc = od_reset(server); @@ -865,8 +865,8 @@ od_frontend_cleanup(od_client_t *client, char *context, /* close client connection and close server * connection in case of server errors */ od_log(&instance->logger, context, client, server, - "server disconnected (read/write error): %s", - od_io_error(&server->io)); + "server disconnected (read/write error): %s, status %s", + od_io_error(&server->io), od_status_to_str(status)); od_frontend_error(client, KIWI_CONNECTION_FAILURE, "remote server read/write error %s%.*s", server->id.id_prefix, diff --git a/sources/status.h b/sources/status.h index 4ace25c0..4fcb506a 100644 --- a/sources/status.h +++ b/sources/status.h @@ -25,4 +25,40 @@ typedef enum OD_ECLIENT_WRITE } od_status_t; +static inline char * +od_status_to_str(od_status_t status){ + switch (status) + { + case OD_UNDEF: + return "OD_UNDEF"; + case OD_OK: + return "OD_OK"; + case OD_SKIP: + return "OD_SKIP"; + case OD_ATTACH: + return "OD_UNDEF"; + case OD_DETACH: + return "OD_DETACH"; + case OD_STOP: + return "OD_STOP"; + case OD_EOOM: + return "OD_EOOM"; + case OD_EATTACH: + return "OD_EATTACH"; + case OD_EATTACH_TOO_MANY_CONNECTIONS: + return "OD_EATTACH_TOO_MANY_CONNECTIONS"; + case OD_ESERVER_CONNECT: + return "OD_ESERVER_CONNECT"; + case OD_ESERVER_READ: + return "OD_ESERVER_READ"; + case OD_ESERVER_WRITE: + return "OD_ESERVER_WRITE"; + case OD_ECLIENT_READ: + return "OD_ECLIENT_READ"; + case OD_ECLIENT_WRITE: + return "OD_ECLIENT_WRITE"; + } + return "unkonown"; +} + #endif /* ODYSSEY_STATUS_H */