Haivision / srt

Secure, Reliable, Transport
https://www.srtalliance.org
Mozilla Public License 2.0
3.12k stars 853 forks source link

Non-blocking processing on the receiving side #3044

Closed hayaTMC closed 1 month ago

hayaTMC commented 1 month ago

I implemented it based on the sample and issue below, but I get the following error in srt_epoll_uwait. examples/example-client-nonblock.c https://github.com/Haivision/srt/issues/2756

Error : "Operation not supported: All sockets removed from epoll, waiting would deadlock"

Do you have any idea what the cause might be?

The implementation code is as follows.

srt_startup(); SRTSOCKET srtSock = srt_create_socket(); srt_setsockopt(srtSock, 0, SRTO_TRANSTYPE, SRTT_FILE, typeLen); int no = 0; st = srt_setsockflag(srtSock , SRTO_RCVSYN, &no, sizeof no) int epollid = srt_epoll_create(); int modes = SRT_EPOLL_IN | SRT_EPOLL_ERR; st = srt_epoll_add_usock(epollid, srtSock, &modes)); st = srt_connect(srtSock, serverAddr, serverAddrLen); SRT_EPOLL_EVENT ready_sockets; ready_sockets.fd = srtSock; ready_sockets.events = SRT_EPOLL_IN | SRT_EPOLL_ERR; st = srt_epoll_uwait(epollid, &ready_sockets, 1, timeoutMs); if (st == -1) { getlasterror_str(); // "Operation not supported: All sockets removed from epoll, waiting would deadlock" }

hayaTMC commented 1 month ago

The execution environment is as follows. Non-blocking processing is implemented on the client side. SRT: Ver.1.5.3 SERVER: Linux Ver.6.1.30 CLIENT: Windows10 Pro 22H2

hayaTMC commented 1 month ago

There is a correction in the source code. It is as follows. The error phenomenon is the same.

ready_sockets.fd = -1; ready_sockets.events = 0;

maxsharabayko commented 1 month ago

Does the example (examples/example-client-nonblock.c) work? If yes, check the difference between your code and the example to find what introduces an issue. Try replacing srt_epoll_wait with srt_epoll_uwait in the example.

hayaTMC commented 1 month ago

Thank you for your reply. We have decided to use the client-side receiving process in blocking mode and use Epoll like select.

Therefore, this issue will be closed. Thank you.