]> code.citadel.org Git - citadel.git/blobdiff - citadel/ipc_c_tcp.c
* Removed the auto-reconnect stuff... it was locking the client in an active
[citadel.git] / citadel / ipc_c_tcp.c
index ce03dc818aab8f5e1adbd6d6a54dd63b3484382f..d9545d75c28cfc1d92cafd3a991ed864a9c225a7 100644 (file)
@@ -51,12 +51,21 @@ char server_is_local = 0;
 
 int serv_sock;
 
+void connection_died(void) {
+       fprintf(stderr, "\r"
+                       "Your connection to this Citadel server is broken.\n"
+                       "Please re-connect and log in again.\n");
+       logoff(3);
+}
+
+
 void timeout(int signum)
 {
        printf("\rConnection timed out.\n");
        logoff(3);
 }
 
+
 int connectsock(char *host, char *service, char *protocol)
 {
        struct hostent *phe;
@@ -163,7 +172,7 @@ void serv_read(char *buf, int bytes)
        while (len < bytes) {
                rlen = read(serv_sock, &buf[len], bytes - len);
                if (rlen < 1) {
-                       serv_sock = (-1);
+                       connection_died();
                        return;
                }
                len = len + rlen;
@@ -182,7 +191,7 @@ void serv_write(char *buf, int nbytes)
                retval = write(serv_sock, &buf[bytes_written],
                               nbytes - bytes_written);
                if (retval < 1) {
-                       serv_sock = (-1);
+                       connection_died();
                        return;
                }
                bytes_written = bytes_written + retval;
@@ -328,11 +337,3 @@ char serv_getc(void)
        return (ch);
 }
 
-
-
-/* 
- * Are we still connected to a Citadel server?
- */
-int is_connected(void) {
-       return ( serv_sock >= 0 );
-}