]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: stream-interface: add an rcv_buf callback to sock_ops
authorWilly Tarreau <wtarreau@exceliance.fr>
Mon, 20 Aug 2012 18:27:59 +0000 (20:27 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 3 Sep 2012 18:47:30 +0000 (20:47 +0200)
This one is to be used by the read I/O handlers.

include/types/stream_interface.h
src/raw_sock.c

index 1a75c8d45bcd1e0efddd20556520933dc2fdce81..018349bbccdb8a7f71bb8e49182a5bae56d8b9dc 100644 (file)
@@ -91,6 +91,7 @@ enum {
 
 #define SI_FL_CAP_SPLICE (SI_FL_CAP_SPLTCP)
 
+struct buffer;
 struct server;
 struct proxy;
 struct si_applet;
@@ -118,6 +119,7 @@ struct sock_ops {
        void (*write)(struct connection *conn);     /* write callback after poll() */
        void (*close)(struct connection *);         /* close the data channel on the connection */
        int  (*snd_buf)(struct connection *conn);   /* callback used to send a buffer contents */
+       int  (*rcv_buf)(struct connection *conn, struct buffer *buf, int count); /* recv callback */
 };
 
 /* A stream interface has 3 parts :
index f5b5f2f1d3e49b1bd43cb83b091d7b1a5bca2f5e..7dd90c9468ed078d6a7c36e2b1df51ca61cfe338 100644 (file)
@@ -343,7 +343,7 @@ static void sock_raw_read(struct connection *conn)
                        break;
                }
 
-               ret = raw_sock_to_buf(conn, &b->buf, max);
+               ret = conn->data->rcv_buf(conn, &b->buf, max);
                if (ret <= 0)
                        break;
 
@@ -634,6 +634,7 @@ struct sock_ops raw_sock = {
        .read    = sock_raw_read,
        .write   = si_conn_send_cb,
        .snd_buf = sock_raw_write_loop,
+       .rcv_buf = raw_sock_to_buf,
        .close   = NULL,
 };