Commit Graph

164 Commits

Author SHA1 Message Date
Juan Batiz-Benet 6012b8675c p2p/net/conn: cleaner reuse port setup
This commit cleans up the reuse port setup, and fixes a problem:
make sure to filter addrs out that we simply cannot dial with
(e.g. loopback -> non-loopback, or linklocal -> nonlinklocal)
2015-01-19 23:18:52 -08:00
Juan Batiz-Benet c91463e43f p2p/net/conn: log when reuse fails 2015-01-19 23:18:52 -08:00
Juan Batiz-Benet 958eecfe46 p2p/proto/identify: use observed listen addrs
This commit finally makes use of the sent observed addrs.
If the connection's local address is from one of our
listen addrs, then the remote's observed addr is its
natted mapping, which is useful to us. For now, we add
it directly to our address book. (a future commit should
make addressbook addresses expire)
2015-01-19 23:18:51 -08:00
Juan Batiz-Benet 11b94db5e3 p2p/test/reconnects: faster tests 2015-01-19 23:18:51 -08:00
Juan Batiz-Benet 51f5bce55b p2p/net/conn: use reuseport 2015-01-19 23:18:51 -08:00
Brian Tiger Chow 1c3448efd6 rm unused proto
cc @jbenet @whyrusleeping
2015-01-18 14:41:42 -08:00
Brian Tiger Chow bb0dc22735 eventlog: rm noisy low-signal statement 2015-01-18 14:41:42 -08:00
Brian Tiger Chow 36444ac75f hold lock during map access 2015-01-18 14:33:41 -08:00
Brian Tiger Chow f54e0c74ab move generic packages to thirdparty (see thirdparty/README.md) 2015-01-18 14:04:45 -08:00
Jeromy 9c45696a4b rewrite as single line defer logs 2015-01-15 04:45:34 +00:00
Jeromy ffb41231ab starting to move important events over to EventBegin/Done 2015-01-15 04:17:17 +00:00
Brian Tiger Chow b9011990f4 fix(mux) expose method to SetDefaultHandler 2015-01-14 16:26:21 -08:00
Brian Tiger Chow 8bbcc9992a fix: privatize Mux fields 2015-01-14 16:18:01 -08:00
Juan Batiz-Benet 83e6bbf5de testing/ci: all env var checks now use new pkgs
Good thing, i checked one wrong, too!
2015-01-14 16:01:03 -08:00
Juan Batiz-Benet 9f8999a8cf p2p/net/swarm: fix travis env flag val
the travis docs say the env flag TRAVIS=true but, i want
to make absolutely sure. explicitness leaves less room for
error.
2015-01-13 23:34:28 -08:00
Juan Batiz-Benet 126c2b39f4 p2p/net/swarm: fix racey test 2015-01-13 22:46:41 -08:00
Juan Batiz-Benet ebb51b28a9 Merge pull request #551 from jbenet/fix-swarm-more-connect
p2p/net/swarm: more connection bugs
2015-01-13 09:17:19 -08:00
Juan Batiz-Benet 0789599c8a p2p/net/swarm: nicer test timeouts for travis 2015-01-13 08:42:46 -08:00
Juan Batiz-Benet 0f910195a0 p2p/net/swarm: parallelize tests. poor travis. 2015-01-13 08:16:02 -08:00
Juan Batiz-Benet 70002a38f7 p2p/net/swarm: extensive dial tests 2015-01-13 08:15:26 -08:00
Juan Batiz-Benet d49b6fedf5 p2p/net/swarm: sync diagram explain 2015-01-13 08:14:35 -08:00
Juan Batiz-Benet 207156fab4 p2p/net/swarm: async grabbing of best conn
this is actually pretty important in case some peers end
up changing addrs, so others dont fail dialing simply for
picking the wrong addr to start with.
2015-01-13 08:13:32 -08:00
Juan Batiz-Benet 9d9e2a3ba9 p2p/net/swarm: configurable timeout for tests 2015-01-13 08:12:45 -08:00
Juan Batiz-Benet 3d3ffc45a6 p2p/net/swrm: InterfaceListenAddrs now method 2015-01-13 05:58:49 -08:00
Juan Batiz-Benet 5de997f0b7 p2p/net/swarm: dial backoff
This commit introduces a backoff when failing to dial
peers. It makes everything much faster.
2015-01-13 05:04:12 -08:00
Juan Batiz-Benet cbe80237ee p2p/net/swarm: dial timeout to 10s + dialer 2015-01-13 04:08:08 -08:00
Juan Batiz-Benet 9982e25151 p2p/net/swarm: more connection bugs
* filtering InterfaceListenAddresses(s) instead
* return error if for loops skip
* large dial timeout
2015-01-13 03:32:15 -08:00
Brian Tiger Chow aadb0bb3de refactor(repo/config) move config under repo 2015-01-13 03:09:30 -08:00
Juan Batiz-Benet 0a68f258f5 p2p/net/swarm: fixed bugs in swarm err closes 2015-01-13 02:37:26 -08:00
Juan Batiz-Benet 81dbc35025 p2p/net/swarm: dial adding conn note 2015-01-13 01:23:43 -08:00
Juan Batiz-Benet 65768db04b p2p/net/swarm: const dial attempts 2015-01-13 01:18:51 -08:00
Juan Batiz-Benet 51f1fc34dd p2p/net/swarm cleaned up dial sync 2015-01-13 00:24:38 -08:00
Juan Batiz-Benet be2e7abfdc p2p/net/swarm: dial once at a time 2015-01-12 22:14:23 -08:00
Juan Batiz-Benet 23cf9d6fa5 p2p/net/swarm: dial - filter out own addrs 2015-01-12 21:27:21 -08:00
Juan Batiz-Benet 5c3adb60cf addr: proper filter + subtract 2015-01-12 20:49:06 -08:00
Juan Batiz-Benet 4d877044b7 p2p/net/swarm: fix connect self problems
This adds two checks after a successful conn.Dial
* if the remote peer is not who we wanted, close conn
* if the remove peer is outselves, close conn

