* Removed the auto-reconnect stuff... it was locking the client in an active
authorArt Cancro <ajc@citadel.org>
Tue, 26 Oct 1999 20:20:29 +0000 (20:20 +0000)
committerArt Cancro <ajc@citadel.org>
Tue, 26 Oct 1999 20:20:29 +0000 (20:20 +0000)
  loop more often than it was reconnecting.

citadel/ChangeLog
citadel/citadel.c
citadel/ipc_c_tcp.c

index 73abd48cb9260b699c64d6c90062bd2cd38a6aae..1ab0cbaa1d1c38549ede456876761da5e8366df3 100644 (file)
@@ -1,4 +1,8 @@
 $Log$
+Revision 1.397  1999/10/26 20:20:29  ajc
+* Removed the auto-reconnect stuff... it was locking the client in an active
+  loop more often than it was reconnecting.
+
 Revision 1.396  1999/10/26 13:59:11  ajc
 damn bugs
 
@@ -1360,4 +1364,3 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
        * Initial CVS import 
-
index 65a074ec81488f06f8d7060cd4d6d5e63b4fc5a5..061148834270864b0c21bd790b7825263df694a5 100644 (file)
@@ -90,15 +90,6 @@ char curr_floor = 0;         /* number of current floor */
 char floorlist[128][256];      /* names of floors */
 char express_msgs = 0;         /* express messages waiting! */
 
-jmp_buf jmp_reconnect;         /* for server reconnects */
-char re_username[32];
-char re_password[32];
-
-void sigpipehandler(int nothing)
-{
-       longjmp(jmp_reconnect, nothing);
-}
-
 /*
  * here is our 'clean up gracefully and exit' routine
  */
@@ -719,7 +710,6 @@ int set_password(void)
                serv_puts(buf);
                serv_gets(buf);
                printf("%s\n", &buf[4]);
-               strcpy(re_password, pass1);
                return (0);
        } else {
                printf("*** They don't match... try again.\n");
@@ -896,7 +886,6 @@ GSTA:       termn8 = 0;
                goto TERMN8;
        }
        /* sign on to the server */
-       strcpy(re_username, fullname);
        snprintf(aaa, sizeof aaa, "USER %s", fullname);
        serv_puts(aaa);
        serv_gets(aaa);
@@ -914,7 +903,6 @@ GSTA:       termn8 = 0;
        serv_puts(aaa);
        serv_gets(aaa);
        if (aaa[0] == '2') {
-               strcpy(re_password, eee);
                load_user_info(&aaa[4]);
                goto PWOK;
        }
@@ -1015,48 +1003,8 @@ GSTA:    termn8 = 0;
 
        do {                    /* MAIN LOOP OF PROGRAM */
 
-               if (!is_connected()) {
-                       for (a=15; a>=0; --a) {
-                               printf("\rServer connection broken; "
-                                       "will reconnect in %d seconds\r", a);
-                               fflush(stdout);
-                               sleep(1);
-                       }
-                       printf( "                                "
-                               "                                \r");
-                       fflush(stdout);
-                       attach_to_server(argc, argv);
-                       printf("                                         \r");
-                       fflush(stdout);
-                       serv_gets(aaa);
-                       if (aaa[0] != '2') {
-                               printf("%s\n", &aaa[4]);
-                               exit(0);
-                       }
-                       get_serv_info();
-                       sprintf(aaa, "USER %s", re_username);
-                       serv_puts(aaa);
-                       serv_gets(aaa);
-                       if (aaa[0] != '3') {
-                               printf("%s\n", &aaa[4]);
-                               exit(0);
-                       }
-                       sprintf(aaa, "PASS %s", re_password);
-                       serv_puts(aaa);
-                       serv_gets(aaa);
-                       if (aaa[0] != '2') {
-                               printf("%s\n", &aaa[4]);
-                               exit(0);
-                       }
-                       load_user_info(&aaa[4]);
-                       sprintf(aaa, "GOTO %s", room_name);
-                       serv_puts(aaa);
-                       serv_gets(aaa);
-               }
-
                signal(SIGINT, SIG_IGN);
                signal(SIGQUIT, SIG_IGN);
-               signal(SIGPIPE, SIG_IGN);
                mcmd = getcmd(argbuf);
 
 #ifdef TIOCGWINSZ
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 );
-}