]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: peers: Use the applet API to send message
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 5 May 2023 09:00:50 +0000 (11:00 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 5 May 2023 13:41:30 +0000 (15:41 +0200)
The peers applet now use the applet API to send message instead of the
channel API. This way, it does not need to take care to request more room if
it fails to put data into the channel's buffer.

src/peers.c

index c1052c2a7f2ebe212431dbd512b05ed91035dbdd..503a71fcca57c6e3191ae9f01ed49f88624ff1f1 100644 (file)
@@ -1205,7 +1205,6 @@ static inline int peer_send_msg(struct appctx *appctx,
                                 struct peer_prep_params *params)
 {
        int ret, msglen;
-       struct stconn *sc = appctx_sc(appctx);
 
        msglen = peer_prepare_msg(trash.area, trash.size, params);
        if (!msglen) {
@@ -1215,14 +1214,10 @@ static inline int peer_send_msg(struct appctx *appctx,
        }
 
        /* message to buffer */
-       ret = ci_putblk(sc_ic(sc), trash.area, msglen);
+       ret = applet_putblk(appctx, trash.area, msglen);
        if (ret <= 0) {
-               if (ret == -1) {
-                       /* No more write possible */
-                       sc_need_room(sc);
-                       return -1;
-               }
-               appctx->st0 = PEER_SESS_ST_END;
+               if (ret != -1)
+                       appctx->st0 = PEER_SESS_ST_END;
        }
 
        return ret;