Commit Graph

413 Commits

Author SHA1 Message Date
rht c62870fba3 Run 'gofmt -s -w' on these files 2015-05-19 06:11:15 +07:00
Juan Batiz-Benet 951984301c net/p2p + secio: parallelize crypto handshake
We had a very nasty problem: handshakes were serial so incoming
dials would wait for each other to finish handshaking. this was
particularly problematic when handshakes hung-- nodes would not
recover quickly. This led to gateways not bootstrapping peers
fast enough.

The approach taken here is to do what crypto/tls does:
defer the handshake until Read/Write[1]. There are a number of
reasons why this is _the right thing to do_:
- it delays handshaking until it is known to be necessary (doing io)
- it "accepts" before the handshake, getting the handshake out of the
  critical path entirely.
- it defers to the user's parallelization of conn handling. users
  must implement this in some way already so use that, instead of
  picking constants surely to be wrong (how many handshakes to run
  in parallel?)

[0] http://golang.org/src/crypto/tls/conn.go#L886
2015-05-12 05:54:09 -04:00
Dominic Tarr d71990d83d make comments describe what code actually does. 2015-05-06 15:33:26 +12:00
Juan Batiz-Benet 54b1106382 Merge pull request #1181 from ipfs/fix/mega-read
quick fix for OOM panic that has been plaguing us
2015-05-05 00:58:15 -04:00
Jeromy 333ef67d71 quick fix for OOM panic that has been plaguing us 2015-05-01 23:24:47 -07:00
Juan Batiz-Benet 98c4e3f6d5 Merge pull request #1160 from ipfs/fix/dial-error-hiding
Fix/dial error hiding
2015-05-01 03:27:11 -07:00
Juan Batiz-Benet 9058b77174 Merge pull request #1165 from ipfs/fix/mdns-addr
advertise multiple addresses over mdns
2015-05-01 01:20:43 -07:00
Jeromy Johnson ba120bcd38 Update swarm_dial.go 2015-04-30 13:19:56 -07:00
Jeromy a8041e64bf use ALL THE ADDRESSES! 2015-04-29 01:02:45 -07:00
Jeromy 0795217c60 dont advertise loopback address over mdns 2015-04-28 22:08:46 -07:00
Jeromy 715f8950a0 bring some errors that were being hidden in the dial sequence to the surface 2015-04-28 13:57:15 -07:00
Henry f62ab58ce2 godeps: move (go)goprotobuf to github location 2015-04-28 13:42:22 +02:00
Henry 4a260476a8 protocolEOF: demoted EOF to Debug, kept the else as Warning 2015-04-28 10:32:55 +02:00
Henry 8bcd3e5920 only warn about io.EOF from mux.ReaderHeaders (fixes #1143) 2015-04-28 10:32:55 +02:00
Jeromy 906944b26c cleanup changes from PR 2015-04-22 01:25:22 -07:00
Jeromy 4493535ddd implement a config option for mdns 2015-04-22 00:55:31 -07:00
Juan Batiz-Benet bc183f1a79 vendored mdns deps 2015-04-21 23:57:48 -07:00
Jeromy 6e58f4bec1 implement basic peer discovery using mdns 2015-04-21 21:34:54 -07:00
Juan Batiz-Benet b595735032 remove debugerrors
We now consider debugerrors harmful: we've run into cases where
debugerror.Wrap() hid valuable error information (err == io.EOF?).
I've removed them from the main code, but left them in some tests.
Go errors are lacking, but unfortunately, this isn't the solution.

It is possible that debugerros.New or debugerrors.Errorf should
remain still (i.e. only remove debugerrors.Wrap) but we don't use
these errors often enough to keep.
2015-04-20 00:35:35 -07:00
Jeromy 044af69129 increase window size for yamux streams 2015-04-16 20:56:40 -07:00
Juan Batiz-Benet 6ed5f07b62 secio: better error detection
The same keys + nonces in secio were being observed. As described in
https://github.com/ipfs/go-ipfs/issues/1016 -- the handshake must
be talking to itself. This can happen in an outgoing TCP dial with
REUSEPORT on to the same address.
2015-04-13 21:52:56 -07:00
Jeromy 0d0ba8ae9a log listeners dying as at least a warning 2015-04-11 18:21:22 -07:00
Juan Batiz-Benet 9dbbe6db05 reuseport: env var to turn it off
reuseport is a hack. It is necessary for us to do certain kinds of
tcp nat traversal. Ideally, reuseport would be available in go:

  https://github.com/golang/go/issues/9661

But until that issue is fixed, we're stuck with this. In some cases,
reuseport is strictly a detriment: nodes are not NATed. This commit
introduces an ENV var IPFS_REUSEPORT that can be set to false to
avoid using reuseport entirely:

  IPFS_REUSEPORT=false ipfs daemon

This approach addresses our current need. It could become a config
var if necessary. If reuseport continues to give problems, we should
look into improving it.
2015-04-08 00:19:12 -07:00
Tor Arne Vestbø ca5b43edac Extend logging when peer handshake detects clashing/same keys 2015-04-07 13:20:46 +02:00
Jeromy 44309cd502 bandwidth metering on streams
humanize bandwidth output

instrument conn.Conn for bandwidth metrics

add poll command for continuous bandwidth reporting

move bandwidth tracking onto multiaddr net connections

another mild refactor of recording locations

address concerns from PR

lower mock nodes in race test due to increased goroutines per connection
2015-03-31 19:58:08 -07:00
Ho-Sheng Hsiao ac98d23b65 Reorged imports from jbenet/go-ipfs to ipfs/go-ipfs
- Modified Godeps/Godeps.json by hand
- [TEST] Updated welcome docs hash to sharness
- [TEST] Updated contact doc
- [TEST] disabled breaking test (t0080-repo refs local)
2015-03-31 12:52:25 -07:00
Juan Batiz-Benet a47b897105 added cancel func calls previously ignored 2015-03-07 09:31:46 -08:00
Alex 236dfd1e18 Implemented @jbenet's suggestion to avoid panics if peerID is of length 0. 2015-03-03 09:20:23 -08:00
Alex 4b52be2807 Fixed #780 2015-03-02 23:53:30 -08:00
Henry f71d1733dc godep&x/crypto: updated multihash and moved to x/crypto for blowfish 2015-03-01 00:49:44 +01:00
Henry e73da92c04 rewrote import paths of go.net/context to use golang.org/x/context
- updated go-ctxgroup and goprocess
ctxgroup: AddChildGroup was changed to AddChild. Used in two files:
- p2p/net/mock/mock_net.go
- routing/dht/dht.go

- updated context from hg repo to git
prev. commit in hg was ad01a6fcc8a19d3a4478c836895ffe883bd2ceab. (context: make parentCancelCtx iterative)
represents commit 84f8955a887232b6308d79c68b8db44f64df455c in git repo

- updated context to master (b6fdb7d8a4ccefede406f8fe0f017fb58265054c)

Aaron Jacobs (2):
net/context: Don't accept a context in the DoSomethingSlow example.
context: Be clear that users must cancel the result of WithCancel.

Andrew Gerrand (1):
go.net: use golang.org/x/... import paths

Bryan C. Mills (1):
net/context: Don't leak goroutines in Done example.

Damien Neil (1):
context: fix removal of cancelled timer contexts from parent

David Symonds (2):
context: Fix WithValue example code.
net: add import comments.

Sameer Ajmani (1):
context: fix TestAllocs to account for ints in interfaces
2015-02-25 11:58:19 +01:00
Jeromy 83ea98ed5e fix weird race condition in goprocess that caused a few panics 2015-02-19 20:01:19 -08:00
Jeromy 1f0bbc476a allow removal of stream handlers 2015-02-18 19:11:37 +00:00
Jeromy 3281065076 keep routing logic out of NewStream on routedHost 2015-02-18 19:11:37 +00:00
Jeromy 90fa929051 make NewStream run FindPeer if no addresses found 2015-02-18 19:11:37 +00:00
Juan Batiz-Benet 01be69d391 routed host stash 2015-02-18 18:56:56 +00:00
Brian Tiger Chow 62d4f17057 misc: suppress logs to Debug (from Info) 2015-02-14 14:13:53 -08:00
Jeromy 9c83bd0959 fix for #757 2015-02-13 07:47:51 +00:00
Juan Batiz-Benet d2544da530 p2p/net/conn: respect context on dialing
We were half-way with this. there's no way for net.Dialers
to respect contexts, so we have to let the dial finish in
the background.
2015-02-11 09:12:15 -08:00
Juan Batiz-Benet 46b21cf5be ctx.Done fixes
thanks @whyrusleeping for finding these.
2015-02-09 23:18:23 -08:00
Juan Batiz-Benet 8a81975ce8 ratelimiter: fixing rate limiter use
Use of the ratelimiter should be conscious of the ratelimiter's
potential closing. any loops that add work to ratelimiter
should (a) only do so if the rate limiter is not closed,
or (b) prevent limiter while work is added
(i.e. use limiter.Go(addWorkHere))
2015-02-06 10:59:03 -08:00
Juan Batiz-Benet 381e99a375 p2p/protocol/identity: smarter tracking observed addrs
- time them out (already was doing that with addrbook)
- keep count to counter symmetric nats
2015-02-05 10:15:16 -08:00
Juan Batiz-Benet e13ad02f04 test/mocknet: this test fails on CI sometimes 2015-02-03 08:02:25 -08:00
Juan Batiz-Benet 72b70417a7 cmds/swarm connect had broken 2015-02-03 05:51:31 -08:00
Juan Batiz-Benet 3afbc9d8d9 logs: removed all log.Errors unhelpful to users
Let's save log.Error for things the user can take action on.
Moved all our diagnostics to log.Debug. We can ideally reduce them
even further.
2015-02-03 01:06:07 -08:00
Juan Batiz-Benet e3e91a4d24 p2p/crypto/secio: dont bother user with mac errs. 2015-02-02 21:05:33 -08:00
Juan Batiz-Benet 46877f3f44 p2p/protocol/id: log version mismatch disconnects 2015-02-02 21:05:33 -08:00
Juan Batiz-Benet 884699e1e7 p2p/protocol/id: break on version mismatch.
TODOs:
- need to consolidate all the versioning stuff into one package
- need to do the version check as a handshake, before further
  communication happens. we used to do this.
2015-02-02 21:05:32 -08:00
Juan Batiz-Benet 8b419c5de4 p2p/net/swarm: permute addrs in rate limited dials
so that we dont get stuck dialing bad addrs first always.
2015-02-02 21:04:14 -08:00
Juan Batiz-Benet 51709847e6 p2p/net/swarm: rate limit dials. max of 10 addrs at a time.
This will mitigate the fd explosion, but slow down dials majorly
as any peer with more addresses than the rate limit will have
to wait a whole dial timeout (~15s)
2015-02-02 21:04:14 -08:00