新增ikcp_setoutput函数

This commit is contained in:
U2FsdGVkX1 2016-09-10 20:02:36 +08:00
parent 8813e65158
commit abf9ce1464
2 changed files with 10 additions and 0 deletions

7
ikcp.c
View File

@ -292,6 +292,13 @@ ikcpcb* ikcp_create(IUINT32 conv, void *user)
return kcp;
}
//---------------------------------------------------------------------
// set output function
//---------------------------------------------------------------------
void ikcp_setoutput(ikcpcb *kcp, int (*output)(const char *buf, int len, ikcpcb *kcp, void *user))
{
kcp->output = output;
}
//---------------------------------------------------------------------
// release a new kcpcb

3
ikcp.h
View File

@ -333,6 +333,9 @@ extern "C" {
// output callback can be setup like this: 'kcp->output = my_udp_output'
ikcpcb* ikcp_create(IUINT32 conv, void *user);
// set output function
void ikcp_setoutput(ikcpcb *kcp, int (*output)(const char *buf, int len, ikcpcb *kcp, void *user));
// release kcp control object
void ikcp_release(ikcpcb *kcp);