Commit Graph

176 Commits

Author SHA1 Message Date
Andres Suarez
c315691b2d Apply clang-format
Differential Revision: D19843069

fbshipit-source-id: af3f3998e2259ca5070b43ffb19933cf9304319d
2020-02-11 19:29:23 -08:00
John Knox
c2370f7faf Speed up re-connect after re-opening app
Summary:
The problem is that whenever an app is shutdown, and then reopened, the flipper dir gets reset when getting the CSR for connecting to flipper.
This causes the first connection attempt to fail always, and it goes through the whole cert exchange, taking longer than necessary.

Fixes it by loading the csr from disk if it's not loaded yet, without blowing away the whole certs state.

A side effect of this would be that as long as some file exists where the csr lives, flipper state would never get reset, so it wouldn't be able to fix itself automatically anymore. To keep that working, I've made `resetFlipperDir()` public and am calling it explicitly when starting certificate exchange. This should ensure that we still reset when we need to, but not unnecessarily.

The reason it went wrong is that getCSR used to be called only at cert exchange, when resetting and generating a new one was always desirable. However, when we shipped the fix for changeable android serials, it started to be used as a normal getter.

Reviewed By: timur-valiev

Differential Revision: D18834806

fbshipit-source-id: 56ca7e03e1aa9011f836bc9c021cf3048f7dc1e4
2019-12-06 05:29:22 -08:00
Matt Galloway
d37c64c329 Flipper | Fix potential for deadlock when stopping Flipper
Summary:
There was an interesting problem in Flipper which I encountered. On closing our app we would deadlock. This was happening when joining the Flipper thread.

Upon investigation I found that it happened only when Flipper was not connected to the app. And digging in I found that it's because we are continually trying to connect the `FlipperClient` to the Flipper app when there is no connection. This works great, but it continues even if you have asked Flipper to terminate. So this meant that the `EventBase` never gets chance to shutdown, as it keeps getting new work to do.

The fix is to add a flag to `FlipperConnectionManagerImpl` to say if the conection is started or not. Then, if it's not started and we get a request to retry connection, then we will fail it.

Reviewed By: jknoxville

Differential Revision: D18780622

fbshipit-source-id: cce82cbb5c54e6d92ea16644c8a247bd2578ae26
2019-12-04 07:33:10 -08:00
Roman Rodyakin
cb3b77bc95 Avoid crashing Flipper SDK on request for unsupported plugins
Summary: in FlipperRSocketResponder::handleFireAndForget, a responder object was being conditionally (for requests with an "id" field) created, resulting in a null pointer passed into FlipperClient::onMessageReceived when no id was present. FlipperClient::onMessage received, in the meantime, unconditionally dereferences that pointer, resulting in a segmentation fault.  This change creates the responder object regardless of whether or not the "id" key is present in the request object, thus avoiding passing a null pointer into FlipperClient::onMessageReceived.

Reviewed By: jknoxville

Differential Revision: D18583898

fbshipit-source-id: 2112c45bc0cd639cec908d0039d6bdaed2f61491
2019-11-22 09:07:33 -08:00
Scott Wolchok
8dbf60e82e Add locking to FlipperState
Summary: FlipperState may be updated from multiple threads, so it needs synchronization. Note the comments in the diff about why we drop the lock before calling out to the update listener -- this can be changed if necessary in the future.

Reviewed By: jknoxville

Differential Revision: D18095471

fbshipit-source-id: 95d558394ae1a9b7583e5a61969e1eeda6448cff
2019-10-24 09:29:49 -07:00
Andres Suarez
54ebb44dda Tidy up Flipper license headers [2/2]
Reviewed By: passy

Differential Revision: D17863710

fbshipit-source-id: 5b249bdd1c06d3a526b250b035b797d0c8e796eb
2019-10-11 13:46:45 -07:00
Andres Suarez
0675dd924d Tidy up Flipper license headers [1/2]
Reviewed By: passy

Differential Revision: D17863711

