Browse Source

Ignore some errors that may occur during handshake

These errors just pollute the logs when garbage is sent to the
socket. Exit the process normally to avoid unwanted logs.
Loïc Hoguin 11 years ago
parent
commit
ad2c080dc2
1 changed files with 8 additions and 0 deletions
  1. 8 0
      src/ranch_ssl.erl

+ 8 - 0
src/ranch_ssl.erl

@@ -96,6 +96,14 @@ accept_ack(CSocket, Timeout) ->
 	case ssl:ssl_accept(CSocket, Timeout) of
 		ok ->
 			ok;
+		%% Garbage was most likely sent to the socket, don't error out.
+		{error, {tls_alert, _}} ->
+			ok = close(CSocket),
+			exit(normal);
+		%% Socket most likely stopped responding, don't error out.
+		{error, timeout} ->
+			ok = close(CSocket),
+			exit(normal);
 		{error, Reason} ->
 			ok = close(CSocket),
 			error(Reason)