Permalink
Browse files

Merge branch 'master' into linux_fixes

Conflicts:
	src/enet_tcp_fsm.erl
  • Loading branch information...
2 parents f4b1315 + 76249df commit d1f6ba26c53adbe604d0d24227d4382fa323d566 @archaelus committed Mar 19, 2012
Showing with 15 additions and 2 deletions.
  1. +15 −2 src/enet_tcp_fsm.erl
View
17 src/enet_tcp_fsm.erl
@@ -131,11 +131,24 @@ reassemble(#tcp_stream{c2s=C2S, s2c=S2C}) ->
reassemble_part(S2C)}.
reassemble_part(#part{data=Data}) ->
- lists:foldr(fun reassemble_part/2,
+ lists:foldr(fun reassemble/2,
{<<>>, []},
Data).
-reassemble_part({RSN, TS, Data}, {Stream, Offsets})
+-type tcp_segment() :: {RSN::non_neg_integer(),
+ Timestamp::non_neg_integer(),
+ Data::binary()}.
+
+-type offset_data() :: {Timestamp::non_neg_integer(),
+ 'syn' | 'normal' | 'retransmit' | 'missing_packet',
+ StartIdx::non_neg_integer(),
+ StopIdx::non_neg_integer()}.
+
+-spec reassemble(tcp_segment(), {Data::binary(), [offset_data()]}) ->
+ {Data::binary(), [offset_data()]}.
+reassemble({0, TS, Data}, {<<>>, []}) ->
+ {Data, [{TS, syn, 0, 0}]};
+reassemble({RSN, TS, Data}, {Stream, Offsets})
when is_integer(RSN), is_integer(TS),
is_binary(Data), is_binary(Stream),
is_list(Offsets) ->

0 comments on commit d1f6ba2

Please sign in to comment.