Commit Graph

879 Commits

Author SHA1 Message Date
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
Juan Batiz-Benet f3c490a4e3 peer+mocknet: sorting for determinism. 2015-01-05 04:55:01 -08:00
Juan Batiz-Benet e4f1221ba0 vendor identify pb
not sure how it wasnt an error
2015-01-02 08:46:47 -08:00
Juan Batiz-Benet f645cb8c04 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 21580ccdab swap net2 -> net 2015-01-02 08:46:46 -08:00
Juan Batiz-Benet 08b8250c67 mocknet: use host 2015-01-02 08:46:46 -08:00
Juan Batiz-Benet 7c3202b11a 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 b54517ee61 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 2c6c64b2f6 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 1d3554e695 peerstore: AddPeerInfo 2015-01-02 08:46:46 -08:00
Juan Batiz-Benet 57b7903347 combined protocol and mux 2015-01-02 08:46:45 -08:00
Juan Batiz-Benet a103a2dac0 protocol and muxer pkg 2015-01-02 08:46:45 -08:00
Juan Batiz-Benet 72df463fd8 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 bfcb95d60c 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 0c1fe86b5e 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