kcp icon indicating copy to clipboard operation
kcp copied to clipboard

KCP ikcp_recv APi returns -1

Open d-chand opened this issue 5 years ago • 2 comments

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.

d-chand avatar Nov 13 '20 04:11 d-chand

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

skywind3000 avatar Nov 13 '20 12:11 skywind3000

@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.

d-chand avatar Nov 17 '20 03:11 d-chand