Commit Graph

74 Commits (9b915b3d36382b19b2717a1858a4178e70cabeaf)

Author SHA1 Message Date
Nelson R. Perez 606f7c183e Fixed a concurrency problem
Introduced some synchronized methods and a block in order to prevent an aparent concurrency problem with the variable 'mSelectedNode' at the NetworkService class.
2019-07-12 17:51:50 -05:00
Nelson R. Perez 7a5a975e4b Renamed method and changed its functionality
- Renamed the 'removeCurrentNodeAndReconnect' as 'reconnectNode' since it will not be removing nodes from the list anymore
- Adapted the sample app to work accordingly
2019-06-24 16:07:11 -05:00
Nelson R. Perez 2a64a9ec22 Merge branch 'develop' of github.com:Agorise/graphenej into develop 2019-06-21 21:08:39 -05:00
Nelson R. Perez d605a47e0e Reducing the initial connection time from 2000 to 500 ms 2019-06-21 21:02:55 -05:00
Severiano Jaramillo 1f0d616744 Modify autoConnect and verifyLatency behavior
- Added a check to make sure autoConnect=false and verifyLatency=false throw an exception, since that combination would cause the app to never connect to a node.
- Separeted the verifyLatency and autoConnect logic, so that the apps using NetworkService can decide wether to connect or not automatically, independently of verifying the latency.
2019-06-17 16:53:35 -05:00
Nelson R. Perez 562955586b Preventing a potential problem at the NetworkServiceManager and introducing some getters
- Preventing accidentally calling the 'bindService' twice at the NetworkServiceManager
- Providing a getter for the node list at the NodeLatencyVerifier
- Created a getter for the NodeLatencyVerifier at the NetworkService
2019-06-13 07:49:36 -05:00
Nelson R. Perez b032db80bc Preventing a NPE
- We're now checking that there is a selected node before trying to use it, and in case there is none we schedule a
retry in DEFAULT_INITIAL_DELAY ms.
2019-06-06 15:59:55 -05:00
Severiano Jaramillo b5e2961834 Convert NetworkService's sendMessage to synchronized, to guarantee thread safety: to avoid issues when calling that method from different threads. 2019-05-22 13:48:49 -05:00
Nelson R. Perez d72e608807 - Added the required deserialization logic to parse the response to the 'get_objects' API call with an asset bitasset data type
- Removed unresponsive node URLs from the sample app
2019-04-04 15:12:09 -05:00
Nelson R. Perez f11aff72e6 Using existing instance of Handler instead of creating a new one 2019-02-13 23:30:49 -05:00
Severiano Jaramillo 13faf6c253 Merge branch 'develop' of github.com:Agorise/graphenej into develop 2019-01-12 17:37:08 -06:00
Severiano Jaramillo f4be0fa596 Add a public method to obtain the currently selected node: getSelectedNode() 2019-01-10 14:20:31 -06:00
Nelson R. Perez 1c261746a2 Clearing the map between request id and the ApiCallable class because when we disconnect from one node, all previous message ids should be reset 2018-12-31 13:34:10 -05:00
Nelson R. Perez 7a02e335a0 Setting write and read timeout to 5 seconds at the NetworkService 2018-12-26 17:47:59 -05:00
Nelson R. Perez 201d6957f8 - Added support for the "get_transaction" API call for the single-connection mode
- Overrided the toString method of the Transaction class
2018-12-26 17:45:41 -05:00
Nelson R. Perez 3b298ebf6b Merge branch 'develop' of github.com:Agorise/graphenej into develop 2018-12-19 12:50:55 -05:00
Nelson R. Perez b54ae2cbae Added support for the 'get_assets' API call on the single-connection mode 2018-12-19 12:49:04 -05:00
Severiano Jaramillo 91a5ecdd7b Avoid NPE related carsh in NetworkService when trying to add a very high latency to a malfunctioning node. 2018-12-15 08:51:01 -06:00
Nelson R. Perez 843aacb859 Preventing a NullPointerException while handling a node disconnection 2018-11-15 17:54:57 -05:00
Severiano Jaramillo b6aab142b6 - Added a method to remove nodes from LatencyNodeProvider and implemented a HashSet to keep track of such removed nodes. The reason is that calls to this class are asynchronous and only removing a node from the mFullNodeHeap was not enough to guarantee that it was not going to be added again.
- Added a isRemoved variable to FullNode class, so that the object can carry itself the removal status information and be able to use the same publish subject to broadcast the status of the FullNode.
- Added a method to remove nodes from NodeLatencyVerifier, removed such nodes from pending node latency measurements map 'nodeURLMap' and publish/broadcast the FullNode information with isRemoved=true so that components listening can act accordingly.
- Make proper changes to sample app's RemoteNodeActivity so that it removes 'removed' nodes from the list.
2018-11-08 15:14:01 -06:00
Severiano Jaramillo dee17a12be Moving away of NetworkService and graphenej in general the decision to close connection to the current node and retry with another one just because the node does not provide the info needed in PalmPay. Graphenej has to be as app agnostic as possible so a new public method 'removeCurrentNodeAndReconnect()' was implemeted to do the removal and reconnection, and the app that uses graphenej has to decide by its own metrics to remove the current connected node and call such public method. 2018-11-07 21:20:36 -06:00
Severiano Jaramillo 214891fcc9 Added proper methods to deal with bitshares nodes that send 'trash info', which are nodes that potentially do not have installed the history plugin and thus do not respond properly to history related requests. As this information is needed for PalmPay we cannot rely on such nodes and have to try to connect to a different node. 2018-11-07 16:22:29 -06:00
Severiano Jaramillo 76713f0623 Merge branch 'develop' of github.com:Agorise/graphenej into develop 2018-11-06 11:37:08 -06:00
Severiano Jaramillo c6cd21cdf0 Fix crash in NetworkService due to components other than NetworkServiceManager binding to the service without the proper initialization information. This initialization was moved to another method named bootstrapService which is only called from NetworkServiceManager after the NetworkService has been properly connected. 2018-11-06 11:36:11 -06:00
Nelson R. Perez f940d49cfc Added support for the 'get_account_balances' API call in the single-connection mode 2018-11-01 16:54:03 -05:00
Nelson R. Perez d66c8f0ff8 Removed unneeded log 2018-10-24 19:52:50 -05:00
Nelson R. Perez 8fb9bc57d6 Automatically trying to connect to the best node after DEFAULT_INITIAL_DELAY milliseconds, regardless of the completion of the node latency verifications 2018-10-19 00:10:11 -05:00
Nelson R. Perez a5f0ba1345 Merge branch 'develop' of github.com:Agorise/graphenej into develop 2018-10-18 18:00:19 -05:00
Nelson R. Perez 63eebf11c4 Exposing an interface that allows the fine tuning of the alpha parameter used to calculate the exponential moving average of measured latencies 2018-10-18 17:36:34 -05:00
Nelson R. Perez 3a19808ac5 Moved the node list information out of the library, this must be provided by the application now 2018-10-18 12:14:05 -05:00
Nelson R. Perez d25a1f3fa0 Reduced the connection timeout from the default of 10 seconds to 2 seconds 2018-10-12 18:36:11 -05:00
Nelson R. Perez b361cf5830 Added support for the 'get_key_references' API call in the single-connection mode 2018-10-08 19:55:49 -05:00
Nelson R. Perez 2618a6a3a0 Merge branch 'develop' of github.com:Agorise/graphenej into develop 2018-10-04 13:44:11 -05:00
Nelson R. Perez 5a113ad7cc Added support fot the get_dynamic_global_properties API call in the single-connection mode 2018-10-04 10:13:55 -05:00
Nelson R. Perez 25b7e6c8c6 Adding a very high latency to nodes that fail their connection 2018-10-02 01:35:53 -05:00
Nelson R. Perez 5ef4ebfca7 Preventing a NullPointerException by checking the nodeLatencyVerifier reference first 2018-10-01 23:58:03 -05:00
Nelson R. Perez d109d86bf3 - Storing connectivity status at the FullNode class
- Flipping this flag accordingly at the NetworkService whenever we connect/disconnect from a specific node
- Notifying the NodeLatencyVerifier of this change
2018-09-26 17:17:31 -05:00
Severiano Jaramillo 3bdfb777bf Avoid adding repeated nodes to the list of nodes in NetworkService. 2018-09-26 12:05:00 -05:00
Nelson R. Perez e107c014f0 The network service will retry a connection after 5 seconds in case of socket failure 2018-09-23 20:50:39 -05:00
Nelson R. Perez 35570cb4a6 Fixing a potential NullPointerException at the NetworkService 2018-09-21 13:29:47 -05:00
Nelson R. Perez ede7265989 NodeLatencyVerifier
- Using an HttpUrl instance as a key to the map of FullNode instances, we were using simple String here before, but turned out not to be too reliable

