File 0149-ssl-Handle-econnreset-windows-obscurities.patch of Package erlang

From b8cb38d3ac35b60f518fe86b7f86dd9053893831 Mon Sep 17 00:00:00 2001
From: Ingela Anderton Andin <ingela@erlang.org>
Date: Sat, 6 May 2017 16:25:11 +0200
Subject: [PATCH] ssl: Handle econnreset windows obscurities

An UDP socket does note have a connection and should
not recive econnreset, however this happens on on some windows versions.
Just ignoring it appears to make things work as expected!
---
 lib/ssl/src/dtls_udp_listener.erl | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/lib/ssl/src/dtls_udp_listener.erl b/lib/ssl/src/dtls_udp_listener.erl
index f0ace2d88..29380e300 100644
--- a/lib/ssl/src/dtls_udp_listener.erl
+++ b/lib/ssl/src/dtls_udp_listener.erl
@@ -121,6 +121,18 @@ handle_info({udp, Socket, IP, InPortNo, _} = Msg, #state{listner = Socket} = Sta
     next_datagram(Socket),
     {noreply, State};
 
+%% UDP socket does not have a connection and should not receive an econnreset
+%% This does however happens on on some windows versions. Just ignoring it
+%% appears to make things work as expected! 
+handle_info({udp_error, Socket, econnreset = Error}, #state{listner = Socket} = State) ->
+    Report = io_lib:format("Ignore SSL UDP Listener: Socket error: ~p ~n", [Error]),
+    error_logger:info_report(Report),
+    {noreply, State};
+handle_info({udp_error, Socket, Error}, #state{listner = Socket} = State) ->
+    Report = io_lib:format("SSL UDP Listener shutdown: Socket error: ~p ~n", [Error]),
+    error_logger:info_report(Report),
+    {noreply, State#state{close=true}};
+
 handle_info({'DOWN', _, process, Pid, _}, #state{clients = Clients,
 						 dtls_processes = Processes0,
                                                  close = ListenClosed} = State) ->
-- 
2.13.0

openSUSE Build Service is sponsored by