Skip to content

Commit 72d0fed

Browse files
authored
Merge pull request #64 from JacobBarthelmeh/wolfssh
update stream_send description
2 parents e5610e1 + cdcb5f2 commit 72d0fed

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

wolfSSH/src/chapter13.md

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,6 +1005,7 @@ socket.
10051005
**WS_BAD_ARGUMENT** – returns if one or more parameters is equal to NULL
10061006
**WS_EOF** – returns when end of stream is reached
10071007
**WS_FATAL_ERROR** – there was an error, call **wolfSSH_get_error()** for more detail
1008+
**WS_REKEYING** if currently a rekey is in process, use wolfSSH_worker() to complete
10081009

10091010
**Parameters**
10101011

@@ -1033,28 +1034,32 @@ wolfSSH_stream_send()
10331034

10341035
**Description**
10351036

1036-
wolfSSH_stream_send writes **bufSz** bytes from buf to the SSH stream data buffer. The
1037-
bytes are removed from the internal buffer.
1038-
1037+
wolfSSH_stream_send writes **bufSz** bytes from buf to the SSH stream data buffer.
10391038
wolfSSH_stream_send() works with both blocking and non-blocking I/O. When the
1040-
underlying I/O is non-blocking, wolfSSH_stream_send() will return when the underlying
1041-
I/O could not satisfy the needs of wolfSSH_stream_send to continue. In this case, a call
1042-
to wolfSSH_get_error() will yield either **WS_WANT_READ** or **WS_WANT_WRITE**. The
1043-
calling process must then repeat the call to wolfSSH_stream_send when the socket it
1044-
ready to send and wolfSSH will pick up where it left off. When using a non-blocking
1045-
socket, nothing needs to be done, but select() can be used to check for the required
1046-
condition.
1047-
1039+
underlying I/O is non-blocking, wolfSSH_stream_send() will return a want write
1040+
error when the underlying I/O could not satisfy the needs of wolfSSH_stream_send
1041+
and there is still pending data in the SSH stream data buffer to be sent. In this
1042+
case, a call to wolfSSH_get_error() will yield either **WS_WANT_READ** or
1043+
**WS_WANT_WRITE**. The calling process must then repeat the call to
1044+
wolfSSH_stream_send when the socket is ready to send and wolfSSH will send out
1045+
any pending data left in the SSH stream data buffer then pull data from the input
1046+
**buf**. When using a non-blocking socket, nothing needs to be done, but select()
1047+
can be used to check for the required condition.
1048+
10481049
If the underlying I/O is blocking, wolfSSH_stream_send() will only return when the data
1049-
has been sent or an error occurred.
1050+
has been sent or an error occurred.
1051+
1052+
In cases where I/O want write/read is not the error encountered (i.e. WS_REKEYING)
1053+
then wolfSSH_worker() should be called until the internal SSH processes are completed.
10501054

10511055
**Return Values**
10521056

1053-
**>0** – number of bytes written upon success
1057+
**>0** – number of bytes written to SSH stream data buffer upon success
10541058
**0** – returned on socket failure caused by either a clean connection shutdown or a socket
10551059
error, call **wolfSSH_get_error()** for more detail
10561060
**WS_FATAL_ERROR** – there was an error, call wolfSSH_get_error() for more detail
10571061
**WS_BAD_ARGUMENT** if any of the parameters is null
1062+
**WS_REKEYING** if currently a rekey is in process, use wolfSSH_worker() to complete
10581063

10591064
**Parameters**
10601065

0 commit comments

Comments
 (0)