From 1360696c2d6ed7083a71979c8382c9d34df12cf0 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Tue, 30 Jul 2024 14:36:22 +0000 Subject: More stuff Signed-off-by: Laurent Bercot --- src/cache/tcpconnection.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/cache/tcpconnection.c') diff --git a/src/cache/tcpconnection.c b/src/cache/tcpconnection.c index 71a4299..40c3035 100644 --- a/src/cache/tcpconnection.c +++ b/src/cache/tcpconnection.c @@ -3,6 +3,7 @@ #include #include +#include #include #include #include @@ -39,6 +40,16 @@ uint16_t tcpconnection_delete (tcpconnection *p) return newi ; } +int tcpconnection_add (tcpconnection *p, char const *s, uint16_t len) +{ + char pack[2] ; + if (!stralloc_readyplus(&p->out.x, 2 + len)) return 0 ; + uint16_pack_big(pack, len) ; + bufalloc_put(&p->out, pack, 2) ; + bufalloc_put(&p->out, s, len) ; + return 0 ; +} + int tcpconnection_flush (tcpconnection *p) { return bufalloc_flush(&p->out) ? 1 : -- cgit v1.3.1