(the second is redundant, but the codebase may evolve to
end up disabling the first check, so keeping the second
in place helps)

note:
Loopback addresses are actually sent out (they _have to be_,
in cases where there are >1 node in the same machine), so
many times when trying connections, nodes end up dialing
themselves.
2015-01-12 20:17:54 -08:00
Juan Batiz-Benet 63145110b6 p2p/net/swarm: do not usre link local addrs 2015-01-12 19:15:02 -08:00
Juan Batiz-Benet bb1d3d7d53 peers: was not setting the map...
cc @whyrusleeping
2015-01-12 11:20:57 -08:00
Juan Batiz-Benet d1c577e323 p2p/net/swarm/listener: consume peerstream listeners 2015-01-11 12:55:33 -08:00
Juan Batiz-Benet a1aec82c42 p2p/net/conn/Listener: ignore conns failed to secure
Instead of erroring out, which would break the listener,
we instead log a message and continue. This is not an error,
the internet is a place with lots of probing + connection
failures.
2015-01-11 12:55:33 -08:00
Juan Batiz-Benet aa7458b889 p2p/net/conn/listener: ignore certain errors
This should handle early breakages, where a failing connection
would take out the listener entirely.

There are probably other errors we should be handling here,
like secure connection failures.
2015-01-11 12:55:33 -08:00
Juan Batiz-Benet 0e4276e40a p2p/net/conn/dialer: added Dialer field 2015-01-11 12:55:33 -08:00
Brian Tiger Chow 2f19d9fb1e test: benchmark Sign and Verify operations
BenchmarkSign1B             1000           2406924 ns/op
BenchmarkSign10B            1000           2360527 ns/op
BenchmarkSign100B           1000           2354136 ns/op
BenchmarkSign1000B           500           2361775 ns/op
BenchmarkSign10000B          500           2415993 ns/op
BenchmarkSign100000B         500           2718051 ns/op
BenchmarkVerify1B          30000             52117 ns/op
BenchmarkVerify10B         30000             50968 ns/op
BenchmarkVerify100B        30000             51037 ns/op
BenchmarkVerify1000B       30000             56768 ns/op
BenchmarkVerify10000B      10000            105744 ns/op
BenchmarkVerify100000B      2000            628530 ns/op
2015-01-09 17:24:05 -08:00
Juan Batiz-Benet f3f1f058f9 swarm addr checks 2015-01-09 06:22:27 -08:00
Juan Batiz-Benet 0c78255ffb updated multiaddr 2015-01-09 06:13:24 -08:00
Juan Batiz-Benet 4681172907 reconnect p2p/ tests 2015-01-07 19:01:11 -08:00
Juan Batiz-Benet 00849f983c conn: close fixes 2015-01-07 19:01:10 -08:00
Juan Batiz-Benet 59bb732c01 p2p/test: bogus key pair for faster tests 2015-01-05 05:48:15 -08:00
Juan Batiz-Benet 3b0da8a33f peer/queue: close fix, and logging 2015-01-05 04:55:02 -08:00
Juan Batiz-Benet d03fad69b8 testutil: obvious names for seeded key pairs 2015-01-05 04:55:02 -08:00