Skip to content

Commit

Permalink
Merge pull request #596 from JacobBarthelmeh/sshd
Browse files Browse the repository at this point in the history
  • Loading branch information
ejohnstown authored Sep 30, 2023
2 parents a84df10 + 6ce5724 commit 37cb96c
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions apps/wolfsshd/wolfsshd.c
Original file line number Diff line number Diff line change
Expand Up @@ -686,11 +686,6 @@ static int SFTP_Subsystem(WOLFSSHD_CONNECTION* conn, WOLFSSH* ssh,
if (ret == WS_SUCCESS) {
sockfd = (WS_SOCKET_T)wolfSSH_get_fd(ssh);
do {
select_ret = tcp_select(sockfd, timeout);
if (select_ret == WS_SELECT_ERROR_READY) {
break;
}

if (wolfSSH_SFTP_PendingSend(ssh)) {
/* Yes, process the SFTP data. */
ret = wolfSSH_SFTP_read(ssh);
Expand All @@ -701,11 +696,20 @@ static int SFTP_Subsystem(WOLFSSHD_CONNECTION* conn, WOLFSSH* ssh,
error == WS_CHAN_RXD || error == WS_REKEYING ||
error == WS_WINDOW_FULL)
ret = error;
if (error == WS_WANT_WRITE && wolfSSH_SFTP_PendingSend(ssh)) {
continue; /* no need to spend time attempting to pull data
* if there is still pending sends */
}
if (error == WS_EOF) {
break;
}
}

select_ret = tcp_select(sockfd, timeout);
if (select_ret == WS_SELECT_ERROR_READY) {
break;
}

if (ret == WS_WANT_READ || ret == WS_WANT_WRITE ||
select_ret == WS_SELECT_RECV_READY) {
ret = wolfSSH_worker(ssh, NULL);
Expand Down

0 comments on commit 37cb96c

Please sign in to comment.