Push session - client is source
source sink Status
blocks-> source sets SenderClosing
< status
blocks->
<-status
blocks-> source: on BEGIN_DRAINING if SenderClosing is set, set SenderClosed
<-status sink: on BEGIN_SEND if SenderClosed, Set ReceiverClosed
Session ends when SenderClosed & ReceiverClosed
currently:
sink
on END_SESSION, set ReceiverClosed
on CANCEL, set ReceiverClosed
on BEGIN_SEND set ReceiverClosing if SenderClosing
IsClosed true if SenderClosed or ReceiverClosed
source:
on BEGIN_DRAINING, set SenderClosed if ReceiverClosing
on END_SESSION, set SenderClosed
on CANCEL, set SenderClosed
IsClosed true if SenderClosed
BEGIN_SEND happens when: sink pending is empty // this is the queue of blocks to process and add to the want list
BEGIN_DRAINING happens when: source pending is empty // this is the queue of blocks to send
Pull session - client is sink
sink source Status
status-> sink sets ReceiverClosing
<-blocks
status->
<-blocks
status-> sink: on BEGIN_SEND and ReceiverClosing is set, set ReceiverClosed
<-blocks source: on BEGIN_DRAINING when status is ReceiverClosed, Set SenderClosed