A typical close by a remote peer involves a GO_AWAY frame followed by TCP FIN.
This method is invoked when the TCP FIN is received, or when an exception is
thrown while reading, and we check the close state to act appropriately:
<ul>
<li>NOT_CLOSED: means that the remote peer did not send a GO_AWAY (abrupt close)
or there was an exception while reading, and therefore we terminate.</li>
<li>LOCALLY_CLOSED: we have sent the GO_AWAY to the remote peer, which received
it and closed the connection; we queue a disconnect to close the connection
on the local side.
The GO_AWAY just shutdown the output, so we need this step to make sure the
connection is closed. See {@link #close(int, string, Callback)}.</li>
<li>REMOTELY_CLOSED: we received the GO_AWAY, and the TCP FIN afterwards, so we
do nothing since the handling of the GO_AWAY will take care of closing the
connection. See {@link #onGoAway(GoAwayFrame)}.</li>
</ul>
A typical close by a remote peer involves a GO_AWAY frame followed by TCP FIN. This method is invoked when the TCP FIN is received, or when an exception is thrown while reading, and we check the close state to act appropriately: <ul> <li>NOT_CLOSED: means that the remote peer did not send a GO_AWAY (abrupt close) or there was an exception while reading, and therefore we terminate.</li> <li>LOCALLY_CLOSED: we have sent the GO_AWAY to the remote peer, which received it and closed the connection; we queue a disconnect to close the connection on the local side. The GO_AWAY just shutdown the output, so we need this step to make sure the connection is closed. See {@link #close(int, string, Callback)}.</li> <li>REMOTELY_CLOSED: we received the GO_AWAY, and the TCP FIN afterwards, so we do nothing since the handling of the GO_AWAY will take care of closing the connection. See {@link #onGoAway(GoAwayFrame)}.</li> </ul>
@see #onGoAway(GoAwayFrame) @see #close(int, string, Callback) @see #onIdleTimeout()