Author: Pekka Riikonen <priikone@silcnet.org>
- 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
silc_mutex_unlock(ps->lock);
if (ret == -1) {
/* Cannot read now, do it later. */
- silc_buffer_pull(inbuf, silc_buffer_len(inbuf));
return FALSE;
}
if (ret == -1) {
/* Cannot read now, do it later. */
- silc_buffer_pull(inbuf, silc_buffer_len(inbuf));
return FALSE;
}
return;
if (silc_atomic_sub_int8(&stream->refcnt, 1) > 0) {
+ if (stream->destroyed)
+ return;
stream->destroyed = TRUE;
SILC_LOG_DEBUG(("Marking packet stream %p destroyed", stream));
Author: Pekka Riikonen <priikone@silcnet.org>
- Copyright (C) 2005 - 2007 Pekka Riikonen
+ Copyright (C) 2005 - 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
!limit_sec && !limit_usec) {
silc_schedule_task_del_by_context(socket_stream->schedule,
socket_stream->qos);
+ silc_free(socket_stream->qos->buffer);
silc_free(socket_stream->qos);
socket_stream->qos = NULL;
return TRUE;
socket_stream->qos->cur_rate = 0;
socket_stream->qos->sock = socket_stream;
- socket_stream->qos->buffer = silc_malloc(read_limit_bytes);
+ socket_stream->qos->buffer = silc_realloc(socket_stream->qos->buffer,
+ read_limit_bytes);
if (!socket_stream->qos->buffer)
return FALSE;
Author: Pekka Riikonen <priikone@silcnet.org>
- 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
/* 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 */
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);