Commit Graph

358 Commits

Author SHA1 Message Date
Juan Batiz-Benet
dfcea4c6f1 bootstrap: not error to not have enough bootstrap peers
use dht bootstrap. there is an edge case where the dht
is tiny (1?) and we have 0 bootstrap peers. we should
probably _inform_ the user, but this may be more a
webui or command thing.
2015-01-05 07:13:51 -08:00
Juan Batiz-Benet
474b74f70b dht/bootstrap: (optional) parallelism + error on peer
This also makes it an Error to find a peer.
2015-01-05 06:51:38 -08:00
Juan Batiz-Benet
59f47cfd34 dht: bootstrap query logging 2015-01-05 06:44:19 -08:00
Brian Tiger Chow
9e4b9714ce feat(core) dht.Bootstrap
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2015-01-05 06:25:25 -08:00
Juan Batiz-Benet
41af4f4ea1 dht test skips 2015-01-05 04:55:02 -08:00
Juan Batiz-Benet
172801712e dht: even more logging. 2015-01-05 04:55:02 -08:00
Juan Batiz-Benet
032b35b2ac dht: key without record validator func
This is causing test failures because tests don't usually
have "/-/-" format. we can decide whether or not to allow
keys without validators, but for now removing.

cc @whyrusleeping
2015-01-05 04:55:01 -08:00
Juan Batiz-Benet
ce367ee76e ext_test: bitten by mocknet ordering
mocknet indeterminism screwed this test up. that's twice
it's bitten us. let's not let it do it a third time.

cc @briantigerchow omg.
2015-01-05 04:55:01 -08:00
Juan Batiz-Benet
b4be7c5986 dht: extend duration of TestGetFailures
TestGetFailures may just be operating very slowly, instead
of completely failing. Right now it gets caught on travis
often. not sure if its actually wrong.
2015-01-05 00:16:54 -08:00
Juan Batiz-Benet
9c6228d18f bitswap and dht: lots of debugging logs 2015-01-05 00:16:53 -08:00
Juan Batiz-Benet
d357b0ac00 bitswap debug logging 2015-01-05 00:16:53 -08:00
Juan Batiz-Benet
17ce192af5 dht: some provider debug logging 2015-01-05 00:16:52 -08:00
Juan Batiz-Benet
3b6350331f dht: debug dont cast Key as peer.ID 2015-01-05 00:16:52 -08:00
Juan Batiz-Benet
8fb5cf9578 swap net2 -> net 2015-01-02 08:46:46 -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
Juan Batiz-Benet
49cb135ca2 ipfsnet -> swarmnet
swarmnet is a better name for the package, because
it's just a Network implemented with a Swarm.
(ipfsnet will be something slightly different).
2015-01-02 08:46:44 -08:00
Juan Batiz-Benet
4807127def net: move Network implementation to own pkg
I needed the network implementation in its own
package, because I'll be writing several services that
will plug into _it_ that shouldn't be part of the core net
package. and then there were dependency conflicts. yay.
mux + identify are good examples of what i mean.
2015-01-02 08:46:43 -08:00
Juan Batiz-Benet
ef182f11ed routing: use debugerror 2015-01-02 08:36:32 -08:00
Jeromy
da04d26779 clean up test setup interface 2015-01-02 08:33:42 +00:00
Jeromy
b4c6c87422 Improve readability of getClosestPeers method.
Also remove older useless code.
2015-01-02 07:42:09 +00:00
Jeromy
5af5625805 use query for getClosestPeers 2015-01-02 07:42:08 +00:00
Jeromy
46aa22e949 some better logging and cleanup 2015-01-02 07:42:08 +00:00
Juan Batiz-Benet
2ad23f0579 dht: fix TestLayeredGet
The test was occasionally passing because:
- it called `putLocal(key, val)`
- GetValue calls `getLocal(key)` optimistically.

cc @whyrusleeping
2015-01-02 07:42:08 +00:00
Jeromy
b4b6fe2214 a couple small fixes 2015-01-02 07:42:08 +00:00
Jeromy
07b064010e rewrite of provides to better select peers to send RPCs to
refactor test peer creation to be deterministic and reliable

a bit of cleanup trying to figure out TestGetFailure

add test to verify deterministic peer creation

switch put RPC over to use getClosestPeers

rm 0xDEADC0DE

fix queries not searching peer if its not actually closer
2015-01-02 07:42:07 +00:00
Brian Tiger Chow
0172e4f2bb style(testutil) rename testutil.Peer -> testutil.Identity
cc @jbenet
2014-12-24 09:59:24 -05:00
Brian Tiger Chow
2b2ff548e6 rename to dht 2014-12-24 09:38:51 -05:00
Brian Tiger Chow
ca32a83394 wip with DHT
@whyrusleeping @jbenet this is a WIP with the DHT.

wip

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>

Conflicts:
	epictest/addcat_test.go
	exchange/bitswap/testnet/peernet.go
	exchange/bitswap/testutils.go
	routing/mock/centralized_server.go
	routing/mock/centralized_test.go
	routing/mock/interface.go

fix(routing/mock) fill in function definition
2014-12-24 09:31:19 -05:00
Brian Tiger Chow
c253590770 refactor(routing/mock) move files 2014-12-24 09:31:18 -05:00
Juan Batiz-Benet
989d3d4ce5 dht/test skip bootstrap test when short 2014-12-24 05:39:48 -08:00
Juan Batiz-Benet
60c869d401 dht/test: providers test id compare 2014-12-24 04:23:15 -08:00
Juan Batiz-Benet
923c082d66 dht: cleaned up dht_test.
TestProversMany still fails
2014-12-24 03:48:02 -08:00
Juan Batiz-Benet
57510d2fec dht/dht_test: bootstrap synchronously. fares better. 2014-12-24 03:46:45 -08:00
Juan Batiz-Benet
618097d80e dht/query: log when dialing a closerpeer 2014-12-24 03:45:20 -08:00
Juan Batiz-Benet
8adda0fffc dht: bootstrap query constants 2014-12-24 03:44:03 -08:00
Juan Batiz-Benet
e630ca6078 dht: removing extra newlines 2014-12-24 03:42:43 -08:00
Juan Batiz-Benet
b5cbc8b6fa dht_test: better bootstrapping logging 2014-12-24 03:41:13 -08:00
Juan Batiz-Benet
ef0c25f463 dht bootstrap test: rounds. do nothing
odd behavior: only one dht (the last one) is seeing
changes to its routing table.
2014-12-24 03:24:52 -08:00
Juan Batiz-Benet
ccf6f79aa0 respect don contexteone 2014-12-24 03:24:28 -08:00
Juan Batiz-Benet
f8c523fc3b bootstrap test 2014-12-24 02:20:11 -08:00
Juan Batiz-Benet
cdb461d2a9 dht: update on every received message
i made a separate function because we may want to update our
routing table based on "closer peers". maybe not-- these could
all be lies.
2014-12-24 02:20:11 -08:00
Juan Batiz-Benet
61cdef3570 dht/query: fix important panic
Withe queries (particularly providers), it was possible to
exit the query runner's Run BEFORE all its children were done,
because the runner itself only listened to the context. This
introduced the possibility of a panic (you can go check it
out by running the TestProvidersMany test on dht_test in commits
before this one).  Thankfully, ctxgroup saved the day with
almost _zero_ changes to the sync flow, and now we have the
guarantee that the query runner will only exit if all its
children are done. ❤️

Conflicts:
	routing/dht/query.go
2014-12-24 02:13:38 -08:00
Juan Batiz-Benet
7d7e051101 dht bootstrap err check fix + logging 2014-12-24 02:10:52 -08:00
Juan Batiz-Benet
596602f37f routing table: better printing (see bkts) 2014-12-24 02:09:06 -08:00
Juan Batiz-Benet
ea2706c698 dht bugfix: unlock on print 2014-12-24 01:50:00 -08:00
Juan Batiz-Benet
04f9805d5d dht_test large providers test 2014-12-24 01:49:55 -08:00
Juan Batiz-Benet
a7eb52a7fa dht: helpful debugging for no closer peers 2014-12-23 09:03:26 -08:00
Juan Batiz-Benet
7952d95bbf added bootstrap logging 2014-12-23 08:48:58 -08:00
Juan Batiz-Benet
2c95cb5413 dht: bit nicer logging 2014-12-23 08:46:30 -08:00
Juan Batiz-Benet
c2b21e473d routing/mock test: kill leaked goroutine 2014-12-23 08:38:19 -08:00
Juan Batiz-Benet
c84a714b16 peer change: peer.Peer -> peer.ID
this is a major refactor of the entire codebase
it changes the monolithic peer.Peer into using
a peer.ID and a peer.Peerstore.

Other changes:
- removed handshake3.
-	testutil vastly simplified peer
-	secio bugfix + debugging logs
-	testutil: RandKeyPair
-	backpressure bugfix: w.o.w.
-	peer: added hex enc/dec
-	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.
-	updated peer/queue + peerset
-	latency metrics
-	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
- removed old spipe
- updated seccat
- core: cleanup initIdentity
- removed old getFromPeerList
2014-12-23 08:33:32 -08:00
Jeromy
9328fbaf81 clean peerset constructor names 2014-12-17 23:44:46 -08:00
Jeromy
69dd260236 refactor peerSet 2014-12-17 23:44:42 -08:00
Jeromy
2240272d85 change Provide RPC to not wait for an ACK, improves performance of 'Add' operations 2014-12-17 23:44:41 -08:00
Jeromy
cfbe92bc8b rewrite sendWantlistToProviders 2014-12-17 23:44:40 -08:00
Juan Batiz-Benet
de6eef9178 mv net/mock2 -> net/mock 2014-12-17 23:25:40 -08:00
Juan Batiz-Benet
dd33f6d9dc transition dht to mock2 2014-12-17 23:25:40 -08:00
Juan Batiz-Benet
ba323c3e48 make vendor 2014-12-17 23:25:38 -08:00
Juan Batiz-Benet
bc2d35fd4d Lots of fixes. DHT tests pass 2014-12-17 23:25:38 -08:00
Juan Batiz-Benet
41751b4938 Integrated new network into ipfs 2014-12-16 14:47:29 -08:00
Brian Tiger Chow
34b11a3b07 fix: routing mock accuracy
routing interface doesn't wait for value to appear in network, but value
doesn't appear in network until time as passed

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-15 20:46:43 -08:00
Brian Tiger Chow
3ecdec985f refactor(mockrouting) misc
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-13 05:30:33 -08:00
Brian Tiger Chow
8e0c8a7a7e refactor(mdag, bserv, bs) mocks, etc.
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-13 05:17:16 -08:00
Jeromy
8cdf566865 remove multilayered routing table from the DHT (for now) 2014-12-11 06:08:53 +00:00
Jeromy
9e14bcfe2d changes from PR 2014-12-11 05:42:05 +00:00
Jeromy
2d94b78480 rewrite FindProvidersAsync 2014-12-11 05:09:03 +00:00
Juan Batiz-Benet
26a44fcc06 dht: comment for asyncQueryBuffer 2014-12-08 21:55:51 -08:00
Juan Batiz-Benet
e0f11dff24 dht: FindPeersConnectedToPeer 2014-12-08 20:52:46 -08:00
Juan Batiz-Benet
d06bb6d826 dht: update to use net.LocalPeer 2014-12-08 20:52:45 -08:00
Juan Batiz-Benet
ff1e672d5a dht/pb: changed PeersToPBPeers to set ConnectionType
Uses an inet.Dialer
2014-12-08 20:52:45 -08:00
Juan Batiz-Benet
94f04c7fcc net: add Connectedness var. 2014-12-08 20:52:45 -08:00
Juan Batiz-Benet
26e7656164 dht tests: dont introduce nil multiaddr
this is the type of assumption we shouldn't violate.
2014-12-08 20:52:45 -08:00
Juan Batiz-Benet
c5c0e7e8f3 dht: changed msgs, include multiple addrs + conn type
See https://github.com/jbenet/go-ipfs/issues/153#issuecomment-63350535
2014-12-08 20:52:34 -08:00
Juan Batiz-Benet
a1237733c2 dht: linting 2014-12-08 19:28:05 -08:00
Brian Tiger Chow
b799ddef58 refactor(dht) remove extraneous return value
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-08 16:28:22 -08:00
Brian Tiger Chow
c67286774c silence verbose output
for higher SnR at IPFS_LOGGING=info

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-08 15:07:33 -08:00
Brian Tiger Chow
74eb03231d fix(core, peer) helpers to testutil, err handling
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-08 14:32:52 -08:00
Brian Tiger Chow
d77c4bb5e0 refactor(peer): create peer through peerstore
for safety!

