Tanguy
5d7024f2e0
Handle more cancellations ( #733 )
...
* Mplex: handle write cancellation
* LpChannel: Don't close connection on EOF
2022-06-24 11:11:23 +02:00
Tanguy
a7e335e1bb
Remove Br prefix from BearSSL ( #728 )
...
ref status-im/nim-bearssl#27
2022-06-16 10:08:52 +02:00
Tanguy
d4ff1c88e9
Less warnings ( #710 )
2022-05-24 15:10:57 +02:00
Tanguy
df566e69db
Fixes for style check ( #676 )
2021-12-16 11:05:20 +01:00
Jacek Sieka
c49932b55a
fast path for writes ( #659 )
...
avoids several copies of the various message buffers being kept alive
for the lifetime of the future
2021-12-14 10:55:17 +01:00
Tanguy
846baf3853
Various cleanups part 1 ( #632 )
...
* raise -> raise exc
* replace stdlib random with bearssl
* object init -> new
* Remove deprecated procs
* getMandatoryField
2021-10-25 10:26:32 +02:00
Menduist
d02735dc46
Remove peer info ( #610 )
...
Peer Info is now for local peer data only.
For other peers info, use the peer store.
Previous reference to peer info are replaced with the peerid
2021-09-08 11:07:46 +02:00
Tanguy Cizain
8cddfde837
Rename getKey -> getPublicKey ( #621 )
...
* rename getKey to getPublicKey
* use publicKey directly in gossipsub
* update error messages
2021-09-02 12:03:40 +02:00
Tanguy Cizain
bd2e9a0462
Fix trackers tests ( #588 )
...
* Fix checkTracker typo
* fix testswich tests
* use tracker consts
2021-06-14 10:26:11 +02:00
Tanguy Cizain
caac8191d2
Change newXXXX procs to XXXX.new ( #585 )
...
* newBufferStream -> BufferStream.new
* newMultistream -> MultistreamSelect.new
* newSecio -> Secio.new
* newNoise -> Noise.new
* newPlainText -> PlainText.new
* newPubSubPeer -> PubSubPeer.new
* newIdentify -> Identify.new
* newMuxerProvider -> MuxerProvider.new
2021-06-07 09:32:08 +02:00
Dmitriy Ryajov
1c3616e3a5
merge latest master
2021-06-02 12:25:36 -06:00
Dmitriy Ryajov
24132d7129
More raises cleanup ( #575 )
...
* use toException to map errors
* don't initialize address twice
* better error messages
* allow LPError to escape
* allow LPError to escape
2021-05-22 12:27:30 -06:00
Dmitriy Ryajov
ac4e060e1a
adding raises defect across the codebase ( #572 )
...
* adding raises defect across the codebase
* use unittest2
* add windows deps caching
* update mingw link
* die on failed peerinfo initialization
* use result.expect instead of get
* use expect more consistently and rework inits
* use expect more consistently
* throw on missing public key
* remove unused closure annotation
* merge master
2021-05-21 10:27:01 -06:00
Dmitriy Ryajov
290866dd62
builders ( #559 )
2021-04-05 16:06:45 -06:00
Giovanni Petrantoni
02ad017107
Gossipsub fixes and Initiator flagging fixes ( #539 )
...
* properly propagate initiator information for gossipsub
* Fix pubsubpeer lifetime management
* restore old behavior
* tests fixing
* clamp backoff time value received
* fix member name collisions
* internal test fixes
* better names and explaining of the importance of transport direction
* fixes
2021-03-03 08:23:40 +09:00
Dmitriy Ryajov
b2ea5a3c77
Concurrent upgrades ( #489 )
...
* adding an upgraded event to conn
* set stopped flag asap
* trigger upgradded event on conn
* set concurrency limit for accepts
* backporting semaphore from tcp-limits2
* export unittests module
* make params explicit
* tone down debug logs
* adding semaphore tests
* use semaphore to throttle concurent upgrades
* add libp2p scope
* trigger upgraded event before any other events
* add event handler for connection upgrade
* cleanup upgraded event on conn close
* make upgrades slot release rebust
* dont forget to release slot on nil connection
* misc
* make sure semaphore is always released
* minor improvements and a nil check
* removing unneeded comment
* make upgradeMonitor a non-closure proc
* make sure the `upgraded` event is initialized
* handle exceptions in accepts when stopping
* don't leak exceptions when stopping accept loops
2021-01-04 12:59:05 -06:00
Jacek Sieka
0c331d5200
simplify noise frame construction ( #478 )
2020-12-16 13:10:06 +01:00
Jacek Sieka
6f1ecc8df7
streamline socket read/write hot path ( #473 )
...
* streamline socket read/write hot path
This avoids some unnecessary memory copying on the hot path of noise /
mplex, as well as getting rid of a few futures - profiling shows that
this is one of the main culprits of small memory allocations, which
makes sense - this is where gossip fan-out happens.
* fewer futures (and corresponding closures) when sending lpchannel
messages
* avoid data copies when encrypting and framing noise messages
* avoid copying tuple when reading noise data (poor c codegen)
* fix setting eof flag in secure read
* write noise frames in one go
...and closing secure socket once is enough
2020-12-09 08:56:40 -06:00
Dmitriy Ryajov
d1c689e5ab
adding libp2p tag to logScope ( #465 )
2020-12-01 11:34:27 -06:00
Dmitriy Ryajov
3d44fcb8b3
use cancelAndAwait to mitigate further hangs ( #459 )
2020-11-28 09:48:06 -06:00
Dmitriy Ryajov
164892776b
get rid of hangs cleanup ( #453 )
2020-11-25 07:35:25 -06:00
Dmitriy Ryajov
21110636cb
fixing log level to avoid sacring users ( #452 )
2020-11-24 12:07:27 -06:00
Dmitriy Ryajov
69ae24dc8d
less leak prone cleanup ( #447 )
...
* less leak prone cleanup
* fix double allFinished
2020-11-23 18:22:15 -06:00
Dmitriy Ryajov
6cc3f4283a
update conn peerinfo instead of replacing ( #445 )
...
* update conn peerinfo instead of replacing
* remove unnecesary peerid var
2020-11-23 15:15:55 -06:00
Dmitriy Ryajov
3956f3fd69
make sure all streams are tracked ( #422 )
...
* make sure all streams are tracked
* revert unnecesary change
2020-11-04 21:52:54 -06:00
Dmitriy Ryajov
43a77e60a1
split stream counts by direction ( #418 )
2020-11-01 16:23:26 -06:00
Jacek Sieka
03639f1446
Revert "Channel leaks ( #413 )" ( #417 )
...
This reverts commit 1de1d49223
.
2020-11-01 14:49:25 -06:00
Dmitriy Ryajov
1de1d49223
Channel leaks ( #413 )
...
* break stream tracking by type
* use closeWithEOF to await wrapped stream
* fix cancelation leaks
* fix channel leaks
* logging
* use close monitor and always call closeUnderlying
* don't use closeWithEOF
* removing close monitor
* logging
2020-10-27 11:21:03 -06:00
Giovanni Petrantoni
5c19668b2d
avoid verbose EOF messages in readOnce(secure) ( #411 )
...
* avoid verbose EOF messages in readOnce(secure)
* shorten azure tests further
2020-10-21 10:08:24 +09:00
Giovanni Petrantoni
32623b930e
handle secure errors in readOnce (secure) ( #397 )
...
* handle secure errors in readOnce(secure)
* small synthax fix
* fix mistake in readOnce's isNil
2020-10-19 14:13:14 +09:00
Giovanni Petrantoni
b99d2039a8
Gossip one one ( #240 )
...
* allow multiple codecs per protocol (without breaking things)
* add 1.1 protocol to gossip
* explicit peering part 1
* explicit peering part 2
* explicit peering part 3
* PeerInfo and ControlPrune protocols
* fix encodePrune
* validated always, even explicit peers
* prune by score (score is stub still)
* add a way to pass parameters to gossip
* standard setup fixes
* take into account explicit direct peers in publish
* add floodPublish logic
* small fixes, publish still half broken
* make sure to waitsub in sparse test
* 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
* restore utility module import
* restore trace vs debug in gossip
* improve fanout replenish behavior further
* triage publish nil peers (issue is on master too but just hidden behind a if/in)
* getGossipPeers fixes
* remove topics from pubsubpeer (was unused)
* simplify rebalanceMesh (following spec) and make it finally reach D_high
* better diagnostics
* merge new pubsubpeer, copy 1.1 to new module
* fix up merge
* conditional enable gossip11 module
* add back topics in peers, re-enable flood publish
* add more heartbeat locking to prevent races
* actually lock the heartbeat
* minor fixes
* with sugar
* merge 1.0
* remove assertion in publish
* fix multistream 1.1 multi proto
* Fix merge oops
* wip
* fix gossip 11 upstream
* gossipsub11 -> gossipsub
* support interop testing
* tests fixing
* fix directchat build
* control prune updates (pb)
* wip parameters
* gossip internal tests fixes
* parameters wip
* finishup with params
* cleanups/wip
* small sugar
* grafted and pruned procs
* wip updateScores
* wip
* fix logging issue
* pubsubpeer, chronicles explicit override
* fix internal gossip tests
* wip
* tables troubleshooting
* score wip
* score wip
* fixes
* fix test utils generateNodes
* don't delete while iterating in score update
* fix grafted defect
* add a handleConnect in subscribeTopic
* pruning improvements
* wip
* score fixes
* post merge - builds gossip tests
* further merge fixes
* rebalance improvements and opportunistic grafting
* fix test for now
* restore explicit peering
* implement peer exchange graft message
* add an hard cap to PX
* backoff time management
* IWANT cap/budget
* Adaptive gossip dissemination
* outbound mesh quota, internal tests fixing
* oversub prune score based, finish outbound quota
* finishup with score and ihave budget
* use go daemon 0.3.0
* import fixes
* byScore cleanup score sorting
* remove pointless scaling in `/` Duration operator
* revert using libp2p org for daemon
* interop fixes
* fixes and cleanup
* remove heartbeat assertion, minor debug fixes
* logging improvements and cleaning up
* (to revert) add some traces
* add explicit topic to gossip rpcs
* pubsub merge fixes and type fix in switch
* Revert "(to revert) add some traces"
This reverts commit 4663eaab6c
.
* cleanup some now irrelevant todo
* shuffle peers anyway as score might be disabled
* add missing shuffle
* old merge fix
* more merge fixes
* debug improvements
* re-enable gossip internal tests
* add gossip10 fallback (dormant but tested)
* split gossipsub internal tests into 1.0 and 1.1
Co-authored-by: Dmitriy Ryajov <dryajov@gmail.com>
2020-09-21 11:16:29 +02:00
Jacek Sieka
b7e5d1122c
cleanups ( #366 )
...
* reuse connection timeout for noise handshake (avoid extra timer)
* enforce nbytes > 0 for readOnce
* avoid some unnecessary memory zeroing
* simplify noise
* fix dumping when noise splits message
2020-09-16 11:55:25 +02:00
Eugene Kabanov
e2d46c6b53
Add `libp2p_dump` and `libp2p_dump_dir` compiler time options. ( #359 )
...
* Add `libp2p_dump` and `libp2p_dump_dir` compiler time options.
* Add tools/pbcap_parser.
* Add mplex control messages decoding.
2020-09-15 11:16:43 +02:00
Jacek Sieka
c1856fda53
simplify and unify logging ( #353 )
...
* use short format for logging peerid
* log peerid:oid for connections
2020-09-06 10:31:47 +02:00
Eugene Kabanov
0b85192119
Remove asyncCheck from codebase. ( #345 )
...
* Remove asyncCheck from codebase.
* Replace all `discard` statements with new `asyncSpawn`.
* Bump `nim-chronos` requirement.
2020-09-04 18:30:45 +02:00
Jacek Sieka
9c7e055310
set activity flag on noise / secio ( #330 )
2020-08-15 07:36:15 +02:00
Dmitriy Ryajov
b76b3e0e9b
Rework pubsub ( #322 )
...
* move pubsub of off switch, pass switch into pubsub
* use join on lpstreams
* properly cleanup up failed peers
* fix tests
* fix peertable hasPeerId
* fix tests
* rework sending, remove helpers from pubsubpeer, unify in broadcast
* further split broadcast into send
* use send where appropriate
* use formatIt
* improve trace
Co-authored-by: Giovanni Petrantoni <giovanni@fragcolor.xyz>
2020-08-11 18:05:49 -06:00
Dmitriy Ryajov
2325692f55
Fix half closed ( #324 )
...
* don't call `close` in `remoteClose`
* make sure timeout are properly propagted
* fix tests
* adding remote close write test
2020-08-10 16:17:11 -06:00
Jacek Sieka
f303954989
peer hooks -> events ( #320 )
...
* peer hooks -> events
* peerinfo -> peerid
* include connection direction in event
* check connection status after event
* lock connmanager lookup also when dialling peer
* clean up un-upgraded connection when upgrade fails
* await peer eventing
* remove join/lifetime future from peerinfo
Peerinfo instances are not unique per peer so the lifetime future is
misleading - it fires when a random connection is closed, not the "last"
one
* document switch values
* naming
* peerevent->conneevent
2020-08-08 08:52:20 +02:00
Jacek Sieka
7c2ab38da1
cleanups ( #319 )
2020-08-06 20:14:40 +02:00
Jacek Sieka
c6c0c152c0
Dial peerid ( #308 )
...
* prefer PeerID in switch api
This avoids ref issues like ref identity and nil
* use existing peerinfo instance if possible
* remove secureCodec
there may be multiple connections per peerinfo with different codecs
* avoid some extra async::
2020-08-06 09:29:27 +02:00
Giovanni Petrantoni
5f0637c49a
Audit curve fixes part2 ( #298 )
...
* refactor and fix mulgen (curve25519)
* crypto tests fixing
* fix some confusion in curve25519 mul
* removing ForbiddenCurveValues table and checks
* fix remaining merge issues
2020-08-04 18:19:26 +09:00
Giovanni Petrantoni
5cd93540fa
add a timeout during noise handshake ( #294 )
...
* add a timeout during noise handshake
* noise hs timeout into const
2020-08-04 17:04:16 +09:00
Giovanni Petrantoni
504e0444d3
refactor and fix mulgen (curve25519) ( #293 )
...
* refactor and fix mulgen (curve25519)
* crypto tests fixing
2020-08-04 14:07:53 +09: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
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
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
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
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
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