Commit Graph

53 Commits

Author SHA1 Message Date
Adrian Sutton
cfc50bae8e net/mock: support ConnectionGater in MockNet (#2297) 2023-07-06 17:43:29 -07:00
Hlib Kanunnikov
8719fc4944 net/mock: mimic Swarm's event and notification behavior in MockNet (#2287)
* net/mock: mimic Swarm's event and notificaion behavior in MockNet

* go fmt
2023-05-16 12:47:24 -07:00
Marten Seemann
235f25b487 identify: refactor sending of Identify pushes (#1984)
* identify: cache the snapshot

* identify: refactor sending of Identify pushes

* identify: fix concurrency when sending pushes

* identify: fix timestamp handling

* identify: remove unneeded pushSemaphore

* identify: improve logging

* identify: use a sequence number instead of a timestamp

* identify: start with an empty snapshot

* identify: wait until we've actually finished setting up
2023-02-08 14:44:33 -08:00
Marten Seemann
d4e64c727f stop using go-libp2p-testing peer ID generation functions 2022-08-17 17:37:24 +03:00
Marten Seemann
4623690009 switch from github.com/libp2p/go-libp2p-core to core 2022-08-17 17:13:02 +03:00
Marten Seemann
9aab068808 update go-multistream, stop using deprecated NegotiateLazy (#1417)
* update go-multistream, stop using deprecated NegotiateLazy

* remove mock net test case TestStreamsStress
2022-04-22 07:57:23 -07:00
Marten Seemann
f7b6063795 fix flaky TestStreamsStress test (#1288) 2022-01-09 04:31:41 -08:00
Marten Seemann
47a6225cdb remove goprocess from mock net and peernet 2021-12-14 14:21:19 +04:00
Marten Seemann
4975f0abe5 remove dependency on github.com/ipfs/go-detect-race 2021-09-25 14:29:26 +01:00
Marten Seemann
a2b8ed16f8 speed up the mock tests 2021-05-18 09:03:37 -07:00
Steven Allen
2a72777ef9 fix: address review feedback 2021-04-29 14:13:54 -07:00
Cory Schwartz
04a93f4080 static check fixes 2021-04-29 14:08:24 -07:00
Steven Allen
7a98f28856 feat: update to go-libp2p-core 0.7.0 interface changes
This patch updates go-libp2p for the stream interface changes in go-libp2p-core
0.7.0. This is a _significant_ breaking change to streams and all users should
read https://github.com/libp2p/go-libp2p-core/releases/tag/v0.7.0. In practice,
this change should remove a significant footgun.

TL;DR:

* `Stream.Close` now behaves like `net.TCPConn.Close`.
* There is a new `Stream.CloseWrite` (send an EOF) and `Stream.CloseRead` (close
  for reading), behaving like their counterparts in `net.TCPConn`.
2020-11-11 09:35:37 -08:00
Steven Allen
bd040ba050 fix: refactor logic for identifying connections
0. NEVER call `peerstore.SetProtocols(p)` (clear the protocol set). Given the
   new identify events, if someone looked in the peerstore at the wrong time, they
   could decide that the peer no longer speaks some protocol.
1. Reliably wait for identify before trying to open a stream. The old logic was
   _really_ racy.
2. Avoids potentially calling identify on the same connection multiple times.
3. Calls identify as early as possible. Previously, we'd invoke identify on
   inbound connections using an event that was only invoked _after_ all `Connected`
   event handlers completed. Now we invoke identify from a `Connected` handler.
2020-04-24 19:05:22 -07:00
Steven Allen
c99a5bfa25 test(mock): close the mocknet when fuzzing 2020-03-23 14:27:41 -07:00
Steven Allen
9ee9d94ea2 chore(ci): fix a flaky test (#787)
Timing tests never work well in CI.
2020-02-05 18:05:37 +00:00
Cole Brown
c261182d50 Adjust test timings for Ed25519 2019-08-02 18:05:59 -04:00
Cole Brown
a80fc34f3a Update deps, mocknet tests 2019-08-02 18:05:59 -04:00
Raúl Kripalani
1cec1b9191 remove superfluous goroutine; avoid t.Fatal from goroutines. 2019-07-10 18:29:46 +01:00
Raúl Kripalani
8e4bc2ee2c fix #672: wait until done; fix ponger response. 2019-07-10 15:54:09 +01:00
Raúl Kripalani
9797b07de4 TestStreamsStress: reduce node count, increase stream density. 2019-07-10 14:52:26 +01:00
Steven Allen
3755b9afd6 test: full-close streams in stream stress test 2019-07-04 13:18:27 -07:00
Raúl Kripalani
d87f89314c Consolidate abstractions and core types into go-libp2p-core (#601) 2019-05-26 22:55:46 +01:00
vyzo
c9b2f468ba reduce peer count in TestFuzzManyPeers when running under the race detector 2019-04-19 20:03:53 +03:00
Steven Allen
5c51323aa2 mock: increase tolerance for latency tests
These were exceeding their tolerances when run under the race detector on CI.
2019-03-06 12:01:08 -08:00
Steven Allen
5b643cde2d mock: reduce peer count in FuzzManyPeers when the race detector is enabled 2019-03-06 11:27:28 -08:00
Steven Allen
758b516603 mock: export ratelimiter as RateLimiter
Technically a breaking change because I changed the constructor casing but
nobody's using this outside of libp2p (yet), mostly because the type hasn't been
exported.
2018-12-18 21:22:17 -08:00
Steven Allen
a8e25bf270 mocknet: refuse to connect to self
The swarm does this as well and most of our services will fail if we don't have
this.
2018-11-08 13:10:07 -08:00
Steven Allen
f4229470cb mocknet: use peer ID in peer address
RandLocalTCPAddress is mostly useful when we *actually* want to listen on a real
address. Unfortunately, when running a bunch of tests, we can actually run
out.

With this change, a collision means we have a duplicate peer ID so yeah...

fixes #473
2018-11-07 15:42:29 -08:00
Erin Swenson-Healey
2f001009f2 loosen tolerance in latency test 2018-06-06 07:49:29 -07:00
Erin Swenson-Healey
bb9d55ac08 add test which demonstrates how Mocknet latency works 2018-06-05 17:35:18 -07:00
Hector Sanjuan
cc1c2af4b7 Update go-detect-race to latest packaged version and location
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2018-02-16 11:26:39 +01:00
Kevin Atkinson
af895a81d5 Fix most "go vet" errors. 2017-11-16 20:05:22 -05:00
Jeromy
70872ff663 update deps 2016-10-04 21:18:07 -07:00
Jeromy
cea1fe131f extract net interface and metrics 2016-10-04 13:56:20 -07:00
Jeromy
0f3ffb2d07 extract conn, addr-util, and testutil 2016-10-04 13:03:14 -07:00
Jeromy
1085a07654 extract protocol and maddr-filter 2016-10-03 21:47:08 -07:00
Jeromy
4dd30d824b switch to using stdlib context package 2016-10-03 11:00:00 -07:00
Jeromy
7a3394b1da host: remember which protocols work for a given peer 2016-08-18 11:16:00 -07:00
Jeromy
8744e460da update local import paths to reflect org change 2016-08-10 09:59:14 -07:00
Jeromy
b0ad207270 rewrite all package paths to dvcs 2016-04-27 12:59:04 -07:00
Jeromy
15b28dc0ce recursive dependency update of utp lib 2016-04-27 10:12:51 -07:00
Jeromy
4f82ae5e62 move some deps out as gx packages 2016-04-11 23:24:32 -07:00
Jeromy
ada8212cac path rewrites 2016-01-04 05:45:58 -08:00
Jeromy
d91b419ecf WIP 2015-12-06 23:11:16 -08:00
Jeromy
1c6efef4f8 vendor in go-detect-race 2015-11-23 17:04:47 -08:00
Jeromy
dafa3bf917 make new stream calls accept a context 2015-11-19 16:20:59 -08:00
Jeromy
9d40a0af19 migrate to gx namespace 2015-11-18 16:11:24 -08:00
Jeromy
4a64aae7c6 move testutil up 2015-11-15 19:59:59 -08:00
Jeromy
0c73722a91 vendor in notifier 2015-11-15 18:42:27 -08:00