aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2014-04-23 11:40:40 +0200
committerLoïc Hoguin <[email protected]>2014-04-23 11:40:40 +0200
commitad2c080dc2825c9c705f8e542298253834abee1c (patch)
tree9d399a6d26e0f9d1faa219e29b3cc5a68e38cf5c
parentc1d0c4571ed744d4430576e171dc252937866974 (diff)
downloadranch-ad2c080dc2825c9c705f8e542298253834abee1c.tar.gz
ranch-ad2c080dc2825c9c705f8e542298253834abee1c.tar.bz2
ranch-ad2c080dc2825c9c705f8e542298253834abee1c.zip
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.
-rw-r--r--src/ranch_ssl.erl8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/ranch_ssl.erl b/src/ranch_ssl.erl
index f3a669d..29e72f4 100644
--- a/src/ranch_ssl.erl
+++ b/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)