]> code.citadel.org Git - citadel.git/commitdiff
* Fixed a bug in keyboard polling (in commands.c) which was causing the
authorArt Cancro <ajc@citadel.org>
Thu, 10 Aug 2000 04:36:25 +0000 (04:36 +0000)
committerArt Cancro <ajc@citadel.org>
Thu, 10 Aug 2000 04:36:25 +0000 (04:36 +0000)
  client protocol to get out of sync in certain conditions.

citadel/ChangeLog
citadel/citadel.c
citadel/commands.c

index e68930345a7335601a0db881706ed2589dc7ace3..9ed10d4020b91c5788f71887a5f6cfd285666a87 100644 (file)
@@ -1,4 +1,8 @@
  $Log$
+ Revision 572.25  2000/08/10 04:36:25  ajc
+ * Fixed a bug in keyboard polling (in commands.c) which was causing the
+   client protocol to get out of sync in certain conditions.
+
  Revision 572.24  2000/08/10 02:42:13  ajc
  * Changed all the "200 ok" responses to more descriptive strings
  * Added a *temporary* protocol sync check.  Remove this!
@@ -1987,4 +1991,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 c13d9d9a8da450275c1af06e7a967167a3980d94..9e4ffc9b9f13eeb114537227ba7ddc31da237618 100644 (file)
@@ -824,32 +824,6 @@ void enternew(char *desc, char *buf, int maxlen)
 }
 
 
-void proto_sync_check(void) {          /* FIXME ... remove this */
-       char buf[256];
-       char token[256];
-       FILE *fp;
-
-       safestrncpy(token, tmpnam(NULL), sizeof token);
-       sprintf(buf, "ECHO %s", token);
-       serv_puts(buf);
-       serv_gets(buf);
-       if (!strcmp(&buf[4], token)) return;
-
-       fp = fopen(token, "w");
-       fprintf(fp, "%s\n", buf);
-       while (serv_gets(buf), strcmp(&buf[4], token)) {
-               fprintf(fp, "%s\n", buf);
-       }
-       fclose(fp);
-
-       sprintf(buf, "gedit %s &", token);
-       system(buf);
-       sleep(3);
-       unlink(token);
-}
-
-
-
 
 
 /*
@@ -1058,13 +1032,12 @@ PWOK:   printf("%s\nAccess level: %d (%s)\nUser #%ld / Call #%d\n",
        else
                readmsgs(1, 1, 0);
 
-       do {                    /* MAIN LOOP OF PROGRAM */
-
-               proto_sync_check();     /* FIXME ... remove this */
-               mcmd = getcmd(argbuf);
+       /* MAIN COMMAND LOOP */
+       do {
+               mcmd = getcmd(argbuf);          /* Get keyboard command */
 
 #ifdef TIOCGWINSZ
-               check_screen_dims();
+               check_screen_dims();            /* if xterm, get screen size */
 #endif
 
                if (termn8 == 0)
index dc1461b2dbae0dbe1ade654d5c584a6226c3a4f6..3b7372f679499d124b153d3db2d7fb83f3444b3e 100644 (file)
@@ -99,8 +99,14 @@ char was_a_key_pressed(void) {
        tv.tv_usec = 0;
        retval = select(1, &rfds, NULL, NULL, &tv); 
 
+       /* Careful!  Disable keepalives during keyboard polling; we're probably
+        * in the middle of a data transfer from the server, in which case
+        * sending a NOOP would throw the client protocol out of sync.
+        */
        if (FD_ISSET(0, &rfds)) {
+               set_keepalives(KA_NO);
                the_character = inkey();
+               set_keepalives(KA_YES);
        }
        else {
                the_character = 0;
@@ -133,9 +139,9 @@ int checkpagin(int lp, int pagin, int height)
                hit_any_key();
                set_keepalives(KA_YES);
                return(0);
-               }
-       return(lp);
        }
+       return(lp);
+}