Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

binding request timeout #167

Open
laumy007 opened this issue Dec 6, 2024 · 2 comments
Open

binding request timeout #167

laumy007 opened this issue Dec 6, 2024 · 2 comments

Comments

@laumy007
Copy link

laumy007 commented Dec 6, 2024

两个设备属于对称型穿透,采集端的设备使用stun链接,接收端的设备使用turn链接,通过turn服务帮忙转发,发现测试一段时间后流就异常停止了,设备端打印“binding request timeout”,状态切换为closed,问题是必现的,不知是否有什么排查方法。

DEBUG libpeer/src/peer_connection.c 426 agent_recv 70
DEBUG libpeer/src/peer_connection.c 429 Got RTCP packet
DEBUG libpeer/src/peer_connection.c 103 RTCP_PR
DEBUG libpeer/src/peer_connection.c 119 RTCP_PSFB 15
DEBUG libpeer/src/peer_connection.c 426 agent_recv 70
DEBUG libpeer/src/peer_connection.c 429 Got RTCP packet
DEBUG libpeer/src/peer_connection.c 103 RTCP_PR
DEBUG libpeer/src/peer_connection.c 119 RTCP_PSFB 15
DEBUG libpeer/src/peer_connection.c 426 agent_recv 70
DEBUG libpeer/src/peer_connection.c 429 Got RTCP packet
DEBUG libpeer/src/peer_connection.c 103 RTCP_PR
DEBUG libpeer/src/peer_connection.c 119 RTCP_PSFB 15
DEBUG libpeer/src/peer_connection.c 426 agent_recv 61
DEBUG libpeer/src/dtls_srtp.c 485 DTLS content type: 23
DEBUG libpeer/src/peer_connection.c 435 Got DTLS data 32
DEBUG libpeer/src/sctp.c 451 Data of length 4 received on stream 0 with SSN 39, TSN 703256564, PPID 51
DEBUG libpeer/src/sctp.c 401 Got message (size = 4)
on message: 0 ping, send pong
DEBUG libpeer/src/peer_connection.c 426 agent_recv 70
DEBUG libpeer/src/peer_connection.c 429 Got RTCP packet
DEBUG libpeer/src/peer_connection.c 103 RTCP_PR
DEBUG libpeer/src/peer_connection.c 119 RTCP_PSFB 15
DEBUG libpeer/src/peer_connection.c 426 agent_recv 57
DEBUG libpeer/src/dtls_srtp.c 485 DTLS content type: 23
DEBUG libpeer/src/peer_connection.c 435 Got DTLS data 28
DEBUG libpeer/src/sctp.c 451 Data of length 12 received on stream 0 with SSN 0, TSN 0, PPID 0
DEBUG libpeer/src/peer_connection.c 426 agent_recv 70
DEBUG libpeer/src/peer_connection.c 429 Got RTCP packet
DEBUG libpeer/src/peer_connection.c 103 RTCP_PR
DEBUG libpeer/src/peer_connection.c 119 RTCP_PSFB 15
DEBUG libpeer/src/peer_connection.c 426 agent_recv 70
DEBUG libpeer/src/peer_connection.c 429 Got RTCP packet
DEBUG libpeer/src/peer_connection.c 103 RTCP_PR
DEBUG libpeer/src/peer_connection.c 119 RTCP_PSFB 15
INFO libpeer/src/peer_connection.c 459 binding request timeout
state is changed: closed

@topworldcoder
Copy link
Contributor

Hi, I have a few suggestions maybe can help you figure out something.

First, you can modify the code like:

if ((pc->agent_ret = agent_recv(&pc->agent, pc->agent_buf, sizeof(pc->agent_buf))) > 0) {
codes ...
} else { // do that in else case only, maybe not a good idea.
if (KEEPALIVE_CONNCHECK > 0 && (ports_get_epoch_time() - pc->agent.binding_request_time) > KEEPALIVE_CONNCHECK) {
LOGI("binding request timeout");
STATE_CHANGED(pc, PEER_CONNECTION_CLOSED);
}
}

Second, you can set KEEPALIVE_CONNCHECK to a larger interval, like 90000.
Third, you can see that 'agent->binding_request_time' is set in function 'agent_process_stun_request' when processing STUN_METHOD_BINDING, you can add logs before and after 'stun_msg_is_valid' like 'LOGD("stun request in STUN_METHOD_BINDING:%d", stun_msg->stunmethod);' to check if msg exists.

After these changes, does this still happen?

@laumy007
Copy link
Author

laumy007 commented Dec 9, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants