ssl library init while creating context
authorMarcel Poul <marcel.poul@cern.ch>
Thu, 15 Dec 2011 16:48:51 +0000 (16:48 +0000)
committerMarcel Poul <marcel.poul@cern.ch>
Thu, 15 Dec 2011 16:48:51 +0000 (16:48 +0000)
emi.canl.canl-c/src/canl.c
emi.canl.canl-c/src/canl_ssl.c

index 0459408..f5d6523 100644 (file)
@@ -13,6 +13,9 @@ canl_ctx canl_create_ctx()
     ctx = (glb_ctx *) calloc(1, sizeof(*ctx));
     if (!ctx) 
         return NULL;
+
+    SSL_library_init();
+    SSL_load_error_strings();
     return ctx;
 }
 
@@ -53,9 +56,6 @@ canl_io_handler canl_create_io_handler(canl_ctx cc)
         goto end;
     }
 
-    SSL_library_init();
-    SSL_load_error_strings();
-
 end:
     if (err) {
         update_error(g_cc,"cannot create canl_io_handler");
index fb17a2e..eba8d3a 100644 (file)
@@ -416,8 +416,8 @@ static int do_ssl_accept( glb_ctx *cc, io_handler *io, struct timeval *timeout)
             set_error (cc, err, posix_error, "Connection stuck"
                     " during handshake: timeout reached"); 
         }
-        else if (ret2 < 0)
-            set_error (cc, 0, unknown_error, "connection closed by"
+        else if (ret2 <= 0)
+            set_error (cc, ssl_err, ssl_error, "Connection closed by"
                    " the other side");
        else
            set_error (cc, 0, unknown_error, "Error during SSL handshake");