Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/SoftEtherVPN/SoftEtherVPN_Stable.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordnobori <da.git@softether.co.jp>2014-06-08 11:40:44 +0400
committerdnobori <da.git@softether.co.jp>2014-06-08 11:40:44 +0400
commitea38eef377a2161347c864f42f85f24af9134a89 (patch)
tree94916b51521ed19c5ebe8c3959e50febd071774c /src/Mayaqua
parent719ee999d6c6418b3e9f4afb904387700637009f (diff)
v4.08-9449-rtm
Diffstat (limited to 'src/Mayaqua')
-rw-r--r--src/Mayaqua/Network.c24
-rw-r--r--src/Mayaqua/Network.h1
2 files changed, 19 insertions, 6 deletions
diff --git a/src/Mayaqua/Network.c b/src/Mayaqua/Network.c
index 8dfbb063..12b0faa7 100644
--- a/src/Mayaqua/Network.c
+++ b/src/Mayaqua/Network.c
@@ -5135,15 +5135,19 @@ LABEL_TIMEOUT:
sock, sock_event, 0, false);
}
- if (sock != NULL)
+ if (sock_event != NULL)
{
- Disconnect(sock);
- ReleaseSock(sock);
+ ReleaseSockEvent(sock_event);
}
- if (sock_event != NULL)
+ if (sock != NULL)
{
- ReleaseSockEvent(sock_event);
+ if (ret == NULL)
+ {
+ Disconnect(sock);
+ }
+
+ ReleaseSock(sock);
}
return ret;
@@ -14645,6 +14649,9 @@ void ConnectThreadForTcp(THREAD *thread, void *param)
if (sock != NULL && p->Tcp_TryStartSsl)
{
bool ssl_ret = false;
+
+ p->Tcp_InNegotiation = true;
+
// Attempt the SSL negotiation to take this opportunity
Lock(p->CancelLock);
{
@@ -14702,6 +14709,7 @@ LABEL_CANCEL:
p->Ok = (p->Result_Tcp_Sock == NULL ? false : true);
p->FinishedTick = Tick64();
p->Finished = true;
+ p->Tcp_InNegotiation = false;
Set(p->FinishEvent);
}
@@ -15031,7 +15039,11 @@ SOCK *ConnectEx3(char *hostname, UINT port, UINT timeout, bool *cancel_flag, cha
if (now >= tcp_giveup_tick)
{
// Result of the TCP is uncertain, but give up
- break;
+ if (p1.Finished || p1.Tcp_InNegotiation == false)
+ {
+ // Break only when TCP SSL negotiation is not being processed
+ break;
+ }
}
}
diff --git a/src/Mayaqua/Network.h b/src/Mayaqua/Network.h
index 7704ceea..62e8ae5a 100644
--- a/src/Mayaqua/Network.h
+++ b/src/Mayaqua/Network.h
@@ -880,6 +880,7 @@ struct CONNECT_TCP_RUDP_PARAM
bool Tcp_SslNoTls;
LOCK *CancelLock;
SOCK *CancelDisconnectSock;
+ bool Tcp_InNegotiation;
};
#define SSL_DEFAULT_CONNECT_TIMEOUT (15 * 1000) // SSL default timeout