X-Git-Url: http://git.silcnet.org/gitweb/?p=silc.git;a=blobdiff_plain;f=lib%2Fsilcutil%2Funix%2Fsilcunixsockconn.c;h=330bab2dafa8631610875b698a913bc08dd36c5d;hp=8932d0cde66625aaf9af2030f23fa27614ddae55;hb=e5d8d3db6caa344b3d419b884556c21b15e7d123;hpb=6636b2366ca8fe165ea6d499ea120834e9fed0ce diff --git a/lib/silcutil/unix/silcunixsockconn.c b/lib/silcutil/unix/silcunixsockconn.c index 8932d0cd..330bab2d 100644 --- a/lib/silcutil/unix/silcunixsockconn.c +++ b/lib/silcutil/unix/silcunixsockconn.c @@ -2,9 +2,9 @@ silcunixsockconn.c - Author: Pekka Riikonen + Author: Pekka Riikonen - Copyright (C) 1997 - 2000 Pekka Riikonen + Copyright (C) 1997 - 2001 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 @@ -33,6 +33,9 @@ int silc_socket_write(SilcSocketConnection sock) int fd = sock->sock; SilcBuffer src = sock->outbuf; + if (SILC_IS_DISABLED(sock)) + return -1; + SILC_LOG_DEBUG(("Writing data to socket %d", fd)); if (src->len > 0) { @@ -62,9 +65,12 @@ int silc_socket_write(SilcSocketConnection sock) int silc_socket_read(SilcSocketConnection sock) { int len = 0; - unsigned char buf[SILC_PACKET_READ_SIZE]; + unsigned char buf[SILC_SOCKET_READ_SIZE]; int fd = sock->sock; + if (SILC_IS_DISABLED(sock)) + return -1; + SILC_LOG_DEBUG(("Reading data from socket %d", fd)); /* Read the data from the socket. */ @@ -84,7 +90,7 @@ int silc_socket_read(SilcSocketConnection sock) /* Insert the data to the buffer. */ if (!sock->inbuf) - sock->inbuf = silc_buffer_alloc(SILC_PACKET_DEFAULT_SIZE); + sock->inbuf = silc_buffer_alloc(SILC_SOCKET_BUF_SIZE); /* If the data does not fit to the buffer reallocate it */ if ((sock->inbuf->end - sock->inbuf->tail) < len)