fbshipit-source-id: 259dc77826fb803ff1b88c88529d7f679d3b74d8
2019-10-11 13:46:45 -07:00
Pascal Hartig
975b52d26b Build with static libc++
Summary:
This avoids having to perform gymnastics like in
https://github.com/facebook/react-native/pull/26697

Reviewed By: jknoxville

Differential Revision: D17735954

fbshipit-source-id: 507548aab89309beeb228b104a24af8acd10ce9a
2019-10-03 04:39:20 -07:00
James Donald
5bc5c34d2e Remove unused variable in catch(...) expressions
Summary:
D17629896 was intended to fix this in ovrsource, but it turns out these changes should be made on fbsource first then get synced.

The MSVC build of OculusPCSDK has numerous warnings, including these low-hanging fruit:

```
c:\open\ovrsource\xplat\omnistore\client\common\reportsubscriptionstatetiming.cpp(28): warning C4101: 'e': unreferenced local variable
c:\open\ovrsource\xplat\omnistore\client\common\databaseanalyticsmetadatatiming.cpp(23): warning C4101: 'e': unreferenced local variable
c:\open\ovrsource\xplat\omnistore\client\common\sendqueuereportbacklogtiming.cpp(32): warning C4101: 'e': unreferenced local variable
c:\open\ovrsource\xplat\omnistore\client\common\omnistore.cpp(192): warning C4101: 'e': unreferenced local variable
c:\open\ovrsource\xplat\omnistore\client\common\omnistore.cpp(907): warning C4101: 'e': unreferenced local variable
c:\open\ovrsource\xplat\omnistore\client\common\omnistore.cpp(934): warning C4101: 'e': unreferenced local variable
c:\open\ovrsource\xplat\omnistore\client\common\omnistore.cpp(946): warning C4101: 'e': unreferenced local variable
```

Clang doesn't complain, but the code is just as clear without the 'e' so best to remove.

Reviewed By: vener91

Differential Revision: D17631747

fbshipit-source-id: 0190a48e640311b40c9d1b988b0c07cfbdcfd7e5
2019-09-27 15:47:03 -07:00
John Knox
74b9ba5c40 Auto-format FlipperClient.cpp
Reviewed By: passy

Differential Revision: D17601356

fbshipit-source-id: 04701b409a838ad4dac54ae7c4f5f97cfa574dbe
2019-09-27 02:57:13 -07:00
John Knox
f72e6e0f5e Isolate background plugin initialization
Summary:
Background plugins are initialised when flipper connects.
But there's no isolation, so if any fail to initialize, then we don't carry on initializing the rest.
This fixes that by skipping failed ones only.

Reviewed By: passy

Differential Revision: D17600854

fbshipit-source-id: 2ef04cbcecda78ca448c2f4d56639ba63792e2f7
2019-09-26 07:01:40 -07:00
Chaiwat Ekkaewnumchai
88197a7076 Fix Android Connection Swap Issue (Client Side)
Summary:
- Add CSR and CSR destination to request body
- (unrelated) Rearrange the list of include files

Reviewed By: jknoxville

Differential Revision: D17346429

fbshipit-source-id: ce775998884b73e82a931f4dd8986c659a892b51
2019-09-16 05:33:19 -07:00
Pascal Hartig
23766ebf39 Remove easywsclient
Summary: This seems to be entirely unused now.

Reviewed By: jknoxville

Differential Revision: D17366175

fbshipit-source-id: f8257bc4e85785407031ed661a48b26a58927412
2019-09-13 08:56:41 -07:00
John Knox
66d9b563ce Record state error msg in debug log
Summary:
When an operation fails, we have an error message. This was being displayed in the diagnostic screen output, but not included in the debug log.

This makes them both have same bahaviour, so they both include the error messages.

Reviewed By: passy

Differential Revision: D17181847

