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

Add SetReadDeadline and SetWriteDeadline methods #157

Closed
ckousik opened this issue Nov 22, 2022 · 0 comments
Closed

Add SetReadDeadline and SetWriteDeadline methods #157

ckousik opened this issue Nov 22, 2022 · 0 comments

Comments

@ckousik
Copy link
Contributor

ckousik commented Nov 22, 2022

Summary

Add methods to set deadlines for Read/Write from the datachannel. The underlying SCTP stream has a SetReadDeadline method that can be exposed for setting the Read deadline.

Motivation

The datachannel Read method seems to block until there is data or the channel is closed. To wrap a datachannel in a net.Conn we need to wrap it with the methods to set deadlines, and have the Read/Write calls execute in a separate goroutine. Using the methods already available on the SCTP stream would be efficient and make datachannels easier to use.

Describe alternatives you've considered

To implement SetReadDeadline, we run a loop that uses the current Read call to write to a buffer, and notifies the caller of completion of the Read via a channel. This allows us to await a timer in addition to completion of the Read.

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

1 participant