Skip to content
Snippets Groups Projects
  • Deucе's avatar
    eed2ebe8
    Add a new channel state · eed2ebe8
    Deucе authored
    Previously, there were (basically) three states... active, closed,
    and writeclosed where writeclosed indicated that a channel close
    message was sent, no more writes are allowed, and it's waiting for
    the close to be acked.
    
    This adds a readclosed state where we have received a close request
    from the remote (and acked it), but have not deactivated the channel
    ourselves.
    
    This fixes a race condition where we could select a channel, then,
    when we write data to it, we receive a close and the channel becomes
    inactive so a new active channel is selected (effectively at random).
    
    This is a bit suboptimal though since we still don't get a
    notification when a channel is closed by the remote.  Instead, if
    we use more than one channel, we need to periodically make the
    channel active for writes and explicitly check if it's closed.
    eed2ebe8
    History
    Add a new channel state
    Deucе authored
    Previously, there were (basically) three states... active, closed,
    and writeclosed where writeclosed indicated that a channel close
    message was sent, no more writes are allowed, and it's waiting for
    the close to be acked.
    
    This adds a readclosed state where we have received a close request
    from the remote (and acked it), but have not deactivated the channel
    ourselves.
    
    This fixes a race condition where we could select a channel, then,
    when we write data to it, we receive a close and the channel becomes
    inactive so a new active channel is selected (effectively at random).
    
    This is a bit suboptimal though since we still don't get a
    notification when a channel is closed by the remote.  Instead, if
    we use more than one channel, we need to periodically make the
    channel active for writes and explicitly check if it's closed.