adds blockingio config

Tue, 27 Dec 2016 17:54:00 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Tue, 27 Dec 2016 17:54:00 +0100
changeset 134
44415e4399ce
parent 133
87b405d61f64
child 135
471e28cca288

adds blockingio config

src/server/daemon/config.c file | annotate | diff | comparison | revisions
src/server/daemon/httplistener.c file | annotate | diff | comparison | revisions
src/server/daemon/httplistener.h file | annotate | diff | comparison | revisions
--- a/src/server/daemon/config.c	Tue Dec 27 17:19:00 2016 +0100
+++ b/src/server/daemon/config.c	Tue Dec 27 17:54:00 2016 +0100
@@ -575,6 +575,13 @@
             obj->directives,
             sstr("Threadpool")));
     
+    sstr_t blockingio = cfg_directivelist_get_str(
+            obj->directives,
+            sstr("BlockingIO"));
+    if(blockingio.ptr) {
+        lc.blockingio = util_getboolean_s(blockingio, WS_FALSE);
+    }
+    
     sstr_t ssl = cfg_directivelist_get_str(obj->directives, S("SSL"));
     if(util_getboolean_s(ssl, WS_FALSE)) {
         sstr_t cert = cfg_directivelist_get_str(obj->directives, S("Cert"));
--- a/src/server/daemon/httplistener.c	Tue Dec 27 17:19:00 2016 +0100
+++ b/src/server/daemon/httplistener.c	Tue Dec 27 17:54:00 2016 +0100
@@ -153,8 +153,11 @@
     if(listener->threadpool == NULL) {
         listener->threadpool = get_default_threadpool();
     }
-    //listener->session_handler = create_basic_session_handler();
-    listener->session_handler = create_event_session_handler();
+    if(conf->blockingio) {
+        listener->session_handler = create_basic_session_handler();
+    } else {
+        listener->session_handler = create_event_session_handler();
+    }
     listener->nacceptors = conf->nacceptors;
     listener->port = conf->port;
     listener->ref = 1;
@@ -401,7 +404,10 @@
         if(ls->ssl) {
             SSL *ssl = SSL_new(ls->ssl->sslctx);
             SSL_set_fd(ssl, clientfd);
-            if(SSL_accept(ssl) <= 0) {
+            int ssl_ar = SSL_accept(ssl);
+            if(ssl_ar <= 0) {
+                int error = SSL_get_error(ssl, ssl_ar);
+                log_ereport(LOG_INFORM, "SSL accept error: %d", error);
                 free(conn);
                 conn = NULL;
             } else {
--- a/src/server/daemon/httplistener.h	Tue Dec 27 17:19:00 2016 +0100
+++ b/src/server/daemon/httplistener.h	Tue Dec 27 17:54:00 2016 +0100
@@ -62,6 +62,7 @@
     char                 *address;
     int                  port;
     int                  nacceptors;
+    WSBool               blockingio;
     WSBool               ssl;
     sstr_t               certfile;
     sstr_t               privkeyfile;

mercurial