$NetBSD: patch-ad,v 1.3 2005/03/20 18:50:09 salo Exp $

--- jabberd/mio_ssl.c.orig	2002-02-08 07:39:27.000000000 +0000
+++ jabberd/mio_ssl.c
@@ -63,6 +63,7 @@ void mio_ssl_init(xmlnode x)
 
     log_debug(ZONE, "Handling configuration using: %s", xmlnode2str(x));
     /* Generic SSL Inits */
+    SSL_library_init();
 	OpenSSL_add_all_algorithms();    
     SSL_load_error_strings();
 
@@ -219,6 +220,15 @@ int _mio_ssl_accept(mio m, struct sockad
     SSL_CTX *ctx = NULL;
     int fd;
     int sret;
+    int flags;
+
+    fd = accept(m->fd, serv_addr, addrlen);
+
+    /* set the socket to non-blocking as this is not
+       inherited */
+    flags =  fcntl(fd, F_GETFL, 0);
+    flags |= O_NONBLOCK;
+    fcntl(fd, F_SETFL, flags);
 
     if(m->ip == NULL)
     {
@@ -226,8 +236,6 @@ int _mio_ssl_accept(mio m, struct sockad
         return -1;
     }
 
-    fd = accept(m->fd, serv_addr, addrlen);
-    
     ctx = ghash_get(ssl__ctxs, m->ip);
     if(ctx == NULL)
     {
