X-Git-Url: http://git.silcnet.org/gitweb/?p=runtime.git;a=blobdiff_plain;f=lib%2Fsilcutil%2Funix%2Fsilcunixsocketstream.c;h=35b0ceedcde1d702dc1c37496b9fbaee9a54fc1d;hp=552fa611167d3326b0dfbaedf6926a20fcd8c859;hb=afcd9ed820b767d8b6676a9156fa561b24ac2363;hpb=2f90e9e57682d83c4ed07df77c1c9b898cbc5702 diff --git a/lib/silcutil/unix/silcunixsocketstream.c b/lib/silcutil/unix/silcunixsocketstream.c index 552fa611..35b0ceed 100644 --- a/lib/silcutil/unix/silcunixsocketstream.c +++ b/lib/silcutil/unix/silcunixsocketstream.c @@ -105,8 +105,9 @@ int silc_socket_stream_read(SilcStream stream, unsigned char *buf, /* If QoS was applied, return the data that was pending. */ if (sock->qos->applied && sock->qos->data_len) { memcpy(buf, qosbuf, sock->qos->data_len); + len = sock->qos->data_len; sock->qos->data_len = 0; - return sock->qos->data_len; + return len; } /* If we have active QoS data pending, return with no data */ @@ -115,7 +116,8 @@ int silc_socket_stream_read(SilcStream stream, unsigned char *buf, return -1; } - /* Read the data from the socket. Never read more than the max limit. */ + /* Read the data from the socket. The qosbuf size is always the max + read limit size. */ len = (buf_len < sock->qos->read_limit_bytes ? buf_len : sock->qos->read_limit_bytes); len = read(sock->sock, qosbuf, len);