@@ -1120,15 +1120,18 @@ static THREAD_RETURN WOLFSSH_THREAD wolfSSH_Client(void* args)
1120
1120
if (ret != WS_SOCKET_ERROR_E
1121
1121
&& wolfSSH_get_error (ssh ) != WS_SOCKET_ERROR_E ) {
1122
1122
if (ret != WS_SUCCESS ) {
1123
- err_sys ("Sending the shutdown messages failed." );
1123
+ WLOG (WS_LOG_DEBUG , "Sending the shutdown messages failed." );
1124
+ }
1125
+ else {
1126
+ ret = wolfSSH_worker (ssh , NULL );
1124
1127
}
1125
- ret = wolfSSH_worker (ssh , NULL );
1126
1128
if (ret == WS_CHANNEL_CLOSED ) {
1127
1129
/* Shutting down, channel closing isn't a fail. */
1128
1130
ret = WS_SUCCESS ;
1129
1131
}
1130
1132
else if (ret != WS_SUCCESS ) {
1131
- err_sys ("Failed to listen for close messages from the peer." );
1133
+ WLOG (WS_LOG_DEBUG ,
1134
+ "Failed to listen for close messages from the peer." );
1132
1135
}
1133
1136
}
1134
1137
WCLOSESOCKET (sockFd );
@@ -1139,8 +1142,14 @@ static THREAD_RETURN WOLFSSH_THREAD wolfSSH_Client(void* args)
1139
1142
1140
1143
wolfSSH_free (ssh );
1141
1144
wolfSSH_CTX_free (ctx );
1142
- if (ret != WS_SUCCESS && ret != WS_SOCKET_ERROR_E )
1143
- err_sys ("Closing client stream failed" );
1145
+ if (ret != WS_SUCCESS && ret != WS_SOCKET_ERROR_E ) {
1146
+ WLOG (WS_LOG_DEBUG , "Closing client stream failed" );
1147
+ #if defined(WOLFSSH_TERM ) || defined(WOLFSSH_SHELL )
1148
+ /* override return value, do not want to return success if connection
1149
+ * close failed */
1150
+ ((func_args * )args )-> return_code = 1 ;
1151
+ #endif
1152
+ }
1144
1153
1145
1154
ClientFreeBuffers ();
1146
1155
#if !defined(WOLFSSH_NO_ECC ) && defined(FP_ECC ) && defined(HAVE_THREAD_LS )
0 commit comments