mirror of
https://github.com/internetee/epp_proxy.git
synced 2025-08-28 09:53:27 +02:00
Merge pull request #18 from internetee/add-logging-of-process-and-ip-address
Add logging of IP address and process number
This commit is contained in:
commit
ae478d685d
1 changed files with 6 additions and 0 deletions
|
@ -40,6 +40,7 @@ handle_cast(serve,
|
|||
State = #state{socket = Socket,
|
||||
session_id = _SessionId}) ->
|
||||
{ok, {PeerIp, _PeerPort}} = ssl:peername(Socket),
|
||||
log_opened_connection(PeerIp),
|
||||
case ssl:handshake(Socket) of
|
||||
{ok, SecureSocket} ->
|
||||
NewState = state_from_socket(SecureSocket, State),
|
||||
|
@ -168,6 +169,11 @@ log_on_invalid_handshake(Ip, Error) ->
|
|||
[ReadableIp, Error]),
|
||||
exit(normal).
|
||||
|
||||
log_opened_connection(Ip) ->
|
||||
ReadableIp = epp_util:readable_ip(Ip),
|
||||
lager:info("New client connection. IP: ~s, Process: ~p.~n",
|
||||
[ReadableIp, self()]).
|
||||
|
||||
%% Extract state info from socket. Fail if you must.
|
||||
state_from_socket(Socket, State) ->
|
||||
{ok, PeerCert} = ssl:peercert(Socket),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue