mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-09-10 03:54:54 -06:00
Core: Fixed WebSocket::Connect in non-blocking mode
git-svn-id: svn://ultimatepp.org/upp/trunk@11498 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
54c619f8fa
commit
e1f56bbcb2
1 changed files with 12 additions and 5 deletions
|
|
@ -90,8 +90,10 @@ bool WebSocket::Connect(const String& url)
|
|||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
else {
|
||||
opcode = DNS;
|
||||
addrinfo.Start(host, port);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -152,6 +154,10 @@ void WebSocket::Dns()
|
|||
{
|
||||
if(addrinfo.InProgress())
|
||||
return;
|
||||
if(!addrinfo.GetResult()) {
|
||||
Error("DNS lookup failed");
|
||||
return;
|
||||
}
|
||||
LLOG("DNS resolved");
|
||||
StartConnect();
|
||||
}
|
||||
|
|
@ -340,12 +346,13 @@ void WebSocket::Do0()
|
|||
int prev_opcode;
|
||||
do {
|
||||
prev_opcode = opcode;
|
||||
if(socket->IsEof() && !(close_sent || close_received))
|
||||
Error("Socket has been closed unexpectedly");
|
||||
if(findarg(opcode, DNS, SSL_HANDSHAKE) < 0) {
|
||||
Output();
|
||||
if(socket->IsEof() && !(close_sent || close_received))
|
||||
Error("Socket has been closed unexpectedly");
|
||||
}
|
||||
if(IsError())
|
||||
return;
|
||||
if(findarg(opcode, DNS, SSL_HANDSHAKE) < 0)
|
||||
Output();
|
||||
switch(opcode) {
|
||||
case DNS:
|
||||
Dns();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue