Commit Graph

250 Commits

Author SHA1 Message Date
Yevgeniy Miretskiy
963a59176f Classes with virtual methods ought to have virtual destructor
Summary: Classes with virtual methods (include pure virtual) should have virtual destructor.

Reviewed By: jknoxville, scottrice

Differential Revision: D10241087

fbshipit-source-id: c7d0d27e28da91648cda7bffb4f1a8772833332c
2018-10-09 09:55:47 -07:00
Alex Langenfeld
a54b542d17 use portable SysStat.h
Summary: for Windows

Reviewed By: passy

Differential Revision: D9886244

fbshipit-source-id: d82b4a76efd1c200096bb6d3573b527ba058bf0b
2018-10-03 14:29:59 -07:00
Pascal Hartig
fe0d1909cf Flipper Release: v0.8.1
Summary: Patch release to fix Android native library crashes.

Reviewed By: jknoxville

Differential Revision: D10084446

fbshipit-source-id: d40c47f91aa88d7a60b2d355ebdc7c14ffa77bbf
2018-09-27 08:27:08 -07:00
Pritesh Nandgaonkar
7e296467d2 Flipper Release: v0.8.0
Summary: New 0.8.0 release which includes name changes from sonar to flipper.

Reviewed By: passy, danielbuechele

Differential Revision: D10050160

fbshipit-source-id: 5394ea0d032cea39f40cc9ed8e0f054e506d4f04
2018-09-26 06:59:09 -07:00
Pritesh Nandgaonkar
ddcc74edb8 Update release script to accomodate name change
Summary: As per the title

Reviewed By: danielbuechele

Differential Revision: D10050043

fbshipit-source-id: 7e3744fd9d2224456515cfa7187faebbf1541fa6
2018-09-26 06:59:09 -07:00
John Knox
a19862d7a2 Cleanup "sonar" from logs
Summary: Flipper logs already get "Flipper" prepended.

Reviewed By: passy

Differential Revision: D10028565

fbshipit-source-id: d3e84bba64044275da0145db6e804dc8eb3a44b7
2018-09-25 07:57:34 -07:00
John Knox
f35ca982bf Change CSR subject from sonar to flipper
Summary: This shouldn't have any effect on anything, it doesn't need to be any particular value.

Reviewed By: danielbuechele

Differential Revision: D9944462

fbshipit-source-id: f84c70b3cd18fdfe1d41f07b5b0ede2fdec3f44a
2018-09-25 04:57:48 -07:00
John Knox
1a076f1300 Rename C++ fields and internal methods
Summary: From sonar* to flipper*.

Reviewed By: priteshrnandgaonkar

Differential Revision: D9944461

fbshipit-source-id: 870997e3d1d5aaef73dd445e6d94615f93fe6abc
2018-09-25 04:57:48 -07:00
Pascal Hartig
c7b0d419cb Rename libsonar* to libflipper*
Summary: Rename the native libraries.

Reviewed By: priteshrnandgaonkar

Differential Revision: D10009245

fbshipit-source-id: 987c4fdb1acc21abbbecfb3db8a672f4aa4e499d
2018-09-25 04:02:29 -07:00
Pascal Hartig
656f7cc626 Fix xplat build
Summary: We are referencing a no longer existing folder.

Reviewed By: priteshrnandgaonkar

Differential Revision: D10009244

fbshipit-source-id: 710c363fdeaf4f8621eb5f5d0bde2cbd4295ae64
2018-09-24 07:50:39 -07:00
John Knox
c4d12c21d9 Rename Mock classes
Summary: Part of sonar to flipper rename

Reviewed By: priteshrnandgaonkar

Differential Revision: D9929102

fbshipit-source-id: 88cdbd33aa5c76e386449f54f4eb8c6435865ed1
2018-09-24 07:00:45 -07:00
John Knox
c18c8ac802 Rename Sonar Tests
Summary: Part of sonar to flipper rename

Reviewed By: passy

Differential Revision: D9929101

fbshipit-source-id: f33e1ac7f88fbe88a9d48180d064b596603a3c58
2018-09-24 07:00:44 -07:00
John Knox
8ae77810d9 Rename SonarStep
Summary: Part of sonar to flipper rename

Reviewed By: passy

Differential Revision: D9920275

fbshipit-source-id: 02f97d1e51d58864283d26e8d3a724cac973e938
2018-09-24 06:03:51 -07:00
John Knox
c1295b1bc9 Rename SonarState* to FlipperState*
Summary: Part of sonar to flipper rename

Reviewed By: passy

Differential Revision: D9919821

fbshipit-source-id: a44a2a04d5463750f884f8bf1328e02d56593e82
2018-09-24 06:03:51 -07:00
John Knox
1d2793f701 Rename SonarWebSocket
Summary:
Part of Sonar -> Flipper rename.
It's about time this is renamed from *Websocket as well, since it doesn't use websockets anymore.

Reviewed By: passy

Differential Revision: D9919695

fbshipit-source-id: 78a63bfb7d5de19c093b7fb775d1426b4fc58f77
2018-09-24 06:03:51 -07:00
John Knox
2a822a1b99 Rename SonarResponderImpl
Summary: Part of sonar -> flipper rename

Reviewed By: passy

Differential Revision: D9918894

fbshipit-source-id: 066042b18e68a4e92308388e4cc7a29584010111
2018-09-24 06:03:51 -07:00
John Knox
5350d3ce7a Rename C++ SonarPlugin class
Summary: Part of sonar -> flipper rename

Reviewed By: passy

Differential Revision: D9917615

fbshipit-source-id: e59f43bf003d30ae6be4d95bc4a21c92ab39f732
2018-09-24 06:03:50 -07:00
John Knox
574c05c41d Rename SonarInitConfig
Summary: Part of sonar -> flipper rename

Reviewed By: priteshrnandgaonkar

Differential Revision: D9908472

fbshipit-source-id: f2e694b5abfa22a745ee4719d24d6aad8af6ee2a
2018-09-20 17:06:55 -07:00
John Knox
9889df3f3c Rename SonarConnection to FlipperConnection
Summary: Part of Sonar -> Flipper rename

Reviewed By: passy

Differential Revision: D9907353

fbshipit-source-id: 01f7bb84da1c27fd68d608151f437a18b6eaaa4e
2018-09-20 17:06:54 -07:00
John Knox
3c656de7fa Rename SonarClient to FlipperClient
Summary: Part of the Sonar -> Flipper rename

Reviewed By: passy

Differential Revision: D9871902

fbshipit-source-id: 4b64953cb1a64235d47caaf0fabfb560bb85f7a2
2018-09-20 17:06:53 -07:00
John Knox
df8763e697 Move xplat/sonar/xplat/Sonar* to Flipper*
Summary:
Part of the Sonar -> Flipper rename
Intentionally left externally visible buck target as Sonar for now to minimize diff size.

Reviewed By: passy

Differential Revision: D9871684

fbshipit-source-id: 6926eb62c578a05cd895745c75ed7da3cfe965b5
2018-09-20 15:39:57 -07:00
Pascal Hartig
cc6f28f7c4 Link static libraries statically (#277)
Summary:
Pull Request resolved: https://github.com/facebook/flipper/pull/277

Link all dynamically loaded libraries statically with the exception of libevent.

Reviewed By: jknoxville

Differential Revision: D9967422

fbshipit-source-id: b33cec5da0c2b34f47217353f205b9d77f1acae2
2018-09-20 09:35:19 -07:00
Pritesh Nandgaonkar
e763c5cd15 Suppress crash due to Flipper Plugins
Summary: This diff wraps the call to refresh plugins in `performAndReport`. All the important methods are already wrapped in this function. This diff also logs the error in the standard error if the connection is not established. With this diff the iOS app should not crash due exceptions thrown in iOS and cpp code. For android the app won't crash due to exception of cpp but can crash due to exceptions thrown in java code of the plugin

Reviewed By: jknoxville

Differential Revision: D9848112

fbshipit-source-id: 689ef9240e47400e8ce8c89b4c0ccec43d2180f9
2018-09-20 03:57:13 -07:00
Daniel Büchele
0d33f7afd6 revert CA file name to sonar
Summary: as per title

Reviewed By: jknoxville

Differential Revision: D9927180

fbshipit-source-id: d4e0a6e3da4babeda4a04c1081878b962a091c3f
2018-09-18 17:27:21 -07:00
John Knox
9d9fa17134 Rename all The c++ JNI classes
Summary: Pull Request resolved: https://github.com/facebook/flipper/pull/272

Reviewed By: passy

Differential Revision: D9861432

Pulled By: jknoxville

fbshipit-source-id: 523b8fc28541b922bbcc0939514f4ddd0a3fc1b0
2018-09-18 07:27:28 -07:00
John Knox
a480be90a2 Rename facebook::sonar namespace
Summary: Pull Request resolved: https://github.com/facebook/flipper/pull/271

Reviewed By: passy

Differential Revision: D9861393

Pulled By: jknoxville

fbshipit-source-id: d65f751c35028748915023f33f273d6ec45863c8
2018-09-18 07:27:28 -07:00
Daniel Büchele
3e4c24d6fe certificateProvider
Summary: rename certificate provider

Reviewed By: passy

Differential Revision: D9871288

fbshipit-source-id: 001a61416af23d89e63374cccc3df256b55eb6d2
2018-09-18 07:01:17 -07:00
Pritesh Nandgaonkar
bc3ccfce5d Flipper Release: v0.7.2
Summary: New Flipper Release

Reviewed By: passy

Differential Revision: D9850680

fbshipit-source-id: 50a8251fd2ddc2c6ca57f8a87ee1943f46f7559d
2018-09-17 05:57:32 -07:00
Pritesh Nandgaonkar
0ac03b74cc Flipper Release: v0.7.1
Summary: Flipper Release: v0.7.1

Reviewed By: jknoxville

Differential Revision: D9829332

fbshipit-source-id: fb8099a16d6bc3e68be7d0e69fdeb69281492ea6
2018-09-14 05:41:58 -07:00
Pritesh Nandgaonkar
9a16d9cbad Update rsocket version
Summary: Updates rsocket version

Reviewed By: passy

Differential Revision: D9769468

fbshipit-source-id: b822e697446b1464b63206869726e0e086438134
2018-09-13 03:12:35 -07:00
Pritesh Nandgaonkar
27cbf7f995 Flipper Release: v0.7.0
Summary: New release

Reviewed By: passy

Differential Revision: D9789625

fbshipit-source-id: 799206eafa0db54bdcb67de3854dba395326de7c
2018-09-12 09:13:35 -07:00
John Knox
869c785c71 Store empty connection_config in legacy CSR requests
Summary:
Versions of flipper from before 7th August 2018 don't return any response, so we don't store any connection_config.json file.
To keep the functionality the same as with up-to-date app versions, when this happens, store an empty config file ("{}").

Reviewed By: danielbuechele

Differential Revision: D9682885

fbshipit-source-id: fd580f6bba6b6b20135aa2c076be10e1eea0f8bc
2018-09-06 10:13:25 -07:00
John Knox
d16fd8cfae Handle json parse failures
Summary: Loading the deviceId is not critical, so if it ever fails, we can live with that by swallowing the exception and using the default (possibly 'unknown' deviceId).

Reviewed By: danielbuechele

Differential Revision: D9682886

fbshipit-source-id: e5d60dd262fce683dd444167edd1475e0c029759
2018-09-06 10:13:25 -07:00
John Knox
9939a9e3bb Factor out SONAR_LOG
Reviewed By: passy

Differential Revision: D9555739

fbshipit-source-id: 022763ea03047e1c4cd88d5f389b66be4cbe416b
2018-09-03 11:12:28 -07:00
John Knox
243b4207e7 Change string macros to static constexpr
Summary: There's no need for these to be macros.

Reviewed By: priteshrnandgaonkar

Differential Revision: D9555471

fbshipit-source-id: a78d6cdb4ceb1830f749eda50e0e07ebc55723bf
2018-09-03 11:12:28 -07:00
John Knox
afea2f63ec Extract file system interaction from SonarWebSocketImpl
Summary:
SonarWebSocketImpl has got pretty bloated. So I'm extracting all the file interaction out of it into
ConnectionContextStore. The purpose of this class is to provide all the context needed to establish a connection.
This makes SonarWebSocketImpl more functional and therefore testable.

Reviewed By: priteshrnandgaonkar

Differential Revision: D9540089

fbshipit-source-id: 0cd1d69f2b11eaf9f569245a2da14f85cc140427
2018-09-03 11:12:28 -07:00
John Knox
a5af72a169 Reject null event base arguments
Summary:
If you use a null eventbase, folly implicitly decides which one to run the futures in, for example
the timekeeper thread.
The only component that passes in event bases is sonar.cpp.

Reviewed By: priteshrnandgaonkar

Differential Revision: D9539443

fbshipit-source-id: 7fd7289257c84b039a7ac00b14f78bb271262480
2018-09-03 11:12:28 -07:00
John Knox
edff177c3f Give serial to the device during cert exchange so it can provide it whenever it connects
Summary:
Android devices don't always know their own serial.
But we do a certificate exchange using adb from the desktop, so we can provide it in the response.

After this the client will provide it every time it connects, so we can do things like filter plugins by device id.

For apps that have already done cert exchange, they'll continue to use 'unknown' as their id until they do it again with an up to date version of sonar.
We can think about forcefully stopping that, but I haven't done it.

Reviewed By: danielbuechele

Differential Revision: D9481460

fbshipit-source-id: f8932699711ebbec4260fabe32f87e6cdff920f2
2018-08-31 08:12:56 -07:00
Pascal Hartig
02cf3a90a2 Fix build caching (#242)
Summary:
See https://github.com/facebook/flipper/issues/230 for a longer
explanation.

It turns out that many of the tasks in `native.gradle` (at least
`prepareGlog` which modifies files inside the source directory, but also
others) cause the cmake cache to invalidate.

Because we run those tasks unconditionally, we need to recompile all our
C++ code even when unmodified.

I fix this by adding a manual cache key to this which simply skips all
the tasks unless an up-to-date `external_cache_revision.txt` is found.
This is a bit hacky, but the alternatives are a) convincing cmake that
these modifications are not recompile-worthy which I have no idea how to
do and which might be impossible to do `mtime` on the files touches, or
b) having fine-grained `onlyIf` rules for every task which can easily
break. This seems the most straight-forward option.

Fixes #230.
Pull Request resolved: https://github.com/facebook/flipper/pull/242

Reviewed By: jknoxville

Differential Revision: D9381340

Pulled By: passy

fbshipit-source-id: a7db55aacac4a29076c29298d6c5b97d8bc91f66
2018-08-20 07:43:47 -07:00
Aaron Brady
e9471c7197 fix crash if SonarClient is stopped with no connection
Summary: calling SonarClient::instance()->stop() without a connection will try to deref a null client_

Reviewed By: jknoxville

Differential Revision: D9325527

fbshipit-source-id: b0a81d6eb9d1375b74cbf10466f947e8a2de3b98
2018-08-17 10:14:10 -07:00
John Knox
e76a6ef529 Document SonarStep.h
Summary: It may not be immediately obvious how this works, so adding comments.

Reviewed By: passy

Differential Revision: D9333321

fbshipit-source-id: 79740b3d2a9589b3ba48c47b0068afdaf26f35a3
2018-08-15 06:12:30 -07:00
John Knox
38391ca29e Allow steps to fail with error message
Summary:
Add a method to add error messages into failed steps. This will be surfaced in the diagnostic screen, to help the user
troubleshoot.

Reviewed By: passy

Differential Revision: D9333322

fbshipit-source-id: 5f1e55c3d71b19292dbc428aaecfbd41e7a75125
2018-08-15 06:12:30 -07:00
John Knox
dfcfa9f7fa Handle socket not open error individually
Summary:
It's expected that whenever not connected to a desktop, or when the sonar desktop app isn't running, we'll get
errors connecting. Isolate these so we can treat all other exceptions properly.

Reviewed By: passy

Differential Revision: D9333323

fbshipit-source-id: c9853ca84d1a04827ebf7bae0fe87859ca6110d1
2018-08-15 06:12:29 -07:00
John Knox
660da3f80e Add getStateSummary method for diagnostics
Summary:
Adds a more structured representation of state updates than a multiline string.
Also changes the string form to omit [started] records.

Reviewed By: danielbuechele

Differential Revision: D9315503

fbshipit-source-id: 55b8f9572091fd42fe852c8d26a8f2a53f76c82a
2018-08-15 05:11:54 -07:00
John Knox
a35765335e Wait for server when requesting certificate files
Summary:
NOTE: Second push of the same commit. The original was reverted because of an incompatibility with
the rsocket version used in the OSS build, which is now fixed.

[Step 2 of a protocol change between desktop app and agent]

The flipper agent periodically tries to connect.
When it doesn't have the required certs, instead of trying to connect, it requests them from the desktop.
After requesting, it just continues the loop, trying to request.

The problem with that is
a) the desktop can take longer than one cycle to generate and provide the certs, meaning the agent will make overlapping requests, causing confusion and it to take longer than necessary.
b) the desktop can take less time than a retry cycle, but the agent will still wait before trying to connect.

Fixing a) by making the agent wait for a response from the desktop before continuing attempting to reconnect.
This means on the next connection attempt, it's guaranteed that the desktop is finished processing the CSR.

b) remains unfixed for now, but can be dealt with separately.

This changes the agent to use requestResponse, instead of fireAndForget and wait for a response from Flipper before continuing.

Also added a fallback to detect old versions of Flipper/Sonar and use the oldFireAndForget method in those cases.

Reviewed By: danielbuechele

Differential Revision: D9315946

fbshipit-source-id: 8058f7d43690ba609f16a61c0a9b40991e9e83cc
2018-08-14 11:12:21 -07:00
Pritesh Nandgaonkar
3a584d0f18 Update rsocket version (#225)
Summary:
Updates rsocket to latest version
Pull Request resolved: https://github.com/facebook/flipper/pull/225

Reviewed By: jknoxville

Differential Revision: D9313576

Pulled By: priteshrnandgaonkar

fbshipit-source-id: afd55eddfa79f0f9d2a36a6f0539d823161d1bed
2018-08-14 06:01:00 -07:00
Pascal Hartig
229049b281 Back out "[flipper] Wait for server when requesting certificate files"
Summary:
This breaks in open source due to a missing rsocket symbol and
blocks our legocastle task.

Closes https://github.com/facebook/flipper/issues/224

Original commit changeset: e782b303b5e4

Reviewed By: jknoxville, danielbuechele

Differential Revision: D9289450

fbshipit-source-id: b780c300394f5793e95ef2fb6b0e6ba0150caf9a
2018-08-13 02:41:49 -07:00
John Knox
800302b433 Call onDisconnect callbacks when disconnected
Summary: I noticed from the diagnostics screen that onDisconnected was never being called when sonar disconnects.

Reviewed By: danielbuechele

Differential Revision: D9265562

fbshipit-source-id: afd070126c6ef02a98c8dbc6589b6f9b8b83a730
2018-08-10 09:13:27 -07:00
John Knox
6dd97f58ef Wait for server when requesting certificate files
Summary:
[Step 2 of a protocol change between desktop app and agent]

The flipper agent periodically tries to connect.
When it doesn't have the required certs, instead of trying to connect, it requests them from the desktop.
After requesting, it just continues the loop, trying to request.

The problem with that is
a) the desktop can take longer than one cycle to generate and provide the certs, meaning the agent will make overlapping requests, causing confusion and it to take longer than necessary.
b) the desktop can take less time than a retry cycle, but the agent will still wait before trying to connect.

Fixing a) by making the agent wait for a response from the desktop before continuing attempting to reconnect.
This means on the next connection attempt, it's guaranteed that the desktop is finished processing the CSR.

b) remains unfixed for now, but can be dealt with separately.

This changes the agent to use requestResponse, instead of fireAndForget and wait for a response from Flipper before continuing.

Also added a fallback to detect old versions of Flipper/Sonar and use the oldFireAndForget method in those cases.

Reviewed By: passy

Differential Revision: D9179393

fbshipit-source-id: e782b303b5e441f7d6c7faa3e5acdcbfb51e5e9c
2018-08-10 07:28:13 -07:00
John Knox
a0b9d23d40 Add state annotations in SonarWebSocketImpl
Summary: These will be displayed in the sonar diagnostics screen, for troubleshooting connection issues.

Reviewed By: danielbuechele

Differential Revision: D9150552

fbshipit-source-id: c6d65fba86e7564fbb004aaa7b0303a1d5952e5d
2018-08-07 09:59:27 -07:00