Skip to content

Instantly share code, notes, and snippets.

@fdmanana
Created September 30, 2010 00:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fdmanana/603808 to your computer and use it in GitHub Desktop.
Save fdmanana/603808 to your computer and use it in GitHub Desktop.
diff --git a/lib/ssl/src/ssl_broker.erl b/lib/ssl/src/ssl_broker.erl
index 178fb5f..7187b1f 100644
--- a/lib/ssl/src/ssl_broker.erl
+++ b/lib/ssl/src/ssl_broker.erl
@@ -608,6 +608,19 @@ handle_info({tcp, Socket, Data},
{noreply, St}
end;
+handle_info({tcp, Socket, Data},
+ #st{active = Active, collector = Collector, status = open,
+ proxyport = Socket, thissock = Thissock} = St) ->
+ debug(St, "tcp: socket = ~w~n", [Socket]),
+ Msg = {ssl, Thissock, Data},
+ Collector ! Msg,
+ if
+ Active =:= once ->
+ {noreply, St#st{active = false}};
+ true ->
+ {noreply, St}
+ end;
+
%% tcp_closed - from proxy socket, active mode
%%
%%
@@ -625,6 +638,19 @@ handle_info({tcp_closed, Socket},
{noreply, St#st{status = closing}}
end;
+handle_info({tcp_closed, Socket},
+ #st{active = Active, collector = Collector,
+ proxyport = Socket, thissock = Thissock} = St) ->
+ debug(St, "tcp_closed: socket = ~w~n", [Socket]),
+ Msg = {ssl_closed, Thissock},
+ Collector ! Msg,
+ if
+ Active =:= once ->
+ {noreply, St#st{status = closing, active = false}};
+ true ->
+ {noreply, St#st{status = closing}}
+ end;
+
%% tcp_error - from proxy socket, active mode
%%
%%
@@ -642,6 +668,19 @@ handle_info({tcp_error, Socket, Reason},
{noreply, St#st{status = closing}}
end;
+handle_info({tcp_error, Socket, Reason},
+ #st{active = Active, collector = Collector,
+ proxyport = Socket} = St) ->
+ debug(St, "tcp_error: socket = ~w, reason = ~w~n", [Socket, Reason]),
+ Msg = {ssl_error, Socket, Reason},
+ Collector ! Msg,
+ if
+ Active =:= once ->
+ {noreply, St#st{status = closing, active = false}};
+ true ->
+ {noreply, St#st{status = closing}}
+ end;
+
%% EXIT - from client
%%
%%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment