Commit Graph

2381 Commits

Author SHA1 Message Date
Juan Batiz-Benet
7aca07e2be Routing interface uses peer.PeerInfo
Providers are records that need Addresses. The routing
system needs to provide -- not only the ID, but also --
the peer's Addresses. A peer.PeerInfo is a small struct
to pass around a peer.ID and []ma.Multiaddr.
2014-12-20 13:49:22 -08:00
Juan Batiz-Benet
0b12fd65df peer.PeerInfo comment accuracy 2014-12-20 13:39:36 -08:00
Juan Batiz-Benet
02e5692397 kbucket now uses peer.ID 2014-12-20 13:26:52 -08:00
Juan Batiz-Benet
4391ba4ff4 testutil: use crand for PeerID gen
RandPeerID generates random "valid" peer IDs. it does not
NEED to generate keys because it is as if we lost the key
right away. fine to read some randomness and hash it. to
generate proper keys and an ID, use:

  sk, pk, _ := testutil.RandKeyPair()
  id, _ := peer.IDFromPublicKey(pk)

Also added RandPeerIDFatal helper
2014-12-20 13:26:27 -08:00
Juan Batiz-Benet
3c5f484d58 latency metrics 2014-12-19 23:49:36 -08:00
Juan Batiz-Benet
5931546507 updated peer/queue + peerset 2014-12-19 22:24:31 -08:00
Juan Batiz-Benet
423cd2cc8d peer: added a PeerInfo struct
PeerInfo is a small struct used to pass around a peer with
a set of addresses and keys. This is not meant to be a
complete view of the system, but rather to model updates to
the peerstore. It is used by things like the routing system.
2014-12-19 22:23:09 -08:00
Juan Batiz-Benet
20068c8637 peer: added hex enc/dec 2014-12-19 22:22:54 -08:00
Juan Batiz-Benet
a6491df052 backpressure bugfix: w.o.w.
i dont even know how that was passing
2014-12-19 21:56:57 -08:00
Juan Batiz-Benet
b8a3c3d770 backpressure now uses peer.ID 2014-12-19 21:56:30 -08:00
Juan Batiz-Benet
fc56ffee00 mocknet now uses peer.ID 2014-12-19 21:29:12 -08:00
Juan Batiz-Benet
b70f40113d network now uses peer.ID 2014-12-19 21:29:05 -08:00
Juan Batiz-Benet
8ec6f3d34c testutil: RandKeyPair 2014-12-19 21:28:41 -08:00
Juan Batiz-Benet
e535b0e520 swarm now uses peer.ID 2014-12-19 21:05:18 -08:00
Juan Batiz-Benet
35f1d3c236 threadsafe SeededRand 2014-12-19 21:01:14 -08:00
Juan Batiz-Benet
6818090249 peerstore: added privkey holding 2014-12-19 20:10:47 -08:00
Juan Batiz-Benet
618794cbed Moved PeerNetParams + shortened tests 2014-12-19 19:58:17 -08:00
Juan Batiz-Benet
d1b5450875 secio: comment out hyperverbose debugging
this is really only useful when debugging that one pkg.

I wish "debug" could be easily set on only one "pkg" at a time,
making everything else Info+.
2014-12-19 19:46:04 -08:00
Juan Batiz-Benet
57c7ffab44 conn: with new peer.ID 2014-12-19 19:44:59 -08:00
Juan Batiz-Benet
fbee577d3b secio: at last! bugfix found. 2014-12-19 19:36:01 -08:00
Juan Batiz-Benet
16497ed7a3 more secio debugging 2014-12-19 19:35:50 -08:00
Juan Batiz-Benet
c49580044d peer fix: String() uses Pretty 2014-12-19 19:15:37 -08:00
Juan Batiz-Benet
30558d40ff secio debugging 2014-12-19 19:14:57 -08:00
Juan Batiz-Benet
d5c37aefdf testutil vastly simplified peer 2014-12-19 12:34:09 -08:00
Juan Batiz-Benet
fc10d6937d peer: test key/id relationship 2014-12-19 12:29:23 -08:00
Juan Batiz-Benet
32e03413c6 removed handshake3. 2014-12-19 12:20:31 -08:00
Juan Batiz-Benet
d16eb663c4 peer change 2014-12-19 12:20:30 -08:00
Juan Batiz-Benet
8079e04fe2 key marshalling 2014-12-19 12:20:30 -08:00
Juan Batiz-Benet
afd6680208 Merge pull request #438 from jbenet/bitswap-rounds
Bitswap rounds
2014-12-17 23:50:29 -08:00
Brian Tiger Chow
9fafec1256 do not run epic tests in parallel
@whyrusleeping

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-17 23:44:46 -08:00
Jeromy
9328fbaf81 clean peerset constructor names 2014-12-17 23:44:46 -08:00
Brian Tiger Chow
8100582e38 fix: batches of blocks have equal priority
addresses...

https://github.com/jbenet/go-ipfs/pull/438/files#r21878994

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-17 23:44:46 -08:00
Brian Tiger Chow
bd3ee739b9 doc: some comments about the future of the decision engine
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-17 23:44:46 -08:00
Brian Tiger Chow
ce2d0a2258 fix: add lock to taskQueue
@whyrusleeping may wanna have a look and make sure i didn't screw
anything up here

BenchmarkInstantaneousAddCat1MB-4            200          10763761 ns/op
97.42 MB/s
BenchmarkInstantaneousAddCat2MB-4       panic: runtime error: invalid
memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0xbedd]

goroutine 14297 [running]:
github.com/jbenet/go-ipfs/exchange/bitswap/decision.(*taskQueue).Remove(0xc2087553a0,
        0xc2085ef200, 0x22, 0x56f570, 0xc208367a40)
    /Users/btc/go/src/github.com/jbenet/go-ipfs/exchange/bitswap/decision/taskqueue.go:66
    +0x82
github.com/jbenet/go-ipfs/exchange/bitswap/decision.(*Engine).MessageSent(0xc20871b5c0,
        0x56f570, 0xc208367a40, 0x570040, 0xc208753d40, 0x0, 0x0)
    /Users/btc/go/src/github.com/jbenet/go-ipfs/exchange/bitswap/decision/engine.go:177
    +0x29e
github.com/jbenet/go-ipfs/exchange/bitswap.(*bitswap).send(0xc20871b7a0,
        0x56f4d8, 0xc208379800, 0x56f570, 0xc208367a40,
        0x570040, 0xc208753d40, 0x0, 0x0)
    /Users/btc/go/src/github.com/jbenet/go-ipfs/exchange/bitswap/bitswap.go:352
    +0x11c
github.com/jbenet/go-ipfs/exchange/bitswap.(*bitswap).taskWorker(0xc20871b7a0,
        0x56f4d8, 0xc208379800)
    /Users/btc/go/src/github.com/jbenet/go-ipfs/exchange/bitswap/bitswap.go:238
    +0x165
    created by
    github.com/jbenet/go-ipfs/exchange/bitswap.New
    /Users/btc/go/src/github.com/jbenet/go-ipfs/exchange/bitswap/bitswap.go:66
    +0x49e
2014-12-17 23:44:46 -08:00
Brian Tiger Chow
175513e281 refactor(bs/decision.Engine): pass in Entry
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-17 23:44:46 -08:00
Brian Tiger Chow
4bcfe094a1 extract constants
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-17 23:44:46 -08:00
Brian Tiger Chow
0545c4d15d refactor: *Entry -> Entry
in many places, entries are assigned from one slice to another and in
different goroutines. In one place, entries were modified (in the
queue). To avoid shared mutable state, probably best to handle entries
by value.

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-17 23:44:46 -08:00
Brian Tiger Chow
19764880d8 doc: peerset fixme
not changing this because i don't want to write a test for it now

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-17 23:44:46 -08:00
Brian Tiger Chow
45faa4d7a0 fix: set peerset size
addresses https://github.com/jbenet/go-ipfs/pull/438#discussion_r21952271

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-17 23:44:45 -08:00
Brian Tiger Chow
e36d656632 log unusual event
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-17 23:44:45 -08:00
Brian Tiger Chow
2b60b641c4 fix: check blockstore before adding task
addresses https://github.com/jbenet/go-ipfs/pull/438#discussion_r21953742

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-17 23:44:45 -08:00
Brian Tiger Chow
6e7c46a6e2 unexport functions
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-17 23:44:45 -08:00
Brian Tiger Chow
9c301a2d77 add comment
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-17 23:44:45 -08:00
Brian Tiger Chow
1b1260b658 rm unused method
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-17 23:44:45 -08:00
Brian Tiger Chow
8d4d5b86ef fix: don't sort the output of Entries()
only sort SortedEntries()

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-17 23:44:45 -08:00
Brian Tiger Chow
acc714823b rename to peerRequestQueue
this opens up the possibility of having multiple queues. And for all
outgoing messages to be managed by the decision engine

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-17 23:44:45 -08:00
Brian Tiger Chow
1d23e94f16 rm empty file
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-17 23:44:45 -08:00
Brian Tiger Chow
5bd0b95462 rename to strategy.LedgerManager to decision.Engine
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-17 23:44:44 -08:00
Brian Tiger Chow
bef622222d refactor: wantlist splits into WL and ThreadSafe WL
bitswap keeps the threadsafe version. observing the ledger shows that it
doesn't need it anymore (ledgermanager is protected and safe).

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-17 23:44:44 -08:00
Brian Tiger Chow
d069ae11f4 refactor: put mutex next to the things it protects
If we put the lock next to the fields it protects, it can sometimes make
it easier to reason about threadsafety.

In this case, it reveals that the task queue (not threadsafe) isn't protected by the
mutex, yet shared between the worker and callers.

@whyrusleeping

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-17 23:44:44 -08:00