Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On SCTP_NOTIFY_ASSOC_DOWN, the receive callback (recv_callback) gets called with zero information #650

Closed
dirkz opened this issue Feb 23, 2022 · 4 comments

Comments

@dirkz
Copy link

dirkz commented Feb 23, 2022

How to reproduce:

  • Server creates the socket with a receive callback, and event types SCTP_REMOTE_ERROR, SCTP_SHUTDOWN_EVENT, SCTP_PARTIAL_DELIVERY_EVENT, SCTP_SENDER_DRY_EVENT.
  • Server binds, waits for data.
  • Client sends a message, disconnects.
  • Server's receive callback is called.

Observed:

In the call to the receive callback, the data is NULL (and therefore any info about the notification), and the address is memset to all 0s.

Expected:

The receive callback gets usable data that it can act upon, like notification data and peer address.

Notes:

@tuexen
Copy link
Member

tuexen commented Feb 23, 2022

Does the server get the message sent by the client before the receive callback with NULL fires? I'm expecting to see a NULL as the last thing happening (like a recv() would return 0).

@dirkz
Copy link
Author

dirkz commented Feb 23, 2022

Yes, the message is fully received, no problems there. If this is expected behavior, I can certainly handle it, but I wasn't sure if the code I was looking at does what it does intentionally.

@tuexen
Copy link
Member

tuexen commented Feb 23, 2022

You need an indication that you will not receive anything further. In the socket API, the recv() call returns 0. We model this by also providing 0 in the length and the NULL pointer for the data. That is expected and allows you to do cleanup if needed.

@dirkz
Copy link
Author

dirkz commented Feb 23, 2022

Thanks for the info. Will close because works as designed.

@dirkz dirkz closed this as completed Feb 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants