From 2ec46c558ab3772099f573ee6949f08607e7d667 Mon Sep 17 00:00:00 2001
From: Fabian Keil <fk@fabiankeil.de>
Date: Wed, 22 Jan 2014 14:33:14 +0100
Subject: [PATCH] Delay Curl_addHandleToPipeline() by a milisecond

Work-around to get test 584 working reliably on FreeBSD 11-CURRENT
again after 5b2342d3772 removed a couple of log messages which made
the function faster.
---
 lib/url.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/lib/url.c b/lib/url.c
index fba3bd3..e975ae1 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -2723,11 +2723,21 @@ bool Curl_isPipeliningEnabled(const struct SessionHandle *handle)
   return Curl_multi_pipeline_enabled(handle->multi);
 }
 
+static void wait_ms(int ms)
+{
+  struct timeval t;
+  t.tv_sec = ms/1000;
+  ms -= (int)t.tv_sec * 1000;
+  t.tv_usec = ms * 1000;
+  select(0, NULL, NULL , NULL, &t);
+}
+
 CURLcode Curl_addHandleToPipeline(struct SessionHandle *data,
                                   struct curl_llist *pipeline)
 {
   if(!Curl_llist_insert_next(pipeline, pipeline->tail, data))
     return CURLE_OUT_OF_MEMORY;
+  wait_ms(1);
   return CURLE_OK;
 }
 
-- 
1.9.0


