NEAT-project/usrsctp-neat

Missing read events (upcall handler)

Closed this issue · 4 comments

When receiving an SCTP packet containing a SACK chunk and a DATA chunk, the upcall handler is called once for the sender dry event but not again to indicate that further data can be read. This leads to an out-of-sync with received data as I'm always reading the last event/message rather than the current one.

When the SACK chunk and the DATA chunk are in separate SCTP packets, the upcall handler is called twice as expected.

I've attached a PCAP file (packet nr 17 is where the issue takes place).
trace-sctp-u3rJCYq.pcapng.gz

Edit: Just to add, source port 6000 is my implementation and source port 5000 is Firefox.

@lgrahl Read must be called in a loop to get all chunks of a packet. I fixed the discard_server_upcall example to also read bundled packets.

Okay, thanks!

@ruengeler Does neat also need a fix similar to the discard server?

Just a side note: To handle usrsctp events fairly compared to events from normal file descriptors in an event loop environment, it might be a good idea to enqueue handling further events at the end of the event loop instead of handling them in a loop.