mirror of https://github.com/wolfSSL/wolfssh.git
The client and the echoserver both sent their shutdown messages and then spun wolfSSH_worker() a fixed number of times, so whether the peer's close was seen at all depended on timing. Both now half close the socket and read until the peer hangs up; the client sends a disconnect first, the echoserver does not. - test.h adds WSHUTDOWN(), a write-side shutdown() on POSIX and Windows, left undefined where the stack has no half close. - test.h adds HalfCloseAndDrain(). It flushes a queued write, then reads the raw socket, since the library reads nothing after the session ends, and gives up ten seconds in or after 256 reads. MQX gets a stub. - SendDisconnectAndDrain() sends MSG_DISCONNECT for up to ten seconds, then drains. It returns WS_WANT_READ for a peer that never hung up, WS_WANT_WRITE for a disconnect still queued, WS_SUCCESS for a reset. - test.h adds WaitForChannelClose(), which runs the session until the peer's channel close, bounded at ten seconds, and returns at once on a session an error already ended. MQX gets one pass. - client.c waits for the close, keeping a late exit status, and reports an unexpected shutdown result. It exits 0 on either give-up and fails on a broken wait or a disconnect it could not send. - echoserver.c replaces its 10-attempt worker loop with the drain alone: the close exchange ended the session, and OpenSSH's client exits 255 on a disconnect that lands before it is done. |
||
|---|---|---|
| .. | ||
| client.c | ||
| client.h | ||
| common.c | ||
| common.h | ||
| include.am | ||