2004-07-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>

* configure.in: 1.0.1.
	* server/ApplicationServer.cs: don't timeout in Select when we only have
	the listener socket. Use real times for timeout.

svn path=/trunk/xsp/; revision=31618
This commit is contained in:
Gonzalo Paniagua Javier 2004-07-29 17:03:23 +00:00
Родитель 078fc6e3f7
Коммит e4f072c8d2
3 изменённых файлов: 29 добавлений и 15 удалений

Просмотреть файл

@ -1,3 +1,9 @@
2004-07-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* configure.in: 1.0.1.
* server/ApplicationServer.cs: don't timeout in Select when we only have
the listener socket. Use real times for timeout.
2004-07-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* server/ApplicationServer.cs: increased the backlog for listen, set

Просмотреть файл

@ -1,7 +1,7 @@
AC_PREREQ(2.57)
AC_INIT(server/server.cs)
AC_CANONICAL_SYSTEM
AM_INIT_AUTOMAKE(xsp, 1.0)
AM_INIT_AUTOMAKE(xsp, 1.0.1)
AM_MAINTAINER_MODE
AC_PROG_INSTALL

Просмотреть файл

@ -273,7 +273,8 @@ namespace Mono.ASPNET
Socket client;
int w;
while (!stop){
Socket.Select (wSockets, null, null, 500 * 1000); // 500ms
w = wSockets.Count;
Socket.Select (wSockets, null, null, (w == 1) ? -1 : 1000 * 1000); // 1s
w = wSockets.Count;
for (int i = 0; i < w; i++) {
Socket s = (Socket) wSockets [i];
@ -282,7 +283,7 @@ namespace Mono.ASPNET
WebTrace.WriteLine ("Accepted connection.");
SetSocketOptions (client);
allSockets.Add (client);
timeouts [client] = 0;
timeouts [client] = DateTime.Now;
continue;
}
@ -293,22 +294,29 @@ namespace Mono.ASPNET
}
w = timeouts.Count;
Socket [] socks_timeout = new Socket [w];
timeouts.Keys.CopyTo (socks_timeout, 0);
foreach (Socket k in socks_timeout) {
int n = (int) timeouts [k];
if (n >= 30) {
k.Close ();
allSockets.Remove (k);
timeouts.Remove (k);
continue;
if (w > 0) {
Socket [] socks_timeout = new Socket [w];
timeouts.Keys.CopyTo (socks_timeout, 0);
DateTime now = DateTime.Now;
foreach (Socket k in socks_timeout) {
DateTime atime = (DateTime) timeouts [k];
TimeSpan diff = now - atime;
if (diff.TotalMilliseconds > 15 * 1000) {
k.Close ();
allSockets.Remove (k);
timeouts.Remove (k);
continue;
}
}
timeouts [k] = ++n;
}
wSockets.Clear ();
wSockets.AddRange (allSockets);
if (allSockets.Count == 1) {
// shortcut, no foreach
wSockets.Add (listen_socket);
} else {
wSockets.AddRange (allSockets);
}
}
started = false;