From 943ff52e30db20efd783681e0edd29df874ab5b1 Mon Sep 17 00:00:00 2001
From: Anthony Mallet <anthony.mallet@laas.fr>
Date: Wed, 12 Feb 2014 19:03:18 +0100
Subject: [PATCH] [wip/tcl-genomix] Import upstream bugfix for nested http
 requests

---
 tcl-genomix/Makefile         |  1 +
 tcl-genomix/distinfo         |  1 +
 tcl-genomix/patches/patch-aa | 23 +++++++++++++++++++++++
 3 files changed, 25 insertions(+)
 create mode 100644 tcl-genomix/patches/patch-aa

diff --git a/tcl-genomix/Makefile b/tcl-genomix/Makefile
index fcd46418..a1ff3219 100644
--- a/tcl-genomix/Makefile
+++ b/tcl-genomix/Makefile
@@ -2,6 +2,7 @@
 # Created:			Anthony Mallet on Fri, 19 Oct 2012
 #
 
+PKGREVISION=	1
 DISTNAME=	tcl-genomix-1.2
 CATEGORIES=	supervision
 MASTER_SITES=	${MASTER_SITE_OPENROBOTS:=tcl-genomix/}
diff --git a/tcl-genomix/distinfo b/tcl-genomix/distinfo
index 53ef29fa..8ef8167b 100644
--- a/tcl-genomix/distinfo
+++ b/tcl-genomix/distinfo
@@ -1,3 +1,4 @@
 SHA1 (tcl-genomix-1.2.tar.gz) = 6e5b081a055b899f5ef4cad08f3970150134a69f
 RMD160 (tcl-genomix-1.2.tar.gz) = 9ddacb79d9cc4705807c43e6183daaab76f2a39a
 Size (tcl-genomix-1.2.tar.gz) = 69408 bytes
+SHA1 (patch-aa) = ea96d0fc9e7ccf436df696c57e07c0686e33811a
diff --git a/tcl-genomix/patches/patch-aa b/tcl-genomix/patches/patch-aa
new file mode 100644
index 00000000..ffaecb28
--- /dev/null
+++ b/tcl-genomix/patches/patch-aa
@@ -0,0 +1,23 @@
+From 038ff1e69b8a9d947b4f9fce2aa2485b6f742700
+
+When dealing with nested http requests, the innermost request (the latest one)
+gets its result from the last element in the results stack. Definitely not from
+the first one.
+
+This fixes random failures under a high throughput requests flow, where http
+results where sometimes mixed.
+
+diff --git src/http.tcl src/http.tcl
+index a21d250..114b7ee 100644
+--- src/http.tcl
++++ src/http.tcl
+@@ -55,7 +55,8 @@ namespace eval genomix::http {
+
+     # pop results
+     fileevent $sock readable $e
+-    set pending($sock) [lassign $pending($sock) r]
++    set r [lindex $pending($sock) end]
++    set pending($sock) [lrange $pending($sock) 0 end-1]
+     incr pindex($sock) -1
+     switch -- [dict get $r state] {
+       ok	{ return $r }
-- 
GitLab