Fix error message at client disconnect when using OpenSSL.
authorMartin Johansson <martin@fatbob.nu>
Mon, 3 Dec 2012 19:53:54 +0000 (20:53 +0100)
committerMartin Johansson <martin@fatbob.nu>
Tue, 5 Feb 2013 20:31:06 +0000 (21:31 +0100)
src/client.c

index abb9377ef1b0dbc5f52d6566022250f0a282da05..abd90e6f7cfd8cd0b6de9e96698f3be6e78edb53 100644 (file)
@@ -514,14 +514,18 @@ int Client_read(client_t *client)
                                client->readBlockedOnWrite = true;
                                return 0;
                        }
-                       else if (SSLi_get_error(client->ssl, rc) == SSLI_ERROR_ZERO_RETURN) {
+                       else if (SSLi_get_error(client->ssl, rc) == SSLI_ERROR_ZERO_RETURN || 
+                                SSLi_get_error(client->ssl, rc) == 0) {
                                Log_info_client(client, "Connection closed by peer");
-                               if (!client->shutdown_wait)
-                                       Client_close(client);
+                               Client_free(client);
                        }
                        else {
                                if (SSLi_get_error(client->ssl, rc) == SSLI_ERROR_SYSCALL) {
-                                       Log_info_client(client,"Error: %s  - Closing connection", strerror(errno));
+                                       if (errno == 0)
+                                               Log_info_client(client, "Connection closed by peer");
+                                       else
+                                               Log_info_client(client,"Error: %s  - Closing connection (code %d)", 
+                                                               strerror(errno));
                                }
                                else if (SSLi_get_error(client->ssl, rc) == SSLI_ERROR_CONNRESET) {
                                        Log_info_client(client, "Connection reset by peer");