KCP ikcp_recv APi returns -1

luaexgnf  于 2022-10-25  发布在  其他
关注(0)|答案(2)|浏览(139)

I have 3 instances of kcp object A, B, C.
from A to B . A sends data and B it is getting received properly.
From B to C also its working fine.

But when i now send data from C to B . ikcp_recv returns -1

Note ikcp_send/recv are in 2 different thread.
i read in issue section about thread safety .

so the question is . is it like that we can only either send or recv from 1 kcp object at a time not send and recv in parallel.

btxsgosb

btxsgosb1#

kcp is not thread-safe, and should be guarded by a mutex.

1mrurvl1

1mrurvl12#

@skywind3000 I have put mutex lock and unlock in function written in ikcp.c, still the same behavior.
when i forcing kcp->rcv_nxt = 0; its worked fine.

相关问题