X-Git-Url: http://git.silcnet.org/gitweb/?p=runtime.git;a=blobdiff_plain;f=lib%2Fsilcutil%2Funix%2Fsilcunixsocketstream.c;h=60d458d4a19bb39be74a42dbd3ca625cf7ee32a6;hp=4b5f0ac11efffb255ed0da5d651c5187ab89ce2a;hb=c724c52cf360b74e42a7f2c7450a25bd1fcb220d;hpb=8b11d3c1627f1dc3c7966bb51901bcdcf1f8a9fb diff --git a/lib/silcutil/unix/silcunixsocketstream.c b/lib/silcutil/unix/silcunixsocketstream.c index 4b5f0ac1..60d458d4 100644 --- a/lib/silcutil/unix/silcunixsocketstream.c +++ b/lib/silcutil/unix/silcunixsocketstream.c @@ -4,7 +4,7 @@ Author: Pekka Riikonen - Copyright (C) 1997 - 2007 Pekka Riikonen + Copyright (C) 1997 - 2008 Pekka Riikonen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -106,8 +106,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 */ @@ -116,7 +117,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);