Commit Graph

47 Commits

Author SHA1 Message Date
Derrick Hammer 743e76bcf1
refactor: use new sdks 2023-07-01 02:34:18 -04:00
Derrick Hammer e95b366ea4
*Use just acquire not waitForUnlock 2023-03-29 14:57:18 -04:00
Derrick Hammer b6dda4dd5e
*Ensure we release the mutex before aborting if we have an active relay 2023-03-29 14:50:24 -04:00
Derrick Hammer 9102cc77d5
*Add offSelf and onceSelf 2023-03-19 13:23:07 -04:00
Derrick Hammer b3e0722364
*Add close event for when the relay connection closes 2023-03-19 12:00:00 -04:00
Derrick Hammer 42f0c1b60d
*Add onSelf and emitSelf methods to use local event emitter
*Emit local init before processing queued actions
2023-02-17 22:22:46 -05:00
Derrick Hammer e8a44315a8
*Need to hook to the stream directly 2023-02-17 16:32:39 -05:00
Derrick Hammer 439bd9f022
*Add ready property 2023-02-17 08:04:16 -05:00
Derrick Hammer 701a3190ae
*Convert more api methods to use _processOrQueueAction 2023-02-05 14:02:53 -05:00
Derrick Hammer 5bdbf77971
*Add public api methods from hyperswarm 2023-02-01 13:45:21 -05:00
Derrick Hammer fb13e6e323
*Add getter for activeRelay 2023-02-01 08:36:43 -05:00
Derrick Hammer c7fd7f294b
*Emit the ready event after successful init 2023-02-01 08:29:35 -05:00
Derrick Hammer 249311c522
*Rename ready to init 2023-02-01 08:22:30 -05:00
Derrick Hammer 9d14579ae9
*Add a mutex lock so we are only ever attempting 1 bootup at a time
*Only try to process relays when we have one
2023-02-01 08:15:16 -05:00
Derrick Hammer af76d85983
*Need to wrap DhtNode in a hyperswarm instance 2023-02-01 05:00:51 -05:00
Derrick Hammer 17ca564f43
*dht-relay ready is on the main object, dht object does not exist 2023-02-01 04:57:22 -05:00
Derrick Hammer 5472397958
*Need to pass arguments as a spread 2023-02-01 04:50:55 -05:00
Derrick Hammer cc7c7c8edf
*Only run loop while this._activeRelay is not set 2023-02-01 04:41:45 -05:00
Derrick Hammer 9b815444e1
*If discover returns false, treat like an error 2023-01-31 08:48:47 -05:00
Derrick Hammer 5073788529
*only use RNG if we have more than 1 relay available 2023-01-31 07:38:48 -05:00
Derrick Hammer 281121b7cc
*Add basic eventemitter action queue to process once we have an active relay, or to immediately process if we already have one 2023-01-31 06:58:03 -05:00
Derrick Hammer e2ab0b8e91
*Switch to eventemitter2 2023-01-31 05:43:29 -05:00
Derrick Hammer 35e394fec4
*rewrite for new design 2023-01-31 05:10:12 -05:00
Derrick Hammer 5276de4363
*add getter to return relay servers 2022-08-14 07:25:16 -04:00
Derrick Hammer f6bcc8ecdb
*Delete relay from active list when the raw stream/websocket closes
*Attempt to refill and reconnect to relays if we have 0 active relays in the pool
2022-08-13 20:04:35 -04:00
Derrick Hammer 0120b67c59
*move away from node Buffer 2022-08-13 20:02:51 -04:00
Derrick Hammer 21bcebb689 *Only choose a random index if we have more than 1 relay 2022-07-27 00:37:30 -04:00
Derrick Hammer 3f843b5266 *If server is not available, remove from the available array and call removeRelay. 2022-07-27 00:12:41 -04:00
Derrick Hammer 3864465ba2 *isServerAvailable is async 2022-07-27 00:05:28 -04:00
Derrick Hammer 1090b203dc *Handle available only having 1 item 2022-07-26 23:59:45 -04:00
Derrick Hammer cb139131e1 *Call updateAvailable in loop
*Check available length and abort and return if empty
2022-07-26 23:28:12 -04:00
Derrick Hammer 5f37b74baf *Try to update the available list every loop and only compare max _activeRelays against the min of _maxConnections and available 2022-07-26 23:22:10 -04:00
Derrick Hammer cb16b87b73 Revert "*Store copy of activeRelay size to prevent infinite loop"
This reverts commit 7cb32b716a.
2022-07-26 23:13:30 -04:00
Derrick Hammer 7cb32b716a *Store copy of activeRelay size to prevent infinite loop 2022-07-26 23:09:25 -04:00
Derrick Hammer ce575b623c *cast to string 2022-07-26 22:58:24 -04:00
Derrick Hammer 007b9a09d7 *Fix usage of connection 2022-07-26 22:56:49 -04:00
Derrick Hammer 8d4be6ec4a *Using wrong map 2022-07-26 22:49:46 -04:00
Derrick Hammer b52bdcdeb2 *check for 0, not less than 0 2022-07-26 21:46:58 -04:00
Derrick Hammer fe09e2a5d9 *add negative condition 2022-07-26 21:46:24 -04:00
Derrick Hammer 2e71082a59 *prettier 2022-07-26 21:39:32 -04:00
Derrick Hammer c7b64064ad *_relays is a map 2022-07-26 21:39:16 -04:00
Derrick Hammer 377b9548cf *Prevent ready from running fillConnections twice 2022-07-26 21:38:05 -04:00
Derrick Hammer 35eed2a157 *Abort if no available relays to process 2022-07-26 21:36:30 -04:00
Derrick Hammer 685bc59894 *Refactor to use persistent websocket connections, randomly (secure) picked, then load balance connect requests the same way 2022-07-26 19:27:59 -04:00
Derrick Hammer 918c49f146 *Set custodial to false 2022-07-21 14:58:32 -04:00
Derrick Hammer 2c197cdeef *refactor
*remove wspool
*reformat
2022-07-20 01:55:44 -04:00
Derrick Hammer 915d15a9dc *Initial version 2022-06-27 18:22:38 -04:00