]> andersk Git - test.git/commitdiff
The server could sometimes end up listening for events even though it
authorMarkus Gutschke <markus@shellinabox.com>
Sat, 2 Oct 2010 23:40:24 +0000 (23:40 +0000)
committerMarkus Gutschke <markus@shellinabox.com>
Sat, 2 Oct 2010 23:40:24 +0000 (23:40 +0000)
was not really interested in them. This could result in inefficient I/O
behavior and most noticably it broke the ability to interrupt long running
output with CTRL-C.

config.h
configure
configure.ac
demo/vt100.js
libhttp/http.h
libhttp/httpconnection.c
libhttp/server.c
libhttp/server.h
shellinabox/shell_in_a_box.js
shellinabox/shellinaboxd.c
shellinabox/vt100.js

index 755a94b594677c0004a6d54bd08d30353f2291ef..cbea12a10234e61dbc765ed020a62b529b4c0ce6 100644 (file)
--- a/config.h
+++ b/config.h
 #define STDC_HEADERS 1
 
 /* Most recent revision number in the version control system */
-#define VCS_REVISION "237"
+#define VCS_REVISION "238"
 
 /* Version number of package */
 #define VERSION "2.10"
index fcdca25cd04772a8b6db288310a96b6dc90f549c..b449c85525ec3c8fefb75ccd658308221031bece 100755 (executable)
--- a/configure
+++ b/configure
@@ -2328,7 +2328,7 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
-VCS_REVISION=237
+VCS_REVISION=238
 
 
 cat >>confdefs.h <<_ACEOF
index 04a95525640e9aed670ba1bb0d693255ac5ea4f8..b8d05bb8d51f00601ce66adbc60699d3127fbee2 100644 (file)
@@ -2,7 +2,7 @@ AC_PREREQ(2.57)
 
 dnl This is the one location where the authoritative version number is stored
 AC_INIT(shellinabox, 2.10, markus@shellinabox.com)
-VCS_REVISION=237
+VCS_REVISION=238
 AC_SUBST(VCS_REVISION)
 AC_DEFINE_UNQUOTED(VCS_REVISION, "${VCS_REVISION}",
                    [Most recent revision number in the version control system])
index 5f1ee93fe10b25383c3738bf6e8ce37942f4005c..f76687c731b65ea6d39c3e1c9207c6170894a32f 100644 (file)
@@ -2402,7 +2402,7 @@ VT100.prototype.toggleCursorBlinking = function() {
 };
 
 VT100.prototype.about = function() {
-  alert("VT100 Terminal Emulator " + "2.10 (revision 237)" +
+  alert("VT100 Terminal Emulator " + "2.10 (revision 238)" +
         "\nCopyright 2008-2010 by Markus Gutschke\n" +
         "For more information check http://shellinabox.com");
 };
index cec2fe09a6f40d88d14874419e6839e29ee4cbf7..07e235d7f166cf639c28d3634709c60c1b63bfd8 100644 (file)
@@ -98,7 +98,7 @@ time_t serverGetTimeout(ServerConnection *connection);
 ServerConnection *serverGetConnection(Server *server, ServerConnection *hint,
                                       int fd);
 short serverConnectionSetEvents(Server *server, ServerConnection *connection,
-                                short events);
+                                int fd, short events);
 void serverExitLoop(Server *server, int exitAll);
 void serverLoop(Server *server);
 int  serverSupportsSSL();
index fc42558550a1a00337f019d2eea5bbe972a2791f..a19ac3f283d713625c1792b1f93d28447d326eac 100644 (file)
@@ -768,7 +768,7 @@ void httpTransfer(struct HttpConnection *http, char *msg, int len) {
         if (!serverGetTimeout(connection)) {
           serverSetTimeout(connection, CONNECTION_TIMEOUT);
         }
-        serverConnectionSetEvents(http->server, connection,
+        serverConnectionSetEvents(http->server, connection, http->fd,
                                   http->msgLength ? POLLIN|POLLOUT : POLLIN);
       }
     }
