]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: spoe: Queue message only if no SPOE applet is attached to the stream
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 10 Apr 2019 12:02:12 +0000 (14:02 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 12 Apr 2019 14:38:54 +0000 (16:38 +0200)
If a SPOE applet is already attached to a stream to handle its messages, we must
not queue them. Otherwise it could be handled by another applet leading to
errors. This happens with fragmented messages only. When the first framgnent is
sent, the SPOE applet sending it is attached to the stream. It should be used to
send all other fragments.

This patch must be backported to 1.9 and 1.8.

src/flt_spoe.c

index b82071007c5e36320c9078509d3160340e9b9fb8..a7d6bb9506f7b8125e3e9113f70b71159ecf721e 100644 (file)
@@ -2096,11 +2096,15 @@ spoe_queue_context(struct spoe_context *ctx)
                return -1;
        }
 
-       /* Add the SPOE context in the sending queue */
-       LIST_ADDQ(&agent->rt[tid].sending_queue, &ctx->list);
+       /* Add the SPOE context in the sending queue if the stream has no applet
+        * already assigned and wakeup all idle applets. Otherwise, don't queue
+        * it. */
        _HA_ATOMIC_ADD(&agent->counters.nb_sending, 1);
        spoe_update_stat_time(&ctx->stats.tv_request, &ctx->stats.t_request);
        ctx->stats.tv_queue = now;
+       if (ctx->spoe_appctx)
+               return 1;
+       LIST_ADDQ(&agent->rt[tid].sending_queue, &ctx->list);
 
        SPOE_PRINTF(stderr, "%d.%06d [SPOE/%-15s] %s: stream=%p"
                    " - Add stream in sending queue"