mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 826931 - Part 2/3: UnixSocket - allow delayed connection. r=qDot
This commit is contained in:
parent
5075aba1fa
commit
70b1a26645
@ -772,7 +772,8 @@ UnixSocketConsumer::NotifyDisconnect()
|
||||
|
||||
bool
|
||||
UnixSocketConsumer::ConnectSocket(UnixSocketConnector* aConnector,
|
||||
const char* aAddress)
|
||||
const char* aAddress,
|
||||
int aDelayMs)
|
||||
{
|
||||
MOZ_ASSERT(aConnector);
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
@ -783,8 +784,12 @@ UnixSocketConsumer::ConnectSocket(UnixSocketConnector* aConnector,
|
||||
nsCString addr;
|
||||
addr.Assign(aAddress);
|
||||
mImpl = new UnixSocketImpl(this, aConnector, addr);
|
||||
XRE_GetIOMessageLoop()->PostTask(FROM_HERE,
|
||||
new SocketConnectTask(mImpl));
|
||||
MessageLoop* ioLoop = XRE_GetIOMessageLoop();
|
||||
if (aDelayMs > 0) {
|
||||
ioLoop->PostDelayedTask(FROM_HERE, new SocketConnectTask(mImpl), aDelayMs);
|
||||
} else {
|
||||
ioLoop->PostTask(FROM_HERE, new SocketConnectTask(mImpl));
|
||||
}
|
||||
mConnectionStatus = SOCKET_CONNECTING;
|
||||
return true;
|
||||
}
|
||||
|
@ -159,10 +159,13 @@ public:
|
||||
*
|
||||
* @param aConnector Connector object for socket type specific functions
|
||||
* @param aAddress Address to connect to.
|
||||
* @param aDelayMs Time delay in milli-seconds.
|
||||
*
|
||||
* @return true on connect task started, false otherwise.
|
||||
*/
|
||||
bool ConnectSocket(UnixSocketConnector* aConnector, const char* aAddress);
|
||||
bool ConnectSocket(UnixSocketConnector* aConnector,
|
||||
const char* aAddress,
|
||||
int aDelayMs = 0);
|
||||
|
||||
/**
|
||||
* Starts a task on the socket that will try to accept a new connection in a
|
||||
|
Loading…
Reference in New Issue
Block a user