Permalink
Browse files

Remove unkown elements from encoding

Remove the unknown element types from the management body encoding.
Most of these elements do not have a specified type (like timestamp)
and are handled by the calling function.

The check for a known type is weak: we look for an integer rather than
a tuple ({unsupported, type}).
  • Loading branch information...
1 parent a831fae commit 8f5203f833c551010f605e01516b9a59f99698ec @msantos committed Jul 17, 2011
Showing with 4 additions and 1 deletion.
  1. +4 −1 src/wierl_frame.erl
View
@@ -713,7 +713,10 @@ element_type(N) -> {unsupported, N}.
elements_to_bin(N) when is_binary(N) ->
N;
elements_to_bin(N) when is_list(N) ->
- management_body(N).
+ % Remove unhandled types (weak check, element_type returns a
+ % tuple ({unsupported, Key} on failure)
+ Elements = [ {K,V} || {K,V} <- N, is_integer(element_type(K)) ],
+ management_body(Elements).
management_body(Body) ->

0 comments on commit 8f5203f

Please sign in to comment.