Skip to content

异常未捕捉到导致死循环 #36

@YouXinxing

Description

@YouXinxing

当samba服务断开或者异常的时候,请求连接时,
var remote = (IPEndPoint)this.Socket?.RemoteEndPoint;
RemoteEndPoint 强制类型的转码类是 EndPoint 出现异常,导致异常类SmbException没有捕捉到,ConnectionState不能重置为0,导致程序在下一次连接时,在
while (ConnectionState != 0)
{
if (ConnectionState == 2 || ConnectionState == 3)
{
// connected or disconnecting
return;
}
try
{
Runtime.Wait(Session.transport,2000);
}
catch (Exception ie)
{
throw new SmbException(ie.Message, ie);
}
}
这边一直死循环,阻塞进程,另外Runtime.Wait(Session.transport,2000);中,等待超时应该设置一个超时间,这样程序更灵活一点。
望修复,感谢开源。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions