diff --git a/examples/echoserver/echoserver.c b/examples/echoserver/echoserver.c index 156ce308..8da868b3 100644 --- a/examples/echoserver/echoserver.c +++ b/examples/echoserver/echoserver.c @@ -1067,9 +1067,16 @@ static int ssh_worker(thread_ctx_t* threadCtx) /* Only an emptied channel earns the EOF; anything * else is retried on a later pass. */ if (eofDrained) { - wolfSSH_ChannelSendEof(eofChannel); - eofAnswered = 1; - ChildRunning = 0; + int eofRet; + + eofRet = wolfSSH_ChannelSendEof(eofChannel); + /* A rekey queues nothing, so the reply is still + * owed and the KEX traffic wakes the next pass. + * A short send already bundled it. */ + if (eofRet != WS_REKEYING) { + eofAnswered = 1; + ChildRunning = 0; + } } } } diff --git a/ide/Espressif/ESP-IDF/examples/wolfssh_echoserver/main/echoserver.c b/ide/Espressif/ESP-IDF/examples/wolfssh_echoserver/main/echoserver.c index 179d02c5..835cf670 100644 --- a/ide/Espressif/ESP-IDF/examples/wolfssh_echoserver/main/echoserver.c +++ b/ide/Espressif/ESP-IDF/examples/wolfssh_echoserver/main/echoserver.c @@ -1051,9 +1051,16 @@ static int ssh_worker(thread_ctx_t* threadCtx) /* Only an emptied channel earns the EOF; anything * else is retried on a later pass. */ if (eofDrained) { - wolfSSH_ChannelSendEof(eofChannel); - eofAnswered = 1; - ChildRunning = 0; + int eofRet; + + eofRet = wolfSSH_ChannelSendEof(eofChannel); + /* A rekey queues nothing, so the reply is still + * owed and the KEX traffic wakes the next pass. + * A short send already bundled it. */ + if (eofRet != WS_REKEYING) { + eofAnswered = 1; + ChildRunning = 0; + } } } }