summaryrefslogtreecommitdiffhomepage
path: root/packet.c
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2015-03-01 00:57:21 +0800
committerMatt Johnston <matt@ucc.asn.au>2015-03-01 00:57:21 +0800
commit579463933b6328b8d54ea246c0d0c7745fb8542a (patch)
treedcd80d452566b8dea94004e3747c7a3416a50d5c /packet.c
parent989c5c14361671ceaf3e78313a56d4260bcb49f9 (diff)
A bit of a bodge to avoid memcpy if zlib is disabled
--HG-- branch : nocircbuffer
Diffstat (limited to 'packet.c')
-rw-r--r--packet.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/packet.c b/packet.c
index b477a07..d38d8f4 100644
--- a/packet.c
+++ b/packet.c
@@ -314,18 +314,21 @@ void decrypt_packet() {
if (is_compress_recv()) {
/* decompress */
ses.payload = buf_decompress(ses.readbuf, len);
+ buf_setpos(ses.payload, 0);
+ ses.payload_beginning = 0;
+ buf_free(ses.readbuf);
} else
#endif
{
+ ses.payload = ses.readbuf;
+ ses.payload_beginning = ses.payload->pos;
+ buf_setlen(ses.payload, ses.payload->pos + len);
/* copy payload */
- ses.payload = buf_new(len);
- memcpy(ses.payload->data, buf_getptr(ses.readbuf, len), len);
- buf_incrlen(ses.payload, len);
+ //ses.payload = buf_new(len);
+ //memcpy(ses.payload->data, buf_getptr(ses.readbuf, len), len);
+ //buf_incrlen(ses.payload, len);
}
-
- buf_free(ses.readbuf);
ses.readbuf = NULL;
- buf_setpos(ses.payload, 0);
ses.recvseq++;