Recheck WHC for unacked data just before blocking

A writer blocking on a full WHC will still send out whatever it has
buffered but not sent yet. For this, the writer lock must be released,
but that means an ACK can sneak in between sending out the packet and
relocking the writer (not likely if there's a real network in between,
but over a loopback interface it is definitely possible).

Therefore, the amount of unacknowledged data that controls the blocking
and triggering of it must be refreshed before deciding to block,
otherwise it may hang indefinitely.

Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
Erik Boasson 2019-03-15 15:04:37 +01:00
parent 9743bda57b
commit 2e9685221a

View file

@ -976,6 +976,7 @@ static os_result throttle_writer (struct nn_xpack *xp, struct writer *wr)
} }
nn_xpack_send (xp, true); nn_xpack_send (xp, true);
os_mutexLock (&wr->e.lock); os_mutexLock (&wr->e.lock);
whc_get_state (wr->whc, &whcst);
} }
while (gv.rtps_keepgoing && !writer_may_continue (wr, &whcst)) while (gv.rtps_keepgoing && !writer_may_continue (wr, &whcst))