KumoKyaku / kcp

KCP C#版。线程安全,运行时无alloc,对gc无压力。
MIT License
832 stars 136 forks source link

BugFix: 修复当对方发送一个data长度为0的包时rcv_queue会积压的bug #27

Closed liguanyu closed 1 year ago

liguanyu commented 1 year ago

Bug描述:当对方发送一个data长度为0的包时,PeekSize为0,在Recv/TryRecv中直接return,rcv_queue中的第一个包始终无法取出(PeekSize为0),导致积压。可稳定复现。

与原c语言的kcp框架通信发现的,其ikcp_send接口允许发送数据段长度为0的包 int ikcp_send(ikcpcb kcp, const char buffer, int len) { IKCPSEG *seg; int count, i; int sent = 0;

assert(kcp->mss > 0);
if (len < 0) return -1;

    ......

}

liguanyu commented 1 year ago
int ikcp_send(ikcpcb *kcp, const char *buffer, int len)
{
IKCPSEG *seg;
int count, i;
int sent = 0;
assert(kcp->mss > 0);
if (len < 0) return -1;
    ......
}
KumoKyaku commented 1 year ago

感谢。已经合并。 我会尽快发布一个新版本到nuget