diff --git a/src/sdlan_network.erl b/src/sdlan_network.erl index 0f150ce..9a9922b 100644 --- a/src/sdlan_network.erl +++ b/src/sdlan_network.erl @@ -228,6 +228,8 @@ handle_call({attach, ChannelPid, ClientId, Mac, Ip, Hostname}, _From, ip = Ip }} }), + logger:debug("Event: nat_changed, for attach"), + broadcast(fun(#endpoint{channel_pid = ChannelPid0}) -> sdlan_quic_channel:send_event(ChannelPid0, ?EVENT_NAT_CHANGED, Event) end, [Mac], Endpoints), @@ -289,6 +291,7 @@ handle_call({peer_info, SrcMac, DstMac}, _From, State = #state{endpoints = Endpo v6_info = SrcV6Info }} }), + logger:debug("Event: send_register, for peer_info"), sdlan_quic_channel:send_event(DstChannelPid, ?EVENT_SEND_REGISTER, RegisterEvent) end, @@ -411,7 +414,7 @@ handle_cast({update_hole, SessionToken, ClientId, Mac, Peer, NatType, V6Info}, S }} }), - logger:debug("[sdlan_network] client_id: ~p(~p), hole changed", [ClientId, Ip]), + logger:debug("[sdlan_network] Event: nat_changed, update_hole, client_id: ~p(~p), hole changed", [ClientId, Ip]), broadcast(fun(#endpoint{channel_pid = ChannelPid}) -> sdlan_quic_channel:send_event(ChannelPid, ?EVENT_NAT_CHANGED, NatChangedEvent) end, [Mac], Endpoints) @@ -457,6 +460,9 @@ terminate(Reason, #state{network_id = NetworkId, endpoints = Endpoints}) -> message = <<"Network shutdown">> }} }), + + logger:debug("[sdlan_network] Event: shutdown"), + sdlan_quic_channel:send_event(ChannelPid, ?EVENT_NETWORK_SHUTDOWN, NetworkShutdownEvent), sdlan_quic_channel:stop(ChannelPid, normal); false ->