anchor.diff:  		State ->
   			ok
   	end,
  -	inet:setopts(P#dp.sock,[{active, once}]),
  -	{noreply,P#dp{tunnelstate = State}};
  +	{noreply,P#dp{tunnelstate = State, respawn_timer = P#dp.respawn_timer+1}};
  +handle_info({tcp_passive, _Socket},P) ->
  +	% lager:info("tcp_passive ~p",[{P#dp.connected_to,P#dp.iteration}]),
  +	case P#dp.respawn_timer > 3000 of
  +		true ->
  +			handle_info(restart,P);
  +		false ->
  +			inet:setopts(P#dp.sock,[{active, 32}]),
  +			{noreply,P}
  +	end;
  +handle_info(restart,P) ->
  +	% lager:info("Restarting tunnel process ~p",[{P#dp.connected_to,P#dp.iteration}]),
  +	NewId = {?MODULE,P#dp.connected_to,P#dp.iteration+1},
  +	Spec = {NewId,
  +		{?MODULE,start,[NewId,P]}, %mfa
  +		transient,
  +		100,
  +		worker,
  +		[?MODULE]
  +	},
  +	{ok,Pid} = supervisor:start_child(bkdcore_sup,Spec),
  +	% Transfer ownership to new process
  +	ok = gen_udp:controlling_process(P#dp.sock,Pid),
  +	% Wake that process up
  +	Pid ! {tcp_passive,P#dp.sock},
  +	spawn(fun() -> timer:sleep(1000), supervisor:delete_child(bkdcore_sup,{?MODULE,P#dp.connected_to,P#dp.iteration}) end),
  +	{stop,normal,P};
   handle_info({tcp,_,<<Id:24/unsigned,SizeAndBody/binary>>},P) ->
   	case get(Id) of
   		undefined ->
  
positive.code: 
  init([]) ->
  	{ok,#dp{direction = receiver}};
  init([{From,FromRef},Node]) ->
  	case distreg:reg({bkdcore,Node}) of
  		ok ->
  
negative.code: % API
  -export([call/2,cast/2,async_call/3,multicall/2,is_connected/1]).
  % gen_server
  -export([start/0,start/1,start/2, stop/1,stop/0, init/1, handle_call/3, 
   		  handle_cast/2, handle_info/2, terminate/2, code_change/3,t/0]).
  -export([start_link/4,init/4]).
  % -compile([export_all]).
  