NetworkService
- Introducing the NodeLatencyVerifier instance into the NetworkService, and making its use optional
- In case the user opts to use the node-latency verification, the initial connection is delayed until we obtain a measurement of all nodes
- Exposing a PublishSubject, this allows users of the library to get notified of the node latency measurements

NetworkServiceManager
- A boolean flag is now used to decide whether or not to start a NetworkService instance with the node-latency verification feature ON
2018-09-20 21:51:14 -05:00
Nelson R. Perez 776630dd57 - Introduced some instrumented test dependencies
- Fixed a problem in the LatencyNodeProvider#updateNode(FullNode) method
- Fixed a bug in the LatencyNodeProvider#getSortedNodes() method
- Introducing the NodeLatencyVerifier class
2018-09-20 16:21:25 -05:00
Nelson R. Perez ccf61858e4 Modified the NetworkService and the NetworkServiceManager classes in order to pass arguments to the service via Intent extras and to allow delayed network connection 2018-09-19 16:44:26 -05:00
Nelson R. Perez 6a2939ab20 Added a getter and setter to the mNodeUrls private attribute of the NetworkService class 2018-09-17 12:21:48 -05:00
Nelson R. Perez 9329d59ce7 Moved the Memo class 2018-09-17 12:19:22 -05:00
Nelson R. Perez 66b0ce7cc1 Removed unused log 2018-09-17 12:13:19 -05:00
Nelson R. Perez 39048b1096 Adding the de-serializer of the BaseOperation class to the Gson instance used to handle the notification message 2018-09-06 23:30:59 -05:00
Nelson R. Perez 6abd71252e Added support for the 'get_full_accounts' API call in the single connecton mode 2018-09-06 18:09:18 -05:00
Nelson R. Perez 229590457b - Added support for the 'get_account_history_by_operations' API call
- Introduced a test case for the de-serialization of the HistoryOperationDetail object instance
- Making the sample app use the newly introduced 'get_account_history_by_operations' API call
2018-09-05 21:04:46 -05:00
Nelson R. Perez f8326093a2 Adjusted code in order to broadcast internally responses with empty results, which were skipped before 2018-08-31 18:11:57 -05:00