The server could sometimes end up listening for events even though it
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. git-svn-id: https://shellinabox.googlecode.com/svn/trunk@238 0da03de8-d603-11dd-86c2-0f8696b7b6f9
This commit is contained in:
parent
0ee4984e2c
commit
1a33fc8127
11 changed files with 19 additions and 19 deletions
2
config.h
2
config.h
|
@ -174,7 +174,7 @@
|
|||
#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"
|
||||
|
|
2
configure
vendored
2
configure
vendored
|
@ -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
|
||||
|
|
|
@ -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])
|
||||
|
|
|
@ -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");
|
||||
};
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 ?
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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");
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue