Author: rfm
Date: Tue Aug 5 08:46:03 2014
New Revision: 38037
URL: http://svn.gna.org/viewcvs/gnustep?rev=38037&view=rev
Log:
tweak to shut down more cleanly
Modified:
libs/webserver/trunk/ChangeLog
libs/webserver/trunk/GNUmakefile
libs/webserver/trunk/WebServer.m
Modified: libs/webserver/trunk/ChangeLog
URL:
http://svn.gna.org/viewcvs/gnustep/libs/webserver/trunk/ChangeLog?rev=38037&r1=38036&r2=38037&view=diff
==============================================================================
--- libs/webserver/trunk/ChangeLog (original)
+++ libs/webserver/trunk/ChangeLog Tue Aug 5 08:46:03 2014
@@ -1,3 +1,10 @@
+2014-08-04 Richard Frith-Macdonald <[email protected]>
+
+ * WebServer.m: Run the main run loop and wait for connections to
+ shut down when shutting down the server.
+ * GNUmakefile: bump subminor version
+ Version 1.5.3:
+
2014-07-15 Richard Frith-Macdonald <[email protected]>
* WebServerConnection.m: Fix minor error logging raw data ... we now
Modified: libs/webserver/trunk/GNUmakefile
URL:
http://svn.gna.org/viewcvs/gnustep/libs/webserver/trunk/GNUmakefile?rev=38037&r1=38036&r2=38037&view=diff
==============================================================================
--- libs/webserver/trunk/GNUmakefile (original)
+++ libs/webserver/trunk/GNUmakefile Tue Aug 5 08:46:03 2014
@@ -21,7 +21,7 @@
-include config.make
PACKAGE_NAME = WebServer
-PACKAGE_VERSION = 1.5.2
+PACKAGE_VERSION = 1.5.3
WebServer_INTERFACE_VERSION=1.5
CVS_MODULE_NAME = gnustep/dev-libs/WebServer
CVS_TAG_NAME = WebServer
Modified: libs/webserver/trunk/WebServer.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/webserver/trunk/WebServer.m?rev=38037&r1=38036&r2=38037&view=diff
==============================================================================
--- libs/webserver/trunk/WebServer.m (original)
+++ libs/webserver/trunk/WebServer.m Tue Aug 5 08:46:03 2014
@@ -1312,6 +1312,7 @@
port: (NSString*)aPort
secure: (NSDictionary*)secure
{
+ CREATE_AUTORELEASE_POOL(pool);
BOOL ok = YES;
BOOL update = NO;
@@ -1355,6 +1356,7 @@
{
NSEnumerator *enumerator;
WebServerConnection *connection;
+ NSDate *limit = nil;
[_lock lock];
/* If we have been shut down (port is nil) then we want any
@@ -1363,6 +1365,10 @@
enumerator = [_connections objectEnumerator];
while ((connection = [enumerator nextObject]) != nil)
{
+ if (nil == limit)
+ {
+ limit = [NSDate dateWithTimeIntervalSinceNow: 30.0];
+ }
[connection shutdown];
}
/* We also get rid of the headers which refer to us, so that
@@ -1374,6 +1380,20 @@
DESTROY(_xCountConnectedHosts);
[_lock unlock];
+
+ /* Wait for all connections to close.
+ */
+ while (nil != limit && [limit timeIntervalSinceNow] > 0.0)
+ {
+ [[NSRunLoop currentRunLoop] runMode: NSDefaultRunLoopMode
+ beforeDate: limit];
+ [_lock lock];
+ if (0 == [_connections count])
+ {
+ limit = nil; // No more to close
+ }
+ [_lock unlock];
+ }
}
else
{
@@ -1429,6 +1449,7 @@
}
}
}
+ DESTROY(pool);
return ok;
}
_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs