Socket connect no longer synchronous and blocking
Summary: Never really liked this code. Before this change, calls to connect were blocking. Because of this, we had to make use of promises and a bit of really not that good-looking code. So, this change makes connect non-blocking meaning that we make full use of our event handler. These changes contain: - CSR is not getting generated after each failed attempt. - Connect is no longer blocking. - Do not report events via the handler when explicitly disconnecting. Reviewed By: jknoxville Differential Revision: D46853228 fbshipit-source-id: 00e6a9c7c039a756175fe14982959e078d92bacb
This commit is contained in:
committed by
Facebook GitHub Bot
parent
65e515bdaa
commit
e42db220ee
@@ -40,7 +40,7 @@ class FlipperReactSocketClient : public FlipperReactBaseSocket {
|
||||
|
||||
virtual ~FlipperReactSocketClient();
|
||||
|
||||
virtual bool connect(FlipperConnectionManager* manager) override;
|
||||
virtual void connect(FlipperConnectionManager* manager) override;
|
||||
virtual void disconnect() override;
|
||||
|
||||
virtual void send(const folly::dynamic& message, SocketSendHandler completion)
|
||||
@@ -61,7 +61,6 @@ class FlipperReactSocketClient : public FlipperReactBaseSocket {
|
||||
args);
|
||||
|
||||
private:
|
||||
std::promise<bool> connected_;
|
||||
winrt::Windows::Networking::Sockets::MessageWebSocket socket_;
|
||||
winrt::event_token messageReceivedEventToken_;
|
||||
winrt::event_token closedEventToken_;
|
||||
|
||||
Reference in New Issue
Block a user