mirror of
https://github.com/Ylianst/MeshAgent
synced 2025-12-17 16:53:13 +00:00
1. Fixed bug where resolve fail resulted in Linux agent accidentally closing FD(0)
2. Updated logic, so calling close on an unconnected socket will still propagate a connect failure
This commit is contained in:
@@ -827,8 +827,7 @@ void ILibAsyncSocket_Disconnect(ILibAsyncSocket_SocketModule socketModule)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (module->internalSocket != ~0)
|
|
||||||
{
|
|
||||||
// There is an associated socket that is still valid, so we need to close it
|
// There is an associated socket that is still valid, so we need to close it
|
||||||
module->PAUSE = 1;
|
module->PAUSE = 1;
|
||||||
s = module->internalSocket;
|
s = module->internalSocket;
|
||||||
@@ -871,11 +870,8 @@ void ILibAsyncSocket_Disconnect(ILibAsyncSocket_SocketModule socketModule)
|
|||||||
#ifndef MICROSTACK_NOTLS
|
#ifndef MICROSTACK_NOTLS
|
||||||
module->SSLConnect = 0;
|
module->SSLConnect = 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ILibSpinLock_UnLock(&(module->SendLock));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -965,7 +961,7 @@ void ILibAsyncSocket_ConnectTo(void* socketModule, struct sockaddr *localInterfa
|
|||||||
{
|
{
|
||||||
if (((struct sockaddr_in*)localInterface)->sin_family == AF_UNSPEC || (module->internalSocket = ILibGetSocket(localInterface, SOCK_STREAM, IPPROTO_TCP)) < 0)
|
if (((struct sockaddr_in*)localInterface)->sin_family == AF_UNSPEC || (module->internalSocket = ILibGetSocket(localInterface, SOCK_STREAM, IPPROTO_TCP)) < 0)
|
||||||
{
|
{
|
||||||
module->internalSocket = 0;
|
module->internalSocket = ~0;
|
||||||
module->FinConnect = -1;
|
module->FinConnect = -1;
|
||||||
ILibLifeTime_Add(module->LifeTime, socketModule, 0, &ILibAsyncSocket_Disconnect, NULL);
|
ILibLifeTime_Add(module->LifeTime, socketModule, 0, &ILibAsyncSocket_Disconnect, NULL);
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user