This ensures that any response sent just before the queue is shutdown
is actually sent to the other end. In particular, if an error was
detected when handing off a queue to the controller, the CONNECT
response could still be queued and not yet processed by the TX thread
when the queue pair is destroyed. Without the drain, the response
never made it out onto the wire but was instead dropped.
To prevent a remote peer from holding the socket open forever with a
zero window, only drain pending transmit data for 2 minutes. If there
is still pending data after 2 minutes, discard it and close the
socket. Note that if an association has multiple queues open, the
queues are freed sequentially, so the effective timeout might in fact
be 2 minutes times the number of queues.
Sponsored by: Chelsio Communications