瀏覽代碼

server: only set SO_SNDBUF if it's >0

ambrop7 14 年之前
父節點
當前提交
514575f86a
共有 1 個文件被更改,包括 4 次插入2 次删除
  1. 4 2
      server/server.c

+ 4 - 2
server/server.c

@@ -806,8 +806,10 @@ void listener_handler (BListener *listener)
     }
     
     // limit socket send buffer, else our scheduling is pointless
-    if (!BConnection_SetSendBuffer(&client->con, options.client_sndbuf) < 0) {
-        BLog(BLOG_WARNING, "BConnection_SetSendBuffer failed");
+    if (options.client_sndbuf > 0) {
+        if (!BConnection_SetSendBuffer(&client->con, options.client_sndbuf) < 0) {
+            BLog(BLOG_WARNING, "BConnection_SetSendBuffer failed");
+        }
     }
     
     // assign ID