]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: spoe: Don't queue a SPOE context if nothing is sent
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 12 Jan 2018 09:45:47 +0000 (10:45 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 15 Jan 2018 12:48:03 +0000 (13:48 +0100)
When some messages must be sent to an agent, the SPOE context of the stream is
queued to be handled by an SPOE applet. If there is no available applet, a new
one is created, thus opening a connection with the agent.

Since the support of ACLs on messages, some processing can now be discarded. So,
to avoid opening a connection for nothing, the SPOE context is now queued after
the messages encoding.

src/flt_spoe.c

index e70cf111e31ea074e30b3587706a85bf91c17cb9..cb97164677cbaa85a7a43353caa07e12707550fe 100644 (file)
@@ -2592,9 +2592,6 @@ spoe_process_messages(struct stream *s, struct spoe_context *ctx,
                if (!ret)
                        goto out;
 
-               if (spoe_queue_context(ctx) < 0)
-                       goto error;
-
                ctx->state = SPOE_CTX_ST_ENCODING_MSGS;
                /* fall through */
        }
@@ -2607,6 +2604,8 @@ spoe_process_messages(struct stream *s, struct spoe_context *ctx,
                        goto error;
                if (!ret)
                        goto skip;
+               if (spoe_queue_context(ctx) < 0)
+                       goto error;
                ctx->state = SPOE_CTX_ST_SENDING_MSGS;
        }