add stream mode

This commit is contained in:
skywind3000
2016-07-25 20:04:17 +08:00
parent 478275193b
commit f14622a495
2 changed files with 4 additions and 2 deletions

4
ikcp.c
View File

@@ -15,6 +15,7 @@
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <stdio.h>
@@ -250,6 +251,7 @@ ikcpcb* ikcp_create(IUINT32 conv, void *user)
kcp->probe = 0;
kcp->mtu = IKCP_MTU_DEF;
kcp->mss = kcp->mtu - IKCP_OVERHEAD;
kcp->stream = 0;
kcp->buffer = (char*)ikcp_malloc((kcp->mtu + IKCP_OVERHEAD) * 3);
if (kcp->buffer == NULL) {
@@ -480,7 +482,7 @@ int ikcp_send(ikcpcb *kcp, const char *buffer, int len)
memcpy(seg->data, buffer, size);
}
seg->len = size;
seg->frg = count - i - 1;
seg->frg = (kcp->stream == 0)? (count - i - 1) : 0;
iqueue_init(&seg->node);
iqueue_add_tail(&seg->node, &kcp->snd_queue);
kcp->nsnd_que++;