-
-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
The way send works right now is very "modeled after stdlib/net" which isn't a great model for Lori.
Changes to make:
- send becomes partial. if at the time of a call, the send can't happen, because connection has yet to be established, or has been closed, or backpressure, or otherwise unwriteable, do an error. (return code is possible here as well as the API evolves during this design)
- remove the "pending data" array that is used on posix. we can maintain ownership of the data from the enclosing actor and maintain merely an offset into the data. given the "send becomes partial" then we wouldn't ever have more than 1 item in the "pending data" array.
- provide a way to track when a given chunk of data has been "sent" aka handed-off to the OS. we need to provide some means (perhaps a "send token") so that we can inform the actor at a later point that the data has been sent. either this means that we require a send token on send (tcp connection could manage the creation of the tokens) or we supply a token as a result from send (in which case, send isn't partial but rather returns a token or none depending on success).
- as part of the "way to track when a given chunk has been sent", we need a callback for data having been sent. we have
_on_sendalready so_on_sentmakes sense. - we should have a "writeable" query method on the connection that can allow the enclosing actor to determine if the socket is writeable.
These changes will make the decision to queue when backpressure is experienced vs dropping data an application level concern rather than a library level concern.
Metadata
Metadata
Assignees
Labels
No labels