diff options
author | Moonchild <moonchild@palemoon.org> | 2021-05-02 20:28:54 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2021-05-02 20:28:54 +0000 |
commit | 964bff557d829f6c76f7b9d2234028ea1954dd34 (patch) | |
tree | 969d4356de00c725ce2225eedc7d58152a605ade /netwerk | |
parent | 4c5b1a83f4d0bdeb544ed889e433fbfc345212b9 (diff) | |
parent | 64ce2633600f34172f249b02b63d3de598fd5626 (diff) | |
download | uxp-964bff557d829f6c76f7b9d2234028ea1954dd34.tar.gz |
Merge branch '1767'
Diffstat (limited to 'netwerk')
-rw-r--r-- | netwerk/protocol/websocket/WebSocketChannel.cpp | 28 | ||||
-rw-r--r-- | netwerk/protocol/websocket/WebSocketChannel.h | 1 |
2 files changed, 16 insertions, 13 deletions
diff --git a/netwerk/protocol/websocket/WebSocketChannel.cpp b/netwerk/protocol/websocket/WebSocketChannel.cpp index 76be1c9dd0..952c0d5ee5 100644 --- a/netwerk/protocol/websocket/WebSocketChannel.cpp +++ b/netwerk/protocol/websocket/WebSocketChannel.cpp @@ -1247,10 +1247,10 @@ WebSocketChannel::Observe(nsISupports *subject, // Next we check mDataStarted, which we need to do on mTargetThread. if (!IsOnTargetThread()) { mTargetThread->Dispatch( - NewRunnableMethod(this, &WebSocketChannel::OnNetworkChanged), + NewRunnableMethod(this, &WebSocketChannel::OnNetworkChangedTargetThread), NS_DISPATCH_NORMAL); } else { - OnNetworkChanged(); + OnNetworkChangedTargetThread(); } } } @@ -1260,21 +1260,23 @@ WebSocketChannel::Observe(nsISupports *subject, } nsresult -WebSocketChannel::OnNetworkChanged() +WebSocketChannel::OnNetworkChangedTargetThread() { - if (IsOnTargetThread()) { - LOG(("WebSocketChannel::OnNetworkChanged() - on target thread %p", this)); - - if (!mDataStarted) { - LOG(("WebSocket: data not started yet, no ping needed")); - return NS_OK; - } + LOG(("WebSocketChannel::OnNetworkChangedTargetThread() - on target thread %p", this)); - return mSocketThread->Dispatch( - NewRunnableMethod(this, &WebSocketChannel::OnNetworkChanged), - NS_DISPATCH_NORMAL); + if (!mDataStarted) { + LOG(("WebSocket: data not started yet, no ping needed")); + return NS_OK; } + return mSocketThread->Dispatch( + NewRunnableMethod(this, &WebSocketChannel::OnNetworkChanged), + NS_DISPATCH_NORMAL); +} + +nsresult +WebSocketChannel::OnNetworkChanged() +{ MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread, "not socket thread"); LOG(("WebSocketChannel::OnNetworkChanged() - on socket thread %p", this)); diff --git a/netwerk/protocol/websocket/WebSocketChannel.h b/netwerk/protocol/websocket/WebSocketChannel.h index 631edebfaf..f60bc4fbbe 100644 --- a/netwerk/protocol/websocket/WebSocketChannel.h +++ b/netwerk/protocol/websocket/WebSocketChannel.h @@ -146,6 +146,7 @@ private: void GeneratePong(uint8_t *payload, uint32_t len); void GeneratePing(); + nsresult OnNetworkChangedTargetThread();
nsresult OnNetworkChanged(); nsresult StartPinging(); |