mirror of
https://github.com/skywind3000/kcp.git
synced 2025-01-29 18:00:26 +08:00
add stream mode
This commit is contained in:
parent
478275193b
commit
f14622a495
4
ikcp.c
4
ikcp.c
@ -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++;
|
||||
|
Loading…
Reference in New Issue
Block a user