Monibuca / plugin-gb28181

gb28181 plugin for monibuca
GNU Affero General Public License v3.0
146 stars 95 forks source link

Invite请求中SipRequestForResponse报错之后,使用的端口没有回收 #109

Open gzncland opened 3 months ago

gzncland commented 3 months ago

https://github.com/Monibuca/plugin-gb28181/blob/a207352fe6e4a2fc67780ce71ac48f56f9e17b3f/channel.go#L425

在发送Invite请求之前需要从PortManager中拿一个端口,但是发送Invite请求不成功时,不能走Bye中的recycle逻辑。久而久之PortManager.Range()会越来越少直至耗尽

inviteRes, err := d.SipRequestForResponse(invite)
if err != nil {
  channel.Error("invite", zap.Error(err), zap.String("msg", invite.String()))
  return http.StatusInternalServerError, err
}
gzncland commented 3 months ago

另外还发现一个问题是SipRequestForResponse会阻塞很久,或者会报超时错误。估计是gosip库的问题

langhuihui commented 3 months ago

嗯,你看看有没有办法回收端口,帮忙提个 PR

YOLO-PK commented 1 month ago

https://github.com/Monibuca/plugin-gb28181/blob/a207352fe6e4a2fc67780ce71ac48f56f9e17b3f/channel.go#L425

在发送Invite请求之前需要从PortManager中拿一个端口,但是发送Invite请求不成功时,不能走Bye中的recycle逻辑。久而久之PortManager.Range()会越来越少直至耗尽

inviteRes, err := d.SipRequestForResponse(invite)
if err != nil {
  channel.Error("invite", zap.Error(err), zap.String("msg", invite.String()))
  return http.StatusInternalServerError, err
}

请问解决了吗

langhuihui commented 1 month ago

解决了