diff --git a/examples/echoserver/echoserver.c b/examples/echoserver/echoserver.c index 39c240191..624701159 100644 --- a/examples/echoserver/echoserver.c +++ b/examples/echoserver/echoserver.c @@ -1164,10 +1164,11 @@ static int ssh_worker(thread_ctx_t* threadCtx) sessionChannel = wolfSSH_ChannelNext(ssh, NULL); if (canServe && sessionChannel != NULL - && sessionChannel->sessionGranted) { + && sessionChannel->sessionGranted + && wolfSSH_ChannelGetId(sessionChannel, + &threadCtx->shellCtx.channelId, + WS_CHANNEL_ID_SELF) == WS_SUCCESS) { threadCtx->shellCtx.state = APP_STATE_CONNECTED; - wolfSSH_ChannelGetId(sessionChannel, - &threadCtx->shellCtx.channelId, WS_CHANNEL_ID_SELF); } }