X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fipc_c_tcp.c;h=bc68721c6aa9e768199ef70027fe8dce2843abe3;hb=1e656d277fe91b7c4f5d73eab4a0dd0b7a173145;hp=e558932b032db1e11bf1d44dc89aeb379c787f0e;hpb=68ef036f186cfd3830d0175e6c4ba3e9c526944c;p=citadel.git diff --git a/citadel/ipc_c_tcp.c b/citadel/ipc_c_tcp.c index e558932b0..bc68721c6 100644 --- a/citadel/ipc_c_tcp.c +++ b/citadel/ipc_c_tcp.c @@ -23,10 +23,10 @@ #include #include #include +#include #include "citadel.h" #include "citadel_ipc.h" #include "citadel_decls.h" -#include "tools.h" #ifndef HAVE_SNPRINTF #include "snprintf.h" #endif @@ -47,27 +47,33 @@ void setIPCErrorPrintf(int (*func)(char *s, ...)) { error_printf = func; } -void connection_died(CtdlIPC *ipc) { +void connection_died(CtdlIPC* ipc, int using_ssl) { if (deathHook != NULL) deathHook(); - error_printf("\rYour connection to this Citadel server is broken.\n" - "Last error: %s\n" - "Please re-connect and log in again.\n", - strerror(errno)); + error_printf("\r\nYour connection to %s is broken.\n", + ipc->ServInfo.humannode); + +#ifdef HAVE_OPENSSL + if (using_ssl) { + error_printf("Last error: %s\n", + ERR_reason_error_string(ERR_get_error())); + } else +#endif + error_printf("Last error: %s\n", strerror(errno)); + + error_printf("Please re-connect and log in again.\n"); fflush(stderr); fflush(stdout); #ifdef HAVE_OPENSSL - /* ...don't try to shut down a connection on a dead socket? - SSL_shutdown(ipc->ssl); - */ - SSL_free(ipc->ssl); ipc->ssl = NULL; #endif shutdown(ipc->sock, 2); ipc->sock = -1; + printf ("About to exit because of dead socket.\n"); + exit (1); }