Fixed outoing packet queue handling bug on very high load.
[silc.git] / lib / silcutil / unix / silcunixsockconn.c
index a4c6c684cc0fca31d79d1948ef29e77dadffe846..02af7cc747646009ef560a7fc0db57570587e436 100644 (file)
@@ -50,6 +50,13 @@ int silc_socket_write(SilcSocketConnection sock)
       return -1;
     }
 
+    if (ret < src->len) {
+      SILC_LOG_DEBUG(("Wrote data %d of %d bytes, will write rest later",
+                     ret, src->len));
+      silc_buffer_pull(src, ret);
+      return -2;
+    }
+
     silc_buffer_pull(src, ret);
   }
 
@@ -109,7 +116,7 @@ int silc_socket_read(SilcSocketConnection sock)
 /* Returns human readable socket error message */
 
 bool silc_socket_get_error(SilcSocketConnection sock, char *error,
-                          uint32 error_len)
+                          SilcUInt32 error_len)
 {
   char *err;
 
@@ -122,4 +129,5 @@ bool silc_socket_get_error(SilcSocketConnection sock, char *error,
 
   memset(error, 0, error_len);
   memcpy(error, err, strlen(err));
+  return TRUE;
 }