summaryrefslogtreecommitdiff
path: root/src/cache/tcpconnection.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cache/tcpconnection.c')
-rw-r--r--src/cache/tcpconnection.c11
1 files changed, 11 insertions, 0 deletions
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 <stdint.h>
#include <errno.h>
+#include <skalibs/uint16.h>
#include <skalibs/allreadwrite.h>
#include <skalibs/error.h>
#include <skalibs/tai.h>
@@ -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 :