Просмотр исходного кода

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 лет назад
Родитель
Сommit
ad2c080dc2
1 измененных файлов с 8 добавлено и 0 удалено
  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)