updates.
[silc.git] / lib / silcutil / unix / silcunixsockconn.c
index acd8cb5eb5662bee12613756cac86e9ab9878d64..3120e8ef3e499cc424897e04f2f172654e44e514 100644 (file)
@@ -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) {
@@ -42,7 +45,7 @@ int silc_socket_write(SilcSocketConnection sock)
        SILC_LOG_DEBUG(("Could not write immediately, will do it later"));
        return -2;
       }
-      SILC_LOG_ERROR(("Cannot write to socket: %s", strerror(errno)));
+      SILC_LOG_DEBUG(("Cannot write to socket: %s", strerror(errno)));
       return -1;
     }
 
@@ -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. */
@@ -74,7 +80,7 @@ int silc_socket_read(SilcSocketConnection sock)
       SILC_LOG_DEBUG(("Could not read immediately, will do it later"));
       return -2;
     }
-    SILC_LOG_ERROR(("Cannot read from socket: %d:%s", fd, strerror(errno)));
+    SILC_LOG_DEBUG(("Cannot read from socket: %d:%s", fd, strerror(errno)));
     return -1;
   }
 
@@ -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)