4 * Client-side IPC functions
16 #include <sys/types.h>
17 #include <sys/socket.h>
18 #include <netinet/in.h>
19 #include <arpa/inet.h>
27 #include "citadel_ipc.h"
28 #include "citadel_decls.h"
35 * FIXME: rewrite all of Ford's stuff here, it won't work with multiple
39 static void (*deathHook)(void) = NULL;
40 int (*error_printf)(char *s, ...) = (int (*)(char *, ...))printf;
42 void setIPCDeathHook(void (*hook)(void)) {
46 void setIPCErrorPrintf(int (*func)(char *s, ...)) {
50 void connection_died(CtdlIPC* ipc, int using_ssl) {
51 if (deathHook != NULL)
54 error_printf("\r\nYour connection to %s is broken.\n",
55 ipc->ServInfo.humannode);
59 error_printf("Last error: %s\n",
60 ERR_reason_error_string(ERR_get_error()));
63 error_printf("Last error: %s\n", strerror(errno));
65 error_printf("Please re-connect and log in again.\n");
73 shutdown(ipc->sock, 2);
75 printf ("About to exit because of dead socket.\n");
81 static void ipc_timeout(int signum)
83 error_printf("\rConnection timed out.\n");