Permalink
Browse files

Decode only eth on receive.

  • Loading branch information...
1 parent d1eb7c2 commit 16f97bc776764dc80694af006bf8100398f349ce @archaelus committed Mar 10, 2013
Showing with 7 additions and 1 deletion.
  1. +7 −1 src/enet_eth_iface.erl
View
@@ -110,7 +110,7 @@ handle_info(Info, State) ->
{noreply, State}.
handle_frame(Frame, S) ->
- case enet_codec:decode(eth, Frame, [eth]) of
+ try enet_codec:decode(eth, Frame, [{decode_types, [eth]}]) of
E = #eth{dst=D} when D =:= S#state.mac; D =:= broadcast ->
%% Frames destined for me.
publish_rx(Frame, E, S);
@@ -121,6 +121,12 @@ handle_frame(Frame, S) ->
publish_rx(Frame, unknown, S);
_ ->
drop_frame
+ catch
+ Class:Ex ->
+ ?INFO("~p:~p~nStack: ~p~nFrame:~p",
+ [Class, Ex, erlang:get_stacktrace(),
+ Frame]),
+ drop_frame
end,
{noreply, S}.

0 comments on commit 16f97bc

Please sign in to comment.