$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!
Fri Jul 10 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
* Initial CVS import
-
}
-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);
-}
-
-
-
/*
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)
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;
hit_any_key();
set_keepalives(KA_YES);
return(0);
- }
- return(lp);
}
+ return(lp);
+}