use mockpeer.WithID methods to create peers in tests

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-08 02:10:42 -08:00
Brian Tiger Chow
73a89e161d refactor(peerstore) s/Get/FindOrCreate
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-08 02:10:42 -08:00
Brian Tiger Chow
f7cb6b9963 fix: respect ctx on receive
@jbenet

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-05 22:54:16 -08:00
Brian Tiger Chow
251b916ce9 style: readability
@jbenet

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-05 20:56:28 -08:00
Brian Tiger Chow
0f6b1bc73e fix(dht/routing) buffer promise response to prevent resource leak
When performing this "promise" pattern, it is important to
provide a
channel with space for one value. Otherwise the sender may
block forever
in the case of a receiver that decides to abandon the
request. A subtle
detail, but one that is important for avoiding
leaked goroutines.

cc @whyrusleeping @jbenet

License: MIT
Signed-off-by: Brian Tiger Chow
<brian@perfmode.com>

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-05 20:56:27 -08:00
Brian Tiger Chow
de374226be fix(dht/routing) make GetProviders respect context
This commit makes GetProviders (sync) respect the request context. It
also amends all of GetProviders' callsites to pass a context in. This
meant changing the signature of the dht's handlerfunc.

I think I'll start referring to the request context as Vito Corleone.

cc @whyrusleeping @jbenet

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-05 20:56:27 -08:00
Brian Tiger Chow
f756088d26 fix(routing/dht) _always_ close chan on exit of FindProvidersAsync
the important change here is that within FindProvidersAsync, the channel
is closed using a `defer`. This ensures the channel is always closed,
regardless of the path taken to exit.

+ misc cleanup

cc @whyrusleeping @jbenet

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-05 20:56:27 -08:00
Jeromy
260ace7f81 util keys need to be pointers for loggable 2014-12-05 20:53:33 +00:00
Jeromy
6552163740 add readme for bitswap 2014-12-05 20:53:33 +00:00
Jeromy
e8536db351 make bitswap sub-RPC's timeout (slowly for now) 2014-12-05 20:53:33 +00:00
Jeromy
c2b497e315 switch over to using sendMessage vs sendRequest 2014-12-05 20:53:32 +00:00
Jeromy
e4b2ae3bb2 fix tests halting 2014-12-05 20:53:21 +00:00
Brian Tiger Chow
3ed9b0c4e1 log(dht) Event: connect
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-11-25 06:16:40 -08:00
Brian Tiger Chow
b8c96b2505 log(dht) add eventlog.Update event
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-11-25 06:16:39 -08:00
Brian Tiger Chow
1c4c7412b4 fix(misc) address PR comments
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-11-16 07:40:05 -08:00
Brian Tiger Chow
6fec76d93e fix(imports) misc
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-11-16 07:01:00 -08:00
Brian Tiger Chow
25c98e8e61 refactor(eventlog) elog -> eventlog
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>

# TYPES
# feat
# fix
# docs
# style (formatting, missing semi colons, etc; no code change):
# refactor
# test (adding missing tests, refactoring tests; no production code change)
# chore (updating grunt tasks etc; no production code change)

Signed-off-by: Brian Tiger Chow <brian.holderchow@gmail.com>
2014-11-16 07:01:00 -08:00
Brian Tiger Chow
4b1607819f log(dht) log a couple events to demonstrate API
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-11-16 07:00:58 -08:00
Jeromy
f45d575a96 address comments from PR 2014-11-16 02:45:20 -08:00
Jeromy
cd4e23bc2e some comments 2014-11-16 02:45:20 -08:00
Jeromy
f21ec1923a verify ipns records 2014-11-16 02:45:19 -08:00