Commit Graph

119 Commits

Author SHA1 Message Date
Juan Batiz-Benet
1ec8874077 p2p/net/swarm + conn: logs + debugerr output 2015-01-23 01:52:42 -08:00
Juan Batiz-Benet
0821a5bd53 p2p/net/swarm: half the timeout of dial 2015-01-23 01:52:41 -08:00
Juan Batiz-Benet
10ae01f624 p2p/net/swarm/addr: check for nil addr 2015-01-23 01:46:56 -08:00
Juan Batiz-Benet
223a97f3f8 p2p/net/conn: only reuseport if avail 2015-01-20 19:46:44 -08:00
Juan Batiz-Benet
239e82390f p2p/test/reconnect: fixed race condition 2015-01-20 10:57:45 -08:00
Juan Batiz-Benet
6de542b1eb 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
60cecefc60 p2p/net/conn: log when reuse fails 2015-01-19 23:18:52 -08:00
Juan Batiz-Benet
e59b88dace 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
289f24207e p2p/test/reconnects: faster tests 2015-01-19 23:18:51 -08:00
Juan Batiz-Benet
334f9d2102 p2p/net/conn: use reuseport 2015-01-19 23:18:51 -08:00
Brian Tiger Chow
03486a5109 rm unused proto
cc @jbenet @whyrusleeping
2015-01-18 14:41:42 -08:00
Brian Tiger Chow
aec0b31d44 eventlog: rm noisy low-signal statement 2015-01-18 14:41:42 -08:00
Brian Tiger Chow
fce04f445a hold lock during map access 2015-01-18 14:33:41 -08:00
Brian Tiger Chow
884143bf9c move generic packages to thirdparty (see thirdparty/README.md) 2015-01-18 14:04:45 -08:00
Jeromy
3c55902811 rewrite as single line defer logs 2015-01-15 04:45:34 +00:00
Jeromy
bae8b9f4c0 starting to move important events over to EventBegin/Done 2015-01-15 04:17:17 +00:00
Brian Tiger Chow
c341df0a4c fix(mux) expose method to SetDefaultHandler 2015-01-14 16:26:21 -08:00
Brian Tiger Chow
2678795dac fix: privatize Mux fields 2015-01-14 16:18:01 -08:00
Juan Batiz-Benet
0311c0518d 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
6959b4f032 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
670b2b59b5 p2p/net/swarm: fix racey test 2015-01-13 22:46:41 -08:00
Juan Batiz-Benet
102c43a3b1 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
d9a815b3a0 p2p/net/swarm: nicer test timeouts for travis 2015-01-13 08:42:46 -08:00
Juan Batiz-Benet
1272bb6651 p2p/net/swarm: parallelize tests. poor travis. 2015-01-13 08:16:02 -08:00
Juan Batiz-Benet
baf2541237 p2p/net/swarm: extensive dial tests 2015-01-13 08:15:26 -08:00
Juan Batiz-Benet
7f3a651f5d p2p/net/swarm: sync diagram explain 2015-01-13 08:14:35 -08:00
Juan Batiz-Benet
f58276d6d2 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
9689b280e6 p2p/net/swarm: configurable timeout for tests 2015-01-13 08:12:45 -08:00
Juan Batiz-Benet
af889dc182 p2p/net/swrm: InterfaceListenAddrs now method 2015-01-13 05:58:49 -08:00
Juan Batiz-Benet
70ceaa975d 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
8de8ed0842 p2p/net/swarm: dial timeout to 10s + dialer 2015-01-13 04:08:08 -08:00
Juan Batiz-Benet
5b4a3c09bd 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
5b3164de5c refactor(repo/config) move config under repo 2015-01-13 03:09:30 -08:00
Juan Batiz-Benet
e3eaa154af p2p/net/swarm: fixed bugs in swarm err closes 2015-01-13 02:37:26 -08:00
Juan Batiz-Benet
8e888b1d79 p2p/net/swarm: dial adding conn note 2015-01-13 01:23:43 -08:00
Juan Batiz-Benet
25c6ab8a26 p2p/net/swarm: const dial attempts 2015-01-13 01:18:51 -08:00
Juan Batiz-Benet
90d654d55c p2p/net/swarm cleaned up dial sync 2015-01-13 00:24:38 -08:00
Juan Batiz-Benet
fcece3e32e p2p/net/swarm: dial once at a time 2015-01-12 22:14:23 -08:00
Juan Batiz-Benet
9b4d42f7b0 p2p/net/swarm: dial - filter out own addrs 2015-01-12 21:27:21 -08:00
Juan Batiz-Benet
7aa4a83f2e addr: proper filter + subtract 2015-01-12 20:49:06 -08:00
Juan Batiz-Benet
ddd5c4faee 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
7ec1a674e3 p2p/net/swarm: do not usre link local addrs 2015-01-12 19:15:02 -08:00
Juan Batiz-Benet
711bb6a054 peers: was not setting the map...
cc @whyrusleeping
2015-01-12 11:20:57 -08:00
Juan Batiz-Benet
4e2431a0e4 p2p/net/swarm/listener: consume peerstream listeners 2015-01-11 12:55:33 -08:00
Juan Batiz-Benet
b7a4e92121 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
4525269cd8 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
387c0508fe p2p/net/conn/dialer: added Dialer field 2015-01-11 12:55:33 -08:00
Brian Tiger Chow
d01aaa97c4 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
06299297c5 swarm addr checks 2015-01-09 06:22:27 -08:00
Juan Batiz-Benet
19a5f088d5 updated multiaddr 2015-01-09 06:13:24 -08:00
Juan Batiz-Benet
84a2a59155 reconnect p2p/ tests 2015-01-07 19:01:11 -08:00
Juan Batiz-Benet
74a2f2b074 conn: close fixes 2015-01-07 19:01:10 -08:00
Juan Batiz-Benet
1ab9588cba p2p/test: bogus key pair for faster tests 2015-01-05 05:48:15 -08:00
Juan Batiz-Benet
f25dfb68b9 peer/queue: close fix, and logging 2015-01-05 04:55:02 -08:00
Juan Batiz-Benet
09a2e1f64c testutil: obvious names for seeded key pairs 2015-01-05 04:55:02 -08:00
Juan Batiz-Benet
9d0736bc3b peer+mocknet: sorting for determinism. 2015-01-05 04:55:01 -08:00
Juan Batiz-Benet
85e3024731 vendor identify pb
not sure how it wasnt an error
2015-01-02 08:46:47 -08:00
Juan Batiz-Benet
feb5e495f5 use ZeroLocalTCPAddress for network tests
This commit makes all network tests use ZeroLocalTCPAddress
as the initial peer address, and then relies on
net.ListenAddresses()

