Commit Graph
48 Commits
Author SHA1 Message Date
Adrien Béraud 96c60d39ed proxy server: reschedule after using function 2018-06-12 18:19:12 -04:00
Sébastien Blin aef8aa545b proxy: reschedule printStatsJob 2018-06-06 12:08:31 -04:00
Adrien Béraud 07bed77714 proxy server: schedule task from outside thread 2018-06-05 19:43:56 -04:00
Adrien Béraud aa202b2cd8 dhtrunner: add getNodeInfo()
Allow to retrieve all dht stats in a single API call using
the new method getNodeInfo() and the JSON-serializable
new structure NodeInfo.
2018-06-05 19:43:56 -04:00
Sébastien Blin 709a2c7b7c dht_proxy_server: avoid mutex when getting /
The dht_proxy_server should be always up, so getNodesStats will
be pretty always up-to-date. We can add it into a job and avoid
to wait for this method to finish (and this method use an
internal lock) to have a quick answer about the status of the proxy.

Note: the update is forced during the initialization of the proxy
2018-05-30 14:25:46 -04:00
Adrien Béraud b2ba1ca002 proxy server: close socket if no token 2018-05-17 11:33:32 -04:00
Adrien Béraud 6a981772fd proxy server: cleanup 2018-04-21 17:57:59 -04:00
Adrien Béraud c6cef856f0 proxy server: cleanup 2018-04-21 12:23:33 -04:00
Sébastien Blin 9421984a89 proxy: cancelPushListeners using clientId instead of token
All listeners uses a token equals to 0, we need to identify listeners
with client_id instead of a token.
2018-04-20 16:37:12 -04:00
Sébastien Blin 37ef1c2cff proxy: set clientId to listener
clientId was not properly set. so every time someone launch a node
and do a listen on a hash, a new listener is generated and it results
by flooding the node of push notifications.
2018-04-20 16:19:03 -04:00
Sébastien Blin 0a04a7f28d proxy: unsubscribe is now valid with token equals 0
Because we now have one listener for each client by hash, the token
is unnecessary here. Moreover, this check is invalid cause we use
a token equal to 0.
2018-04-20 15:25:57 -04:00
Adrien Béraud da1b7d4615 proxy server: send refresh notification with margin 2018-04-16 15:05:28 -04:00
Adrien Béraud abb9f9291b proxy server: avoid unneeded copy 2018-04-14 18:15:02 -04:00
Adrien Béraud e533f5686e proxy server: use std::lock to avoid deadlock 2018-04-14 18:14:42 -04:00
Adrien Béraud 4234908b69 proxy server: check refresh job 2018-04-13 15:59:46 -04:00
Adrien Béraud c10c4251b0 proxy server: print stats to stdout once in a while 2018-04-13 15:52:56 -04:00
Adrien Béraud 8b90c47379 proxy server: add logs 2018-04-13 15:06:49 -04:00
Adrien Béraud a48a965c1a proxy server: catch exceptions in requests, always close connection 2018-04-13 14:01:09 -04:00
Adrien Béraud e088cd10be proxy server: keep only one push listener per token.key.clientId 2018-04-10 16:01:14 -04:00
Adrien Béraud 7b88a2122a proxy: always use string tokens 2018-04-10 12:48:19 -04:00
Sébastien Blin 5b71af3cec proxy: remove useless callback_id
callback_id was used for token problems which are not present anymore.
Now token is sufficient and we can remove callback_id.
2018-04-03 10:43:56 -04:00
Sébastien Blin 62bbce76f2 scheduler: avoid overflow causing 100% cpu usage 2018-03-29 11:40:04 -04:00
Adrien Béraud 0edee443f5 cache: improve value expiration handling 2018-03-28 09:54:04 -04:00
Sébastien Blin fcac10c4c8 proxyserver: fix cancelListen and reduce push notifications number 2018-02-26 17:01:23 -05:00
Adrien Béraud 56caae019c proxy server: add push notification ttl 2018-02-19 02:10:56 +01:00
Adrien Béraud f5afcbf62b proxy server: use high priority notifications
Normal priority notifications may be delayed.
2018-02-16 01:54:44 +01:00
Adrien Béraud 3a632b1544 proxy server: add logs 2018-02-10 14:31:23 +01:00
Adrien Béraud e274ffd83b headers: unify API across build options 2018-01-31 18:07:43 +01:00
Adrien Béraud 1d6a307b6b proxy server: send data push message instead of notification 2018-01-11 17:01:10 -05:00
Adrien Béraud ef82a7ecba proxy client: make proxy status check asynchronous 2018-01-11 14:24:59 -05:00
Adrien Béraud a0d8f4734a dhtproxy: allow token refresh, set clientID (#6)
* add method to set the push token independently from other configuration,
  since the push token can be updated during runtime.
* allow to provide a "clientID" to be sent in push notifications,
  used to demultiplex push notifications to multiple OpenDHT nodes running
  on the same host. For instance Ring uses the accountID as the clientID
  to know which account received the push notification.
* use {"platform":"android"/"ios"} to communicate the platform instead of {"isAndroid":true/false}.
2018-01-10 16:32:57 -05:00
Sébastien Blin 37a9a3d9da dhtproxy: inject push notifications in opendht
+ add the ability to inject push notifications in opendht to call
correct callbacks
+ if a timeout occurs and no cancelListen was called, relaunch the
listen operation
+ Pass devicekey to enable push notifications for DhtProxyClient
+ Update sockaddr to fix the build on all platforms

Note: update dhtnode
2017-12-12 15:03:02 -06:00
Sébastien Blin 75cca66d7e dhtproxy: support push notifications for mobile clients
+ Add SUBSCRIBE and UNSUBSCRIBE for DhtProxyServer
+ Add the ability to stop Listen via a timeout (and send a push
Notification for the client)
+ Add the ability to use gorush to send push notifications

Note: Update dhtnode
2017-12-12 10:24:54 -06:00
AmarOk d19ba2cb41 proxyserver: add lock_guard to avoid to manually unlock 2017-12-06 14:43:28 -06:00
AmarOk 557323deff refactor: use new jsoncpp API
Use the latest jsoncpp API to remove depreciation warning.
2017-12-06 08:49:24 -06:00
AmarOk b1a9742889 dhtproxyclient: add lock_guards for mutex and clean code 2017-12-04 09:42:37 -06:00
Sébastien Blin e7d8bc4275 proxyclient: erase finished operation threads 2017-11-29 14:44:02 -05:00
Sébastien Blin eb750f5b7f proxy_client: execute callbacks in main thread 2017-11-27 17:51:33 -05:00
Sébastien Blin 5967c89c23 proxy: don't reinit dhtproxy multiple times and forward encrypted messages
+ Having a null dht_proxy_client can lead to using nullptr.
+ securedht should forward messages if we are using a proxy.
+ Protect callback segfault
2017-11-22 16:09:45 -05:00
Sébastien Blin eb1f9d64e1 dhtproxyclient: add listen ability.
+ Fix LISTEN endpoint for DhtProxyServer
= DhtProxyServer use multiple worker threads
+ Add listen/cancelListen for DhtProxyClient
+ Add connectivityChanged.
2017-11-20 16:01:44 -05:00
Sébastien Blin cb72c104fd proxy: implement basic DhtProxyClient with the ability to get and put.
+ Add an abstract class to describe the Dht
+ Now, we can modify the Dht linked to a SecureDht. So we can choose
between the classic Dht and the Dht using a proxy.
+ Implement a basic client which can Get and Put values on the Dht using
the proxy.

Note: Update dhtnode to have the ability to use the DhtProxyClient.
Todo: Implement Listen, ping, connectivityChanged for the client.
2017-11-20 15:45:29 -05:00
Adrien Béraud d7aaa4ae56 proxy server: add Access-Control-Allow-Origin 2017-11-08 15:12:43 -05:00
Sébastien Blin 65e88f2fa6 build: toInfoHash->to 2017-11-08 15:07:04 -05:00
Sébastien Blin e2c534df5a add std::bind, fix put, avoid overflow on base64 2017-11-08 14:33:07 -05:00
Sébastien Blin 2ca2835c9b add options method handler 2017-11-08 12:14:44 -05:00
Sébastien Blin bbe922dd7d remove headers, fix HTTP status, fix get / 2017-11-07 16:08:55 -05:00
Sébastien Blin 67ba435ba6 base64: take the old implementation from ring-daemon 2017-11-06 16:24:00 -05:00
Sébastien Blin 6413571301 clean code 2017-11-06 12:53:35 -05:00