  - (NSException *)_processCommandParserException:(NSException *)_exception {
    [self logWithFormat:@"ERROR(%s): catched IMAP4 parser exception %@: %@",
  	__PRETTY_FUNCTION__, [_exception name], [_exception reason]];
-@@ -1412,21 +1567,24 @@
+@@ -1280,7 +1435,9 @@
+     if (tryReconnect) {
+       [self reconnect];
+     }
+-    else if ([map objectForKey:@"bye"] && ![_command hasPrefix:@"logout"]) {
++    else if ([map objectForKey:@"bye"]
++             && ![_command hasPrefix:@"logout"]
++             && ![self _isLoginCommand:_command]) {
+       if (reconnectCnt == 0) {
+         reconnectCnt++;
+         tryReconnect = YES;
+@@ -1412,21 +1569,24 @@
        return nil;
    }
  

+
+- (void) acceptControlMessage: (NSNotification *) aNotification
+{
+  NGActiveSocket *controlSocket, *connection;
+  WOChildMessage message;
+  NSAutoreleasePool *pool;
+
+  // NSLog (@"received control message");
+  controlSocket = [aNotification object];
+  // [self logWithFormat:@"child accepting message from socket: %@", controlSocket];
+  while (![controlSocket safeReadBytes: &message
+                                 count: sizeof (WOChildMessage)])
+    NSLog (@"renotifying watchdog");
+  if (message == WOChildMessageAccept) {
+    pool = [NSAutoreleasePool new];
+    connection = [self _accept];
+    if ([controlSocket safeWriteBytes: &message
+                                count: sizeof (WOChildMessage)])
+      ;
+    [self _handleConnection: connection];
+    message = WOChildMessageReady;
+    [controlSocket safeWriteBytes: &message count: sizeof (WOChildMessage)];
+    [pool release];
+  }
+  else if (message == WOChildMessageShutdown) {
+    [controlSocket safeWriteBytes: &message
+                            count: sizeof (WOChildMessage)];
+    [[WOCoreApplication application] terminate];
+  }
+}
+

 
 #if 0    
     if (((sd == nil) || (sd == ud)) && (appDomainPath != nil)) {
Index: sope-appserver/NGObjWeb/WODynamicElement.m
===================================================================
--- sope-appserver/NGObjWeb/WODynamicElement.m	(revision 1664)
+++ sope-appserver/NGObjWeb/WODynamicElement.m	(working copy)
@@ -98,6 +98,7 @@
     template = [[WOCompoundElement allocForCount:[_contents count]
                                    zone:[self zone]]
                                    initWithContentElements:_contents];
+    [template autorelease];
   }
   
   return [self initWithName:_name
Index: sope-appserver/NGObjWeb/WOHTTPConnection.m
===================================================================
--- sope-appserver/NGObjWeb/WOHTTPConnection.m	(revision 1664)
+++ sope-appserver/NGObjWeb/WOHTTPConnection.m	(working copy)
@@ -38,7 +38,6 @@
 @interface WOHTTPConnection(Privates)
 - (BOOL)_connect;
 - (void)_disconnect;
-- (void)_unregisterNotification;
 @end
 
 @interface WOCookie(Privates)
@@ -153,7 +152,6 @@
 }
 
 - (void)dealloc {
-  [self _unregisterNotification];
   [self->lastException release];
   [self->log      release];
   [self->io       release];
@@ -288,57 +286,6 @@
   [self->socket release]; self->socket = nil;
 }
 
-/* runloop based IO */
-
-- (NSNotificationCenter *)notificationCenter {
-  return [NSNotificationCenter defaultCenter];
-}
-- (NSRunLoop *)runLoop {
-  return [NSRunLoop currentRunLoop];
-}
-- (NSString *)runLoopMode {
-  return NSDefaultRunLoopMode;
-}
-
-- (void)_socketActivated:(NSNotification *)_n {
-  if ([_n object] != self->socket)
-    return;
-
-#if DEBUG && 0  
-  [self debugWithFormat:@"socket activated ..."];
-#endif
-  
-  [[self notificationCenter]
-         postNotificationName:WOHTTPConnectionCanReadResponse
-         object:self];
-}
-
-- (void)_registerForNotification {
-  NSRunLoop *rl;
-  
-  if (self->didRegisterForNotification)
-    return;
-
-  [[self notificationCenter]
-         addObserver:self selector:@selector(_socketActivated:)
-         name:NSFileObjectBecameActiveNotificationName
-         object:self->socket];
-  
-  rl = [self runLoop];
-  [rl addFileObject:self->socket
-      activities:(NSPosixReadableActivity|NSPosixExceptionalActivity)
-      forMode:[self runLoopMode]];
-}
-- (void)_unregisterNotification {
-  if (!self->didRegisterForNotification)
-    return;
-  
-  [[self notificationCenter] removeObserver:self];
-  
-  [[self runLoop] removeFileObject:self->socket
-                  forMode:[self runLoopMode]];
-}
-
 /* logging IO */
 
 - (void)logRequest:(WORequest *)_response data:(NSData *)_data {
@@ -543,8 +490,6 @@
   if (![self->socket isConnected])
     return NO;
   
-  [self _registerForNotification];
-  
   return YES;
 }
 
@@ -560,7 +505,6 @@
   WOResponse *response;
   
   *(&response) = nil;
-  [self _unregisterNotification];
   
   if (self->socket == nil) {
     [self debugWithFormat:@"no socket available for reading response ..."];
Index: sope-appserver/NGObjWeb/GNUmakefile.postamble
===================================================================
--- sope-appserver/NGObjWeb/GNUmakefile.postamble	(revision 1664)