This should get rid of the tcp addr clash problems.
2015-01-02 08:46:46 -08:00
Juan Batiz-Benet
8fb5cf9578 swap net2 -> net 2015-01-02 08:46:46 -08:00
Juan Batiz-Benet
128e820ccb mocknet: use host 2015-01-02 08:46:46 -08:00
Juan Batiz-Benet
dadb8b775b host interface + services
The separation of work in the p2p pkg is as follows:

- net implements the Swarm and connectivity
- protocol has muxer and header protocols
- host implements protocol muxing + services
- identify took over handshake completely! yay.
- p2p package works as a whole
2015-01-02 08:46:46 -08:00
Juan Batiz-Benet
d322824874 net2: separate protocols/services out.
using a placeholder net2 package so tests continue to pass.
Will be swapped atomically into main code.
2015-01-02 08:46:46 -08:00
Juan Batiz-Benet
ba09447251 mux: close stream on error
remove comment about spdystream. this is now
superceded by go-peerstream interface.
2015-01-02 08:46:46 -08:00
Juan Batiz-Benet
53d190da2c peerstore: AddPeerInfo 2015-01-02 08:46:46 -08:00
Juan Batiz-Benet
0ef035ef08 combined protocol and mux 2015-01-02 08:46:45 -08:00
Juan Batiz-Benet
e0b9a368b8 protocol and muxer pkg 2015-01-02 08:46:45 -08:00
Juan Batiz-Benet
e2698a8733 net -> p2p/net
The net package is the next to move. It will be massaged
a bit still to fix the Network / "NetworkBackend" conflict.
2015-01-02 08:46:45 -08:00
Juan Batiz-Benet
cc0d7c9b57 crypto -> p2p/crypto
The crypto package moves into p2p. Nothing in it so far is ipfs
specific; everything is p2p-general.
2015-01-02 08:46:45 -08:00
Juan Batiz-Benet
89f5cd4c94 introducing p2p pkg
I think it's time to move a lot of the peer-to-peer networking
but-not-ipfs-specific things into its own package: p2p.
This could in the future be split off into its own library.
The first thing to go is the peer.
2015-01-02 08:46:45 -08:00