index b7e2d031babf5d4a745d8e5bd5a4a239f8ca297a..58ef9493c476a2881777a383c64fa144f3b56d33 100644 (file)
@@ -453,7 +453,7 @@ struct ServerConnection *serverGetConnection(struct Server *server,
 }
 
 short serverConnectionSetEvents(struct Server *server,
-                                struct ServerConnection *connection,
+                                struct ServerConnection *connection, int fd,
                                 short events) {
   dcheck(server);
   dcheck(connection);
@@ -463,6 +463,7 @@ short serverConnectionSetEvents(struct Server *server,
   dcheck(!connection->deleted);
   int   idx                       = connection - server->connections;
   short oldEvents                 = server->pollFds[idx + 1].events;
+  dcheck(fd == server->pollFds[idx + 1].fd);
   server->pollFds[idx + 1].events = events;
   return oldEvents;
 }
@@ -582,14 +583,12 @@ void serverLoop(struct Server *server) {
         if (server->pollFds[i].revents) {
           eventCount--;
         }
-        short events                      = server->pollFds[i].events;
         if (!connection->handleConnection(connection, connection->arg,
-                                         &events, server->pollFds[i].revents)){
+                                          &server->pollFds[i].events,
+                                          server->pollFds[i].revents)) {
           connection                      = server->connections + i - 1;
           connection->destroyConnection(connection->arg);
           connection->deleted             = 1;
-        } else {
-          server->pollFds[i].events       = events;
         }
       }
     }
index 8d3141fee2cf97743a904c95b92f4c5a535feb59..8900d9987dc56af6ec045742b434b528dae89c9a 100644 (file)
@@ -109,7 +109,7 @@ struct ServerConnection *serverGetConnection(struct Server *server,
                                              struct ServerConnection *hint,
                                              int fd);
 short serverConnectionSetEvents(struct Server *server,
-                                struct ServerConnection *connection,
+                                struct ServerConnection *connection, int fd,
                                 short events);
 void serverExitLoop(struct Server *server, int exitAll);
 void serverLoop(struct Server *server);
index 6a90cbffc3a521916e628acfafceb62ac4e2f36d..244384e43fa8771c2231c590c23b0ada5f8ae334 100644 (file)
@@ -358,7 +358,7 @@ ShellInABox.prototype.extendContextMenu = function(entries, actions) {
 };
 
 ShellInABox.prototype.about = function() {
-  alert("Shell In A Box version " + "2.10 (revision 237)" +
+  alert("Shell In A Box version " + "2.10 (revision 238)" +
         "\nCopyright 2008-2010 by Markus Gutschke\n" +
         "For more information check http://shellinabox.com" +
         (typeof serverSupportsSSL != 'undefined' && serverSupportsSSL ?
index 1716129e8ba9d6e05e4b93cea2f599627d4a1515..f508c66b809754880bbf9a7944a35d82e324ec1f 100644 (file)
@@ -282,8 +282,7 @@ static void sessionDone(void *arg) {
 }
 
 static int handleSession(struct ServerConnection *connection, void *arg,
-                         short *events ATTR_UNUSED, short revents) {
-  UNUSED(events);
+                         short *events, short revents) {
   struct Session *session       = (struct Session *)arg;
   session->connection           = connection;
   int len                       = MAX_RESPONSE - session->len;
@@ -311,7 +310,7 @@ static int handleSession(struct ServerConnection *connection, void *arg,
                                                       session->pty);
     session->connection         = connection;
     if (session->len >= MAX_RESPONSE) {
-      serverConnectionSetEvents(session->server, connection, 0);
+      *events                   = 0;
     }
     serverSetTimeout(connection, AJAX_TIMEOUT);
     return 1;
@@ -460,13 +459,15 @@ static int dataHandler(HttpConnection *http, struct Service *service,
       serverSetTimeout(session->connection, AJAX_TIMEOUT);
       if (session->len < MAX_RESPONSE) {
         // Re-enable input on the child's pty
-        serverConnectionSetEvents(session->server, session->connection,POLLIN);
+        serverConnectionSetEvents(session->server, session->connection,
+                                  session->pty, POLLIN);
       }
     }
     return HTTP_DONE;
   } else if (session->connection) {
     // Re-enable input on the child's pty
-    serverConnectionSetEvents(session->server, session->connection, POLLIN);
+    serverConnectionSetEvents(session->server, session->connection,
+                              session->pty, POLLIN);
     serverSetTimeout(session->connection, AJAX_TIMEOUT);
   }
 
index 5f1ee93fe10b25383c3738bf6e8ce37942f4005c..f76687c731b65ea6d39c3e1c9207c6170894a32f 100644 (file)
@@ -2402,7 +2402,7 @@ VT100.prototype.toggleCursorBlinking = function() {
 };
 
 VT100.prototype.about = function() {
-  alert("VT100 Terminal Emulator " + "2.10 (revision 237)" +
+  alert("VT100 Terminal Emulator " + "2.10 (revision 238)" +
         "\nCopyright 2008-2010 by Markus Gutschke\n" +
         "For more information check http://shellinabox.com");
 };
This page took 0.074922 seconds and 5 git commands to generate.