Skip to content

Commit

Permalink
Fix rejected packet stats and stream process leak (#994)
Browse files Browse the repository at this point in the history
* Add packet rejected stats

* Stop stream on eos

* Deprecate helium_router_service
  • Loading branch information
macpie authored Aug 16, 2023
1 parent 7c6d739 commit 92bf4dd
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 6 deletions.
3 changes: 1 addition & 2 deletions config/sys.config
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
grpc_opts => #{
service_protos => [router_pb, state_channel_pb],
services => #{
'helium.router' => helium_router_service
'helium.packet_router.packet' => helium_packet_service
}
},
transport_opts => #{ssl => false},
Expand Down Expand Up @@ -126,7 +126,6 @@
{{lager_file_backend, "router.log"}, [{module, router_device_routing}], info},

{{lager_file_backend, "router.log"}, [{module, helium_packet_service}], info},
{{lager_file_backend, "router.log"}, [{module, helium_router_service}], info},
{{lager_file_backend, "router.log"}, [{module, router_ics_eui_worker}], info},
{
{lager_file_backend, "router.log"},
Expand Down
2 changes: 0 additions & 2 deletions config/sys.config.src
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@
grpc_opts => #{
service_protos => [router_pb, packet_router_pb],
services => #{
'helium.router' => helium_router_service,
'helium.packet_router.packet' => helium_packet_service
}
},
Expand Down Expand Up @@ -156,7 +155,6 @@
{{lager_file_backend, "router.log"}, [{module, router_device_routing}], info},

{{lager_file_backend, "router.log"}, [{module, helium_packet_service}], info},
{{lager_file_backend, "router.log"}, [{module, helium_router_service}], info},
{{lager_file_backend, "router.log"}, [{module, router_ics_eui_worker}], info},
{{lager_file_backend, "router.log"}, [{module, router_ics_route_get_euis_handler}], info},
{{lager_file_backend, "router.log"}, [{module, router_ics_skf_list_handler}], info},
Expand Down
1 change: 0 additions & 1 deletion config/testnet.config.src
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
grpc_opts => #{
service_protos => [router_pb, state_channel_pb],
services => #{
'helium.router' => helium_router_service,
'helium.state_channel' => blockchain_grpc_sc_server_handler
}
},
Expand Down
1 change: 1 addition & 0 deletions src/device/router_device_routing.erl
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ handle_free_packet(SCPacket, PacketTime, Pid) when is_pid(Pid) ->
{error, Reason} = Err ->
lager:debug("packet from ~p discarded ~p", [HotspotName, Reason]),
Pid ! {error, reason_to_single_atom(Reason)},
ok = handle_packet_metrics(Packet, reason_to_single_atom(Reason), Start),
Err
end.

Expand Down
2 changes: 1 addition & 1 deletion src/grpc/helium_packet_service.erl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ init(_Rpc, Stream) ->
{ok, grpcbox_stream:t()} | grpcbox_stream:grpc_error_response().
route(eos, StreamState) ->
lager:debug("got eos"),
{ok, StreamState};
{stop, StreamState};
route(#envelope_up_v1_pb{data = {packet, PacketUp}}, StreamState) ->
Self = self(),
erlang:spawn(fun() ->
Expand Down

0 comments on commit 92bf4dd

Please sign in to comment.