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: 	Pid.
  
  -record(dp,{sock,sendproc,calln = 0,callsininterval = 0, callcount = 0,
  			permanent = false, direction,transport, tunnelstate,
  			isinit = false, connected_to,tunnelmod, reconnecter}).
  
  
negative.code: 	{stop,normal,P};
  handle_info({tcp_closed,_},P) ->
  	lager:debug("Connection closed type ~p",[P#dp.direction]),
  	case P#dp.direction of
  		tunnel ->
  			spawn(fun() -> timer:sleep(1000), supervisor:delete_child(bkdcore_sup,{?MODULE,P#dp.connected_to,P#dp.iteration}) end);
  		_ ->
  			ok
  	end,
  	{stop,normal,P};
  handle_info(timeout,P) ->
  	case P#dp.callsininterval of
  