fbshipit-source-id: 823f73d641d2315da86a0019479716852950f9a5
2019-09-04 09:29:33 -07:00
Pascal Hartig
e6e070684c Fix x86_64 / upgrade libevent (#538)
Summary:
Pull Request resolved: https://github.com/facebook/flipper/pull/538

Upgrades libevent to the August release 2.1.11.

Some notable things:

- The CMake file they ship with is actually broken. It contains a reference to an "uninstall.cmake" script that they don't include in the archive.
- There is some git magic in the CMake script which throws very annoying warnings if you're not in a git repository and if you are, it's still super useless because it assumes it's the libevent repo.
- I've removed the uninstall reference and replaced version detection magic with hardcoded values. The result is the "CMakeLists.txt" in the overrides folder. For future upgraders: You'll have to either remove the override or apply similar steps to the next release.
- The `event-config.h` is simply one of the outputs I found under `android/build/libevent/x86/include/event2/event-config.h`. They seem to be stable across architectures so it's easier to just copy it over than to fix the CMake logic that should actually pick it up from the Android build path.
- The cmake target names have changed and have an underscore in them, now.
- Verified with an SDK 28 x86_64 that this does fix https://github.com/facebook/flipper/issues/482.

Fixes GH482.

Reviewed By: jknoxville

Differential Revision: D17164731

fbshipit-source-id: 642744118065bea2674dbb0e1af91a11598066cc
2019-09-04 04:44:50 -07:00
John Knox
6eb1531aae Remove rsocket payload size assertion
Summary:
Don't fatal when trying to send a message to flipper that is too large.
Instead just continue to throw an exception, so the plugin will still be aware of the failure.

Reviewed By: cpojer, danielbuechele

Differential Revision: D17180334

fbshipit-source-id: 49c341a7cee579158be3878639083c6d19b3eaa3
2019-09-04 04:04:22 -07:00
Alexander Blom
acf7eb1080 Initialize instance to nullptr
Summary:
In tests, the instance is never initialized and it's hard to guard against null when the
instance isn't initialized to nullptr (instead being random data).

Reviewed By: ximyu

Differential Revision: D16984717

fbshipit-source-id: 414539e1117abaad16df9f9b7d3b8dbb328e38d0
2019-08-23 08:15:06 -07:00
Pritesh Nandgaonkar
7d8db465e1 Bump Folly dependency for Android (#463)
Summary:
Pull Request resolved: https://github.com/facebook/flipper/pull/463

Was made aware [here](https://github.com/facebook/flipper/issues/461) that
we currently don't build with NDK 20 because of Folly. The above issue exists only for x86 platform and not for other platform. I have updated the folly and RSocket. Although this diff doesn't solve the issue mentioned above for x86, but it updates the dependencies to the latest version. To mitigate temporarily, I have updated the gradle to not build for x86.

Reviewed By: passy

Differential Revision: D15713205

fbshipit-source-id: 79dd5825b0b876c87a1868fde8f3353a76012267
2019-06-12 03:40:19 -07:00
Rain ⁣
aa649ff48f standardize C-like MIT copyright headers throughout fbsource
Summary:
`/*` is the standard throughout open source code. For example, Firefox uses single /*: https://hg.mozilla.org/mozilla-central/file/21d22b2f541258d3d1cf96c7ba5ad73e96e616b5/gfx/ipc/CompositorWidgetVsyncObserver.cpp#l3

In addition, Rust considers `/**` to be a doc comment (similar to Javadoc) and having such a comment at the beginning of the file causes `rustc` to barf.

Note that some JavaScript tooling requires `/**`. This is OK since JavaScript files were not covered by the linter in the first place, but it would be good to have that tooling fixed too.

Reviewed By: zertosh

Differential Revision: D15640366

fbshipit-source-id: b4ed4599071516364d6109720750d6a43304c089
2019-06-06 19:40:28 -07:00
Pascal Hartig
6dda7d2b63 More headers
Reviewed By: jknoxville

Differential Revision: D15199272

fbshipit-source-id: d46355a284a6e2acdaccd622dfd4419b06e61a61
2019-05-03 12:08:04 -07:00
Pascal Hartig
f584eb05dd Another round of header updates
Summary: I hope that this takes care of all the android violations.

Reviewed By: danielbuechele

Differential Revision: D15199150

fbshipit-source-id: 0f5b4edc1bc9d38de0885f88bb2c3e43acfa09cd
2019-05-03 09:59:33 -07:00
Pascal Hartig
65d50fe120 Update license headers in xplat
Summary: Per title.

Reviewed By: danielbuechele

Differential Revision: D15166958

fbshipit-source-id: 26f0a6d7523be3192833fd3995bc9f5e948816a6
2019-05-02 05:08:54 -07:00
Pascal Hartig
1831a672b5 More copyright headers for misc stuff
Summary: Scripts and Portforwarding things.

Reviewed By: jknoxville

Differential Revision: D15164852

fbshipit-source-id: a9dcdcb5e6c19dc51d1aa0158fceafe21ab7615f
2019-05-01 08:14:55 -07:00
Pritesh Nandgaonkar
34b0cad824 Moved Flipper podspec outside (#423)
Summary:
Removed the symlink and moved `Flipper.podspec` and `FlipperKit.podspec` to the root directory. Also published `Flipper.podspec` and `FlipperKit.podspec`on cocoapods

http://cocoapods.org/pods/Flipper
http://cocoapods.org/pods/FlipperKit

Also removed the stub podspec files.

Released Flipper and FlipperKit on Cocoapods
Pull Request resolved: https://github.com/facebook/flipper/pull/423

Reviewed By: passy

Differential Revision: D15146621

Pulled By: priteshrnandgaonkar

fbshipit-source-id: 86ee16773a81b0896548169cba49810250122ec1
2019-05-01 06:06:27 -07:00
Pascal Hartig
6fa40aad77 Flipper Release: v0.20.0
Summary:
== Highlights

* Improved UI when exporting Flipper data. (45999a5292)

== Fixes

* The Shared Preference Plugin on Android will search for all shared pref files instead of only the package name by default. (825ecb8e23)
* When restarting Flipper and the previously selected plugin no longer exists, the UI would crash. (c4a8e73543)

Commit log: https://github.com/facebook/flipper/compare/v0.19.0...v0.20.0

Reviewed By: danielbuechele

Differential Revision: D14951753

fbshipit-source-id: dbafc2d41cd25b2ede218b3fe3e99745226939a9
2019-04-17 10:37:33 -07:00
Arthur Kushka
861c5077f1 Extended ConnectionMock functionality
Summary: Its helpful to store all history of sent messages for testing purposes.

Reviewed By: jknoxville

Differential Revision: D14797191

fbshipit-source-id: 0e58166cb4ab79852165f2107b2f6bcd259f1096
2019-04-05 05:40:44 -07:00
Pritesh Nandgaonkar
d044ae991f Fix the broken iOS OSS job
Summary:
Fixes the iOS OSS job which was failing. The root cause of the problem is as follows:

- RSocket was referring the master branch of rsocket/rsocket-cpp, fixed it by forking it and making its own release, unfortunately they don't make a release.
- Folly referred to the January's release. The current master branch of RSocket doesn't build with the latest release of the Folly, [this commit](b51dc569eb) is responsible for the breakage. Thus I made a Rsocket release, right before this [commit](b51dc569eb), so that it builds.Although, the current master branch of Folly builds with the current master branch of rsocket, but we will have to wait on Folly team to make a release. Once they do that I will update bit RSocket and Folly releases.

Reviewed By: jknoxville

Differential Revision: D14668686

fbshipit-source-id: 6b0362632c26355a69a3f33a031b71c88e7dd45b
2019-03-29 05:31:16 -07:00
Pascal Hartig
9ff6cfa9a4 Flipper Release: v0.19.0
Summary:
== Highlights

- **Layout 2.0**: We have a new layout inspector that was rewritten from the ground to address all sorts of small bugs that like nodes not expanding that should all be gone now.
- **New Crash Reporter**: Flipper will now detect crashes on your device and give you easy access to them through a device plugin that you can find next to logs. Learn more at https://fbflipper.com/docs/crash-reporter-plugin.html.
- **Import/Export**: You can now import and export Flipper sessions as data to share them with others. Learn more at https://fbflipper.com/docs/share-flipper-data.html.

== Fixes

- Improved error reporting for what was previously summarised under "RecurringError". (bf9be74ad2)
- Fixed an issue where the color picker could get cut off. (f9ec0cd326) (https://github.com/facebook/flipper/issues/396)

Full list: https://github.com/facebook/flipper/compare/v0.18.0...v0.19.0

Reviewed By: priteshrnandgaonkar

Differential Revision: D14665281

fbshipit-source-id: 78ed042d38642356180f25455d0d17a03ed59c6b
2019-03-28 08:29:51 -07:00
Pascal Hartig
c7633cb585 Flipper Release: v0.18.0
Summary:
= Highlights

This is a bit of a boring release, to be frank. Most of the stuff happened behind the scenes, but a lot of preparation for interesting stuff happened behind the scenes, so stay tuned!

= Fixes

- Upgraded to Electron 4.0.8 (e0127b8438)
- Fixes to node expansion in the layout inspector.
- Connectivity improvements.

See https://github.com/facebook/flipper/compare/v0.17.1...v0.18.0 for reference.

Reviewed By: jknoxville

Differential Revision: D14477605

fbshipit-source-id: 0d927ba08fa5fab9d95c76ec763f5b9dd5bc104d
2019-03-15 08:51:09 -07:00
Pascal Hartig
d025bbd0bf Flipper Release: v0.17.1
Summary:
== Bugfix Release ==

Fixes #394 in which using the network inspector can cause the plugin view to crash. Also fixes an issue where native background plugins can fail to connect (d720b20870).

Reviewed By: danielbuechele

Differential Revision: D14384823

fbshipit-source-id: 7cee49d22ec2ed8f076cf3aeb980d4ba3a273a3f
2019-03-08 04:55:40 -08:00
Pritesh Nandgaonkar
d720b20870 Solved the bug, where it didn't used to connect to Flipper
Summary:
The graphql plugin gets injected after the client is connected. In this case, earlier we didn't use to call `didconnect` assuming that it will be called when the plugin gets clicked by the user in the UI. But that is not true anymore as GraphQL plugin is a background plugin, And we don't call `didConnect` for the background plugins on the user click in the UI, as we assume that background plugins should have already received the call before.

This diff fixes the issue by calling didConnect on the background plugin which gets added after the `FlipperClient` is initialised.
{F152780726}

Look at the bug:

Reviewed By: danielbuechele

Differential Revision: D14369587

fbshipit-source-id: f75bf4e4463a31fa4735e90245c46632858a32b7
2019-03-07 14:41:28 -08:00
Pritesh Nandgaonkar
88f976b09b Flipper Release: v0.17.0
Summary:
- The Android library now uses AndroidX instead of the support-library.
- Folly and RSocket dependencies uploaded to cocoapods (f8bd473828).

- Improved Unicode support in the Network Inspector plugin (f4b2ce9a2b).
- Fixed MacOS release creation.
- Several UI fixes regarding in-app search and the toolbar.

Reviewed By: passy

Differential Revision: D14269567

fbshipit-source-id: 2d2f965316bd1ddfb375a2db48fb715095693c43
2019-03-05 06:28:26 -08:00
John Knox
85c041ff8d Change performAndReportError to handle exception pointers
Summary: Since plugins aren't under our control, they might throw exception pointers. We can still extract the useful info in this case.

Reviewed By: passy

Differential Revision: D14244362

fbshipit-source-id: 5f18100c08160e7514b3fd88ec47809cb37e9770
2019-02-28 05:39:52 -08:00
John Knox
56576a84ce Fix app crash when payload is too large
Summary:
Fixes T40544233

Exceptions should be thrown by value, not as a pointer, or else catching by reference (the recommended practice) won't work.

Reviewed By: priteshrnandgaonkar

Differential Revision: D14243337

fbshipit-source-id: 28677d7f1b3c025b67fb945f30116f3b751a89a8
2019-02-27 10:47:04 -08:00
John Knox
40ada838d7 Add isMethodSupported handler
Summary: Allows plugin to check if something is supported by that app, for example an extension command or a new feature, before trying to use it.

Reviewed By: passy

Differential Revision: D14225957

fbshipit-source-id: 3c5a29a06b56fe5f1da772824232547447872344
2019-02-26 10:08:21 -08:00
Pritesh Nandgaonkar
f8bd473828 Use Folly and RSocket from cocoapods (#379)
Summary:
I have released pods for Folly and RSocket on cocoapods. Thus we won't need to host different versions of these pods on our repository. I haven't removed those pods from `Specs` folder, as the current users of `0.16.2` would still be referring the Specs folder on the master branch. I will remove the specs folder once, all our pods are on cocoapods and we no longer need to host any pods.
Pull Request resolved: https://github.com/facebook/flipper/pull/379

Reviewed By: jknoxville

Differential Revision: D14185931

Pulled By: priteshrnandgaonkar

fbshipit-source-id: ea285024123e41c2d110827e26f79a72ef22c008
2019-02-26 04:18:00 -08:00
John Knox
5fff501d26 Don't log cert exchange connection failures
Summary: This info is still available in the diagnostic screen.

Reviewed By: passy

Differential Revision: D14164791

fbshipit-source-id: 1fc91da0b7437d530bddee6cbb5ea8c2d11f7b80
2019-02-21 10:12:04 -08:00
Pascal Hartig
4871186a77 Flipper Release: v0.16.2
Summary: This release targets the support library and target SDK v28.

Reviewed By: muraziz

Differential Revision: D14151636

fbshipit-source-id: 70f4412dc0ccba3c77dda74dcf9b143782b90713
2019-02-20 13:54:29 -08:00
Pascal Hartig
f043a3d4db Flipper Release: v0.16.1
Summary:
<Placeholder for v0.16.0 release notes>

Resubmitting as the previous release job stalled.

Reviewed By: jknoxville

Differential Revision: D14150283

fbshipit-source-id: 0357d37bf8c69accf898d2c4c81b89d0c16339c3
2019-02-20 09:29:07 -08:00
John Knox
81e8b7982b Add date and time reminder to diagnostic screen
Summary: I got tripped up again with a physical iOS device that had the wrong date and time. SSL certs won't be valid. Adds a reminder to the diagnostic screen for anyone running into this in future.

Reviewed By: passy

Differential Revision: D14132411

fbshipit-source-id: 623120ef5252eae3e2fe0f6f653074f586f17e0e
2019-02-19 10:33:25 -08:00
John Knox
9c87dfe230 Only create CSR once per app invocation
Summary: The CSR has no need to change, don't recreate it every time we need it. Useful for the physical iOS case especially, because it connects to the portforwarder and keeps attempting to send a CSR.

Reviewed By: passy

Differential Revision: D14131617

fbshipit-source-id: 82a69d5aff813d77fa05dd13fc2441b784766d99
2019-02-19 10:33:25 -08:00
John Knox
6cd8e1519f Log start of payloads that are too big to send
Summary:
We've seen some crashes from toRSocketPayload, but aren't sure of the cause.
When we fail the DCHECK, there won't be any log output, so log before it if it's going to fail.

Reviewed By: passy

Differential Revision: D14131409

fbshipit-source-id: b71e043f0b5feac3d2e44a34cc38c72086f966ad
2019-02-19 08:50:30 -08:00
Pascal Hartig
625321a8bc Flipper Release: v0.16.0
Summary:
- The Layout inspector can now visualise Litho sections.

- Stop trimming log messages so white-space-sensitive outputs (like trees) are preserved (88cc299811).
- Upgrade Flow to 0.91 (09a93cd9e6).
- Fix a screen recording bug on Pixel devices (64c8163a01).
- Watch plugin files recursively (c6752110cf).

Reviewed By: danielbuechele

Differential Revision: D14123167

fbshipit-source-id: 30cfccf5cfd767348c396401c97596342a243880
2019-02-19 07:21:44 -08:00
John Knox
77c77b5eb3 Don't throw exceptions from FlipperStep destructor
Summary: Destructors should never throw, because if they are destructed while an exception is unwinding the stack the program will terminate.

Reviewed By: passy

Differential Revision: D14124423

fbshipit-source-id: 4b3d21663d44160bf24adacca25f50522d952e7c
2019-02-19 03:46:55 -08:00
John Knox
f8ff6fe1b2 Catch all throwables in FlipperResponder destructor
Summary: Exceptions should never be thrown from destructors, because if an exception is already propogating at the time the destructor is called. Program will terminate.

Reviewed By: passy

Differential Revision: D14123526

fbshipit-source-id: 15ff74f4f14eb28a586055e1b1a5d54231b549da
2019-02-18 11:32:23 -08:00
John Knox
ff076d9dcd FlipperResponder: no response = success
Summary:
If an exception is thrown from the plugin, FlipperClient.cpp will catch it and respond with an error response.
If the object goes out of scope with no response being returned, then return a success response in the destructor.

Reviewed By: passy

Differential Revision: D14024259

fbshipit-source-id: 52e419dd23fc3882e8b92b593e8c1e1ea90e2b26
2019-02-13 05:13:42 -08:00
John Knox
0413bbd458 Add sdk_version param when connecting to flipper
Summary:
Every time an app connects to flipper, it will include its version.

With this information, the desktop app will be able to know how to communicate with it (or even whether it still can - and show an error message if not).

Reviewed By: passy

Differential Revision: D14008785

fbshipit-source-id: ac4dfd52da4bc6a2b90ec09a8e619086b7cd4a59
2019-02-11 14:06:56 -08:00
John Knox
5da8f35ee3 Don't use private access in FlipperRSocketResponder
Summary:
Changing FlipperRSocketResponder to only use public parts of FlipperConnectionManagerImpl.

This means we can test it by injecting a FCM mock, and it can use its public interface.

Reviewed By: passy

Differential Revision: D14000078

fbshipit-source-id: c0431a888b0ca041807631c81b99fb8b947274d6
2019-02-11 14:06:56 -08:00
John Knox
c48c1a728a Extract Responder class out of FlipperConnectionManagerImpl
Summary:
For one thing, this file is too big so it's good to split it up.

Also, having this responder defined in the .cpp file makes it hard to test. Extracting it for testability.

Reviewed By: passy

Differential Revision: D14000079

fbshipit-source-id: 8da4e0e325f48c0ada8efc7cd6fffcb3440c6e26
2019-02-11 14:06:56 -08:00
John Knox
4a3de26a88 Add requestResponse handler for incoming calls
Summary:
Flipper exposes a call() api to plugins which lets them call their sdk component, and it returns a promise with the response.
Currently this is done by sending a fireAndForget request, noting the id of the request, and then receiving fireAndForget requests and matching up the ids to give the result back to the right plugin promise.

Instead, it will be simpler to use rsocket requestResponse, instead of fireAndForget, which is for this exact use case. This diff adds a requestResponse handler to the SDK, so that it can deal with such requests and respond accordingly, while preserving the current functionality if it receives a fireAndForget.

So this part is backwards compatible and should be safe to land in isolation.

A later diff will change the desktop app to use requestResponse, which may not be backwards compatible, so that will have to be deployed more carefully.

Reviewed By: passy

Differential Revision: D13974049

fbshipit-source-id: b371d94a86b1f186375161ed8f2242a462ce418f
2019-02-11 14:06:55 -08:00