Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

active mode: close the port on shutdown

  • Loading branch information...
commit 200307c994d2df6f6c3cbc5621cded2002f419bb 1 parent 81acb18
@msantos authored
Showing with 9 additions and 1 deletion.
  1. +2 −0  README.md
  2. +7 −1 src/tuncer.erl
View
2  README.md
@@ -241,3 +241,5 @@ the fd is closed if the device is not persistent).
* make sure tuncer can never leak file descriptors
* support for setting pointopoint
+
+* add support for {active, mode}
View
8 src/tuncer.erl
@@ -227,7 +227,13 @@ handle_info(Info, State) ->
error_logger:error_report([wtf, Info]),
{noreply, State}.
-terminate(_Reason, #state{fd = FD, dev = Dev}) ->
+terminate(_Reason, #state{fd = FD, dev = Dev, port = Port}) ->
+ if
+ is_port(Port) ->
+ catch erlang:port_close(Port);
+ true ->
+ ok
+ end,
tunctl:down(Dev),
tunctl:persist(FD, false),
procket:close(FD),
Please sign in to comment.
Something went wrong with that request. Please try again.