]> granicus.if.org Git - curl/commitdiff
If TCP_NODELAY is not defined we can't disable the Nagle algorithm
authorYang Tse <yangsita@gmail.com>
Wed, 3 Oct 2007 23:38:07 +0000 (23:38 +0000)
committerYang Tse <yangsita@gmail.com>
Wed, 3 Oct 2007 23:38:07 +0000 (23:38 +0000)
tests/server/sws.c

index 1391bf93f9b704a35a69d1a7a2e667e27e8fe37f..65b81a4c02afdc0e949ce5cf9c64e117a41b5957 100644 (file)
@@ -788,7 +788,6 @@ int main(int argc, char *argv[])
 #ifdef CURL_SWS_FORK_ENABLED
   bool use_fork = FALSE;
 #endif
-  int opt;
 
   while(argc>arg) {
     if(!strcmp("--version", argv[arg])) {
@@ -951,15 +950,17 @@ int main(int argc, char *argv[])
 #endif
     logmsg("====> Client connect");
 
+#ifdef TCP_NODELAY
     /*
      * Disable the Nagle algorithm to make it easier to send out a large
      * response in many small segments to torture the clients more.
      */
-    opt = 1;
+    flag = 1;
     if (setsockopt(msgsock, IPPROTO_TCP, TCP_NODELAY,
-                   (void *)&opt, sizeof(opt)) == -1) {
+                   (void *)&flag, sizeof(flag)) == -1) {
       logmsg("====> TCP_NODELAY failed");
     }
+#endif
 
   do {
       if(get_request(msgsock, &req))