Skip to content

Commit 76e8d66

Browse files
committed
SFTP Fix
1. Remove the continue from the SFTP worker loop when there's a timeout on the select and when there's a want_read from the wolfSSH_worker. 2. When the select has receive data ready, check it. Don't make it conditional on want read as well. The goal is that when there isn't data waiting on the socket, check and process the data in the SFTP channel's buffer, always.
1 parent c07a868 commit 76e8d66

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

examples/echoserver/echoserver.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1196,11 +1196,8 @@ static int sftp_worker(thread_ctx_t* threadCtx)
11961196
}
11971197
else if (selected == WS_SELECT_TIMEOUT) {
11981198
timeout = TEST_SFTP_TIMEOUT_LONG;
1199-
continue;
12001199
}
1201-
1202-
if (ret == WS_WANT_READ || ret == WS_WANT_WRITE ||
1203-
selected == WS_SELECT_RECV_READY) {
1200+
else if (selected == WS_SELECT_RECV_READY) {
12041201
ret = wolfSSH_worker(ssh, NULL);
12051202
error = wolfSSH_get_error(ssh);
12061203
if (ret == WS_REKEYING) {
@@ -1213,7 +1210,6 @@ static int sftp_worker(thread_ctx_t* threadCtx)
12131210
error == WS_WINDOW_FULL) {
12141211
timeout = TEST_SFTP_TIMEOUT;
12151212
ret = error;
1216-
continue;
12171213
}
12181214

12191215
if (error == WS_EOF) {

0 commit comments

Comments
 (0)