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 <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -250,6 +251,7 @@ ikcpcb* ikcp_create(IUINT32 conv, void *user)
|
|||||||
kcp->probe = 0;
|
kcp->probe = 0;
|
||||||
kcp->mtu = IKCP_MTU_DEF;
|
kcp->mtu = IKCP_MTU_DEF;
|
||||||
kcp->mss = kcp->mtu - IKCP_OVERHEAD;
|
kcp->mss = kcp->mtu - IKCP_OVERHEAD;
|
||||||
|
kcp->stream = 0;
|
||||||
|
|
||||||
kcp->buffer = (char*)ikcp_malloc((kcp->mtu + IKCP_OVERHEAD) * 3);
|
kcp->buffer = (char*)ikcp_malloc((kcp->mtu + IKCP_OVERHEAD) * 3);
|
||||||
if (kcp->buffer == NULL) {
|
if (kcp->buffer == NULL) {
|
||||||
@ -480,7 +482,7 @@ int ikcp_send(ikcpcb *kcp, const char *buffer, int len)
|
|||||||
memcpy(seg->data, buffer, size);
|
memcpy(seg->data, buffer, size);
|
||||||
}
|
}
|
||||||
seg->len = size;
|
seg->len = size;
|
||||||
seg->frg = count - i - 1;
|
seg->frg = (kcp->stream == 0)? (count - i - 1) : 0;
|
||||||
iqueue_init(&seg->node);
|
iqueue_init(&seg->node);
|
||||||
iqueue_add_tail(&seg->node, &kcp->snd_queue);
|
iqueue_add_tail(&seg->node, &kcp->snd_queue);
|
||||||
kcp->nsnd_que++;
|
kcp->nsnd_que++;
|
||||||
|
2
ikcp.h
2
ikcp.h
@ -298,7 +298,7 @@ struct IKCPCB
|
|||||||
void *user;
|
void *user;
|
||||||
char *buffer;
|
char *buffer;
|
||||||
int fastresend;
|
int fastresend;
|
||||||
int nocwnd;
|
int nocwnd, stream;
|
||||||
int logmask;
|
int logmask;
|
||||||
int (*output)(const char *buf, int len, struct IKCPCB *kcp, void *user);
|
int (*output)(const char *buf, int len, struct IKCPCB *kcp, void *user);
|
||||||
void (*writelog)(const char *log, struct IKCPCB *kcp, void *user);
|
void (*writelog)(const char *log, struct IKCPCB *kcp, void *user);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user