Dmitriy Ryajov
f7fdf31365
Pubsub lifetime ( #284 )
...
* lifecycle hooks
* tests
* move trace after closed check
* restore 1 second heartbeat
* await close event
* fix tests
* print direction string
* more trace logging
* add pubsub monitor
* add log scope
* adjust idle timeout
* add exc.msg to trace
2020-07-27 13:33:51 -06:00
Dmitriy Ryajov
ed0df74bbd
Connection lifecycle hooks ( #288 )
...
* lifecycle hooks
* trigger hooks as tasks
* handle exceptions in trigger hooks
* trigger hooks after storing the connection
* add disconnected hook
* tests
2020-07-24 13:24:31 -06:00
Eugene Kabanov
6af3cb6406
Public key infrastructure filters. ( #272 )
...
* Initial commit.
* Workaround nim's bug and add some other compilation error fixes.
* Rename to libp2p_pki_schemes.
Fix secio.
Add tests.
* Attempt to fix command line.
* Fix command line.
Show status in tests.
2020-07-21 14:10:21 -06:00
Giovanni Petrantoni
c3404f6eea
Handle cancellation in timeoutMonitor ( #283 )
...
* Handle cancellation in timeoutMonitor
* refactor lpchannel timeout as suggested by cheatfate
2020-07-21 09:03:41 -06:00
Giovanni Petrantoni
3b088f8980
Fix some unsubscribe issues and add unsubscribeAll helper ( #282 )
...
* Fix some unsub issues and add unsuball helper
* batch sendprune in unsubscribe methods
* add unsubscribeAll for floodsub
2020-07-20 10:16:13 -06:00
Giovanni Petrantoni
c3af7659b0
Add more checks and fix some issues in gossip tests ( #281 )
2020-07-20 15:55:00 +09:00
Dmitriy Ryajov
38eb36efae
don't use close event to stop timer ( #280 )
2020-07-18 11:00:44 -06:00
Dmitriy Ryajov
94196fee71
Connections and pubsub peers cleanup ( #279 )
...
* better peer tracking and cleanup
* check if peer and conn is nil
* test name
* make timeout more agressive
* rename method for better clarity
2020-07-17 13:46:24 -06:00
Dmitriy Ryajov
ba071cafa6
Channel timeout ( #278 )
...
* add support for channel timeouts
* tests for channel timeout
* add timeouts to standard switch
* fix mplex init
* cleanup timer on stream close
* add comment for `isConnected`
* move cleanup event
2020-07-17 12:44:41 -06:00
Dmitriy Ryajov
0348773ec9
Connection manager ( #277 )
...
* splitting out connection management
* wip
* wip conn mngr tests
* set peerinfo in contructor
* comments and documentation
* tests
* wip
* add `None` to detect untagged connections
* use `PeerID` to index connections
* fix tests
* remove useless equality
2020-07-17 09:36:48 -06:00
Jacek Sieka
170685f9c6
gossipsub fixes ( #276 )
...
* graft up to D peers
* fix logging so it's clear who is grafting/pruning who
* clear fanout when grafting
2020-07-16 21:26:57 +02:00
Jacek Sieka
c76152f2c1
Simplify send ( #271 )
...
* PubSubPeer.send single message
* gossipsub: simplify send further
2020-07-16 12:06:57 +02:00
Giovanni Petrantoni
4112e04036
Add build_p2pd script directly in this repo ( #274 )
2020-07-16 16:22:49 +09:00
Dmitriy Ryajov
f35b8999b3
some light cleanup for pub/gossip sub ( #273 )
...
* move peer table out to its own file
* move peer table
* cleanup `==` and add one to peerinfo
* add peertable
* missed equality check
2020-07-15 13:18:55 -06:00
Eugene Kabanov
b832668768
Minprotobuf refactoring 2 ( #269 )
...
* Protobuf refactoring stage II.
* Remove NoError.
* Change trace level for invalid message.
2020-07-15 10:25:39 +02:00
Eugene Kabanov
9eb5828a42
Fix #266 . ( #270 )
...
* Fix security issue #266 .
* Add more tests.
* Fix PeerID tests should not use RSA-512 keys.
* Fix crypto tests to use vectors with 2048+ bits.
* Disable 4096bit RSA key generation for CI debug runs.
2020-07-15 10:24:04 +02:00
Giovanni Petrantoni
d7bab37119
Fix gossip messages seqno according to spec ( #253 )
...
* Fix gossip messages seqno according to spec
* Add peers back to gossipsub table, slow down heartbeat
* Revert "Add peers back to gossipsub table, slow down heartbeat"
This reverts commit 01e2e62172a7793bb17f0eb8314e2faeb2682173.
* make seqno a threadvar, remove from peerinfo
* seqno refactor, into pubsub
2020-07-14 21:51:33 -06:00
Ștefan Talpalaru
b8b0a2b4bc
CI: build binaries with TRACE & JSON logs ( #268 )
...
Also: remove unused imports.
2020-07-14 02:02:16 +02:00
Jacek Sieka
c6c2d99907
one more log fix
2020-07-13 20:19:20 +02:00
Jacek Sieka
76853f064a
json logging again
2020-07-13 19:59:49 +02:00
Jacek Sieka
6620b7a00b
more comment fixes
2020-07-13 19:30:18 +02:00
Jacek Sieka
0d4c74b33a
comment log that can't be json-serialized
2020-07-13 18:36:49 +02:00
Jacek Sieka
061c54d3c6
logging fixes
2020-07-13 17:26:05 +02:00
Jacek Sieka
87e58c1c8d
metrics: one more pubsub peers fix
2020-07-13 16:16:46 +02:00
Jacek Sieka
c7895ccc52
metrics: fix pubsub_peers add metric
2020-07-13 16:15:27 +02:00
Giovanni Petrantoni
fcda0f6ce1
PubSubPeer tables refactor ( #263 )
...
* refactor peer tables
* tests fixing
* override PubSubPeer equality
* fix pubsubpeer comparison
2020-07-13 15:32:38 +02:00
Eugene Kabanov
efb952f18b
[WIP] Minprotobuf refactoring ( #259 )
...
* Minprotobuf initial commit
* Fix noise.
* Add signed integers support.
Add checks for field number value.
Remove some casts.
* Fix compile errors.
* Fix comments and constants.
2020-07-13 14:43:07 +02:00
Dmitriy Ryajov
181cf73ca7
Drain buffer ( #264 )
...
* drain lpchannel on reset
* move drainBuffer to bufferstream
2020-07-12 18:37:10 +02:00
Giovanni Petrantoni
503a7ec1c5
disable arm64 builds for now (travis)
2020-07-12 11:14:49 +09:00
Dmitriy Ryajov
bec9a0658f
Cleanup rpc handler ( #261 )
...
* more cleanup
* fix tests
* merging master
* remove `withLock` as it conflicts with stdlib
* wip
* more fanout ttl
Co-authored-by: Giovanni Petrantoni <giovanni@fragcolor.xyz>
2020-07-09 17:54:16 -06:00
Dmitriy Ryajov
4c815d75e7
More gossip cleanup ( #257 )
...
* more cleanup
* correct pubsub peer count
* close the stream first
* handle cancelation
* fix tests
* fix fanout ttl
* merging master
* remove `withLock` as it conflicts with stdlib
* fix trace build
Co-authored-by: Giovanni Petrantoni <giovanni@fragcolor.xyz>
2020-07-09 14:21:47 -06:00
Jacek Sieka
c720e042fc
clean up mesh handling logic ( #260 )
...
* gossipsub is a function of subscription messages only
* graft/prune work with mesh, get filled up from gossipsub
* fix race conditions with await
* fix exception unsafety when grafting/pruning
* fix allowing up to DHi peers in mesh on incoming graft
* fix metrics in several places
2020-07-09 11:16:46 -06:00
Jacek Sieka
9a3684c221
init from concrete key type ( #252 )
2020-07-09 02:59:09 -06:00
Jacek Sieka
45c089ff0d
noise updates ( #255 )
...
* clear secrets explicitly
* simplify keygen
* avoid some trivial memory allocations
* fix little endian encoding of nonce
2020-07-09 02:53:19 -06:00
Giovanni Petrantoni
4e12d0d97a
nil check peer before disconnect
2020-07-09 17:20:45 +09:00
Giovanni Petrantoni
f9e0a1f069
CI fix handleDisconnect (pubsub)
2020-07-09 13:56:59 +09:00
Giovanni Petrantoni
9b8b159abb
Remove other spurious getStacktrace in pubsub traces
2020-07-09 13:19:34 +09:00
Giovanni Petrantoni
4bcb567d47
fix gossip tests
2020-07-09 12:34:36 +09:00
Giovanni Petrantoni
4698f41a91
Remove stacktrace logging from pubsub connect
2020-07-09 12:23:03 +09:00
Giovanni Petrantoni
fec507e755
Add peers back to gossipsub table, slow down heartbeat ( #256 )
...
* Add peers back to gossipsub table, slow down heartbeat
* exclude on unsub from mesh and fanout
2020-07-08 11:06:26 -06:00
Dmitriy Ryajov
a52763cc6d
fix publishing ( #250 )
...
* use var semantics to optimize table access
* wip... lvalues don't work properly sadly...
* big publish refactor, replenish and balance
* fix internal tests
* use g.peers for fanout (todo: don't include flood peers)
* exclude non gossip from fanout
* internal test fixes
* fix flood tests
* fix test's trypublish
* test interop fixes
* make sure to not remove peers from gossip table
* restore old replenishFanout
* cleanups
* Cleanup resources (#246 )
* consolidate reading in lpstream
* remove debug echo
* tune log level
* add channel cleanup and cancelation handling
* cancelation handling
* cancelation handling
* cancelation handling
* cancelation handling
* cleanup and cancelation handling
* cancelation handling
* cancelation
* tests
* rename isConnected to connected
* remove testing trace
* comment out debug stacktraces
* explicit raises
* restore trace vs debug in gossip
* improve fanout replenish behavior further
* cleanup stale peers more eaguerly
* synchronize connection cleanup and small refactor
* close client first and call parent second
* disconnect failed peers on publish
* check for publish result
* fix tests
* fix tests
* always call close
Co-authored-by: Giovanni Petrantoni <giovanni@fragcolor.xyz>
2020-07-07 18:33:05 -06:00
Eugene Kabanov
775cab414a
Remove SHA1 from crypto and crypto tests. ( #251 )
...
* Remove SHA1 from crypto and crypto tests.
* Simplify RSA comparison procedure.
Refactor some procedures in crypto.nim.
2020-07-07 15:48:15 +02:00
Jacek Sieka
d522537b19
reuse single RNG instance for all crypto key generation ( #249 )
...
* reuse single RNG instance for all crypto key generation
* use foolproof rng
* initRng -> newRng (because it's ref)
* fix test
* imports/exports, chat fix
* fix rsa
* imports and exports
* work around threadvar issue
* fixup
* mac workaround test
2020-07-07 13:14:11 +02:00
Jacek Sieka
b49c619ca8
export public field types ( #248 )
...
* export public field types
* one more
2020-07-01 09:22:29 +02:00
Giovanni Petrantoni
ec00c7fc50
Peer resultification and defect only ( #245 )
...
* Peer resultification and defect only
* Fixing some tests
* test fixes
* Rename peer into peerid
* better result error message in identify
* further merge fixes
2020-07-01 08:25:09 +02:00
Dmitriy Ryajov
c788a6a3c0
Cleanup resources ( #246 )
...
* consolidate reading in lpstream
* remove debug echo
* tune log level
* add channel cleanup and cancelation handling
* cancelation handling
* cancelation handling
* cancelation handling
* cancelation handling
* cleanup and cancelation handling
* cancelation handling
* cancelation
* tests
* rename isConnected to connected
* remove testing trace
* comment out debug stacktraces
* explicit raises
2020-06-29 09:15:31 -06:00
Jacek Sieka
aa6756dfe0
allow message id provider to be specified ( #243 )
...
* don't send public key in message when not signing (information leak)
* don't run rebalance if there are peers in gossip (see #242 )
* don't crash randomly on bad peer id from remote
2020-06-28 09:56:38 -06:00
Dmitriy Ryajov
902880ef1f
consolidate reading in lpstream ( #241 )
...
* consolidate reading in lpstream
* remove debug echo
* throw if not enough bytes where read
* tune log level
* set eof flag
* test readExactly to fail on not enough bytes
2020-06-27 11:33:34 -06:00
Dmitriy Ryajov
7a95f1844b
Concurrent dials ( #238 )
...
* count published messages
* don't call `switch.dial` in `subscribeToPeer`
* add secureconn constructor
* close in the correct order
* concurent dial lock and track in/out conns better
* make tests pass
* add todo comment
* disconect peers that open too many connections
* wip
* do connection and muxer tracking in one place
* prevent nil pointer in observers
* drop connections when peers is over max
* prevent channel leaks
* don't use closure to handle channel
2020-06-24 09:08:44 -06:00
Ștefan Talpalaru
83b6ead857
Azure: fix MinGW-w64 caching ( #239 )
2020-06-23 16:38:17 +02:00