Commit Graph

358 Commits

Author SHA1 Message Date
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
Jeromy
0982597e35 make vendor 2014-11-16 02:45:19 -08:00
Jeromy
01451c214e fix routing resolver 2014-11-16 02:45:19 -08:00
Jeromy
1cf7a1824a validator functions and ipns completion 2014-11-16 02:45:19 -08:00
Jeromy
cb23d5b2ae fix validators and key prefix 2014-11-16 02:45:19 -08:00
Jeromy
33985c530e switch DHT entries over to be records, test currently fail 2014-11-16 02:45:19 -08:00
Brian Tiger Chow
ed4a8eb782 chore(tests) add Short() -> SkipNow() to slowest tests
vanilla:
    21.57 real        45.14 user         8.51 sys

short:
    14.40 real        31.13 user         5.56 sys

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-11-15 02:10:53 -08:00
Jeromy
d4c819e97d log -> logf 2014-11-12 10:39:11 -08:00
Jeromy
be5d01b6a6 more doc comments 2014-11-08 22:44:37 -08:00
Jeromy
d98808fad9 comments on vars in dht 2014-11-08 21:57:11 -08:00
Jeromy
4f083d54d6 write a few package doc strings to improve look of godoc 2014-11-08 21:42:36 -08:00
Brian Tiger Chow
23096de3c4 fix(net) pass contexts to dial peer 2014-11-05 10:04:20 -08:00
Juan Batiz-Benet
70f796afd6 fixed dht race #270 2014-11-05 09:26:17 -08:00
Juan Batiz-Benet
0135e3ebbe swarm + net: add explicit listen addresses 2014-11-05 04:00:49 -08:00
Jeromy
88bf39118c comment comment comment comment 2014-11-03 03:02:56 +00:00
Jeromy
5edbca2e70 cleanup from CR 2014-11-01 16:07:56 -07:00
Jeromy
07733b17b3 msgio pooling first hack 2014-11-01 16:07:56 -07:00
Jeromy
317ca2f865 benchmark secure channel 2014-11-01 16:07:56 -07:00
Jeromy
ae339a0320 remove dagwriter in favor of new importer function 2014-10-31 05:03:42 +00:00
Juan Batiz-Benet
01a583ea7f Merge pull request #241 from jbenet/fix/log-debugf
fix(everything) log.Debug -> log.Debugf
2014-10-30 17:09:26 -07:00
Jeromy
3270ab0efb fix bug where terminal would randomly become garbled binary crap 2014-10-30 16:34:52 +00:00
Brian Tiger Chow
cea398b8a7 fix(all) log.Debug -> log.Debugf 2014-10-30 06:35:29 -07:00
Brian Tiger Chow
e0f4000fcf style(routing) message 2014-10-28 05:12:54 -07:00
Brian Tiger Chow
321eb421e7 refactor(routing) use routing.ErrNotFound 2014-10-28 02:17:46 -07:00
Brian Tiger Chow
f75f4a4b6d feat(routing) define routing.ErrNotFound 2014-10-28 01:06:28 -07:00
Juan Batiz-Benet
d79ebe68d2 dht ctxcloserify 2014-10-25 21:33:59 -07:00
Juan Batiz-Benet
f2b8803a57 net/service now uses ctxcloser 2014-10-25 21:33:10 -07:00
Jeromy
d92db12460 lots of logging 2014-10-26 00:45:40 +00:00
Jeromy
ab7491f809 logging, logging, and some minor logging 2014-10-25 14:50:22 -07:00
Jeromy
e1f2fe75f8 add in dag removal 2014-10-25 12:39:36 -07:00
Brian Tiger Chow
29457214cb refactor(dht/pb) move proto to pb package 2014-10-25 04:13:28 -07:00
Juan Batiz-Benet
184c25430b go-vet friendly codebase
- distinguish log.Error and log.Errorf functions
- Initialize structs with field names
- A bit of unreachable code (defers)
2014-10-25 03:46:39 -07:00
Jeromy
762faa7421 rewrite findpeer and other dht tweaks 2014-10-24 18:53:36 -07:00
Jeromy
b7744b2a11 fix for #141, routing table segmentation 2014-10-22 15:08:32 -07:00
Juan Batiz-Benet
a8adf2ff2c dht test fix (net) 2014-10-22 05:31:49 -07:00
Juan Batiz-Benet
cc5c181ae0 Dialer for dht
dht doesn't need the whole network interface, only needs a Dialer.
(much reduced surface of possible errors)
2014-10-22 03:24:05 -07:00
Juan Batiz-Benet
cc9f276f0f notes 2014-10-22 03:24:05 -07:00
Juan Batiz-Benet
c3df3973e1 query wasnt ensuring conn
The query-- once it's actually attempting to connect to a peer--
should be the one connecting.
2014-10-22 03:24:05 -07:00
Juan Batiz-Benet
6f8d23cbc1 this shouldn't connect quite yet. 2014-10-22 03:24:05 -07:00
Jeromy
c070c2f0de working on debugging dht issues 2014-10-22 03:24:05 -07:00
Juan Batiz-Benet
f7c1ed39e0 renamed datastore.go -> go-datastore 2014-10-21 15:10:58 -07:00
Juan Batiz-Benet
ac62d13e42 peerstore Put -> Add
Changed lots of peer use, and changed the peerstore to ensure
there is only ever one peer in use.

Fixed #174
2014-10-20 06:37:12 -07:00
Juan Batiz-Benet
9ca87fbb93 peer.Peer is now an interface
![](http://m.memegen.com/77n7dk.jpg)
2014-10-20 03:26:46 -07:00
Juan Batiz-Benet
b1d11ccfcb peerstore constructs peers
Now, all peers should be retrieved from the Peerstore, which will
construct the peers accordingly. This ensures there's only one peer
object per peer (opposite would be bad: things get out sync)

cc @whyrusleeping
2014-10-20 00:44:44 -07:00
Juan Batiz-Benet
d17292a4c2 differentiate ports cause timing. 2014-10-19 06:29:18 -07:00
Juan Batiz-Benet
4783332b11 fixed tests 2014-10-19 02:05:29 -07:00
Juan Batiz-Benet
c2e649b17c make vendor
@whyrusleeping pre-commit hook?
2014-10-18 20:04:07 -07:00
Juan Batiz-Benet
331e43328e keyspace XOR naming 2014-10-18 20:01:28 -07:00
Juan Batiz-Benet
20d1d354f3 moved XOR keyspace -> util 2014-10-18 20:01:27 -07:00
Juan Batiz-Benet
e989d6febe move IDFromPubKey to peer pkg 2014-10-18 04:28:26 -07:00
Juan Batiz-Benet
18cfe02d38 dht tests with context 2014-10-18 04:28:26 -07:00
Jeromy
0b97d29c47 small changes to auxiliary dht functions 2014-10-18 04:28:26 -07:00
Jeromy
60cd0f1cf0 some dht cleanup, and make DHTs take a master context 2014-10-18 04:28:26 -07:00
Jeromy
1a7fac4551 make test fail instead of hang 2014-10-18 04:28:25 -07:00
Jeromy
00516299dd Add test to test conncurrent connects between two peers 2014-10-18 04:28:25 -07:00
Jeromy
4189d50d77 fix bug in diagnostics, and add more peers to closer peer responses 2014-10-18 04:28:25 -07:00
Jeromy
c77ed6d2aa fix up FindProvidersAsync 2014-10-18 04:28:25 -07:00
Juan Batiz-Benet
4b5906e466 logging + tweaks 2014-10-18 04:28:24 -07:00
Juan Batiz-Benet
0117fb118d dht handleAddProviders adds addr in msg
Otherwise don't have the peer's target address.
2014-10-18 04:28:24 -07:00
Juan Batiz-Benet
26c4e5004c handler fixes for tests 2014-10-10 20:48:20 -07:00
Jeromy
da95db3b0c update dht tests to new network interface 2014-10-10 14:52:59 -07:00
Juan Batiz-Benet
555bc871fc bugfixes to prev commit 2014-10-09 04:53:02 -07:00
Juan Batiz-Benet
972c0f7b4b u.DOut -> log.Debug
and other logging switches. I kept the u.PErr and u.POut in cli
commands, as those do need to write raw output directly.
2014-10-09 04:50:22 -07:00
Jeromy
1aafd285b5 add in some extra debug logging, and increase routing table latencies 2014-10-08 21:55:50 +00:00
Juan Batiz-Benet
66839fa1de changed logging, in dht and elsewhere
- use log.* instead of u.*
- use automatic type conversions to .String()
  (Peer.String() prints nicely, and avoids calling b58 encoding
  until needed)
2014-10-07 21:33:59 -07:00
Juan Batiz-Benet
77fccaa2f3 Obviated need for .ID.Pretty() all over the place. 2014-10-06 04:23:55 -07:00
Juan Batiz-Benet
910a76e220 updated multiaddr use across codebase 2014-10-06 04:13:43 -07:00
Jeromy
a0d77dbf99 fixed keyspace tests on 32 bit systems 2014-10-04 19:29:08 +00:00
Juan Batiz-Benet
0c8ae7674e loggers: set level 2014-10-04 03:53:21 -07:00
Juan Batiz-Benet
7e1cd59259 initialize loggers at ERROR 2014-10-04 03:36:30 -07:00
Juan Batiz-Benet
612be59643 use string datastore keys. 2014-10-03 15:39:22 -07:00
Juan Batiz-Benet
f085d594aa vendoring ipns things 2014-10-01 00:44:22 -07:00
Jeromy
9652ada0d2 implement publisher for ipns to wait until moments of rapid churn die down 2014-10-01 00:42:17 -07:00
Jeromy
54142b2173 update logging in multiple packages 2014-10-01 00:41:30 -07:00
Jeromy
6080944af9 writing files inside ipns works now! also implemented resolve cli command 2014-10-01 00:41:29 -07:00
Jeromy
006b68b558 WIP: getting closer to being able to write in ipns dirs 2014-10-01 00:41:29 -07:00
Jeromy
7f5e13716d writes to ipns work if the top object is the written file (no directories yet!) 2014-10-01 00:39:57 -07:00
Jeromy
e61c59758b implement initial ipns filesystem interface as well as plumbing command for publishing 2014-10-01 00:39:57 -07:00
Jeromy
375a38c5f7 add basic publish command, needs polish 2014-10-01 00:39:57 -07:00
Jeromy
a65e8600a3 catch ipns branch up to master and make all things compile 2014-10-01 00:37:53 -07:00
Jeromy
2aa2b8c6c7 add routing resolver test 2014-10-01 00:26:59 -07:00
Jeromy
8ddfb57c59 some bugfixes and added logging 2014-10-01 00:26:59 -07:00
Jeromy
b5fd9492d7 fixes to make interface more usable 2014-10-01 00:25:52 -07:00
Jeromy
727b6bf9a3 udpated commands and RPC dialing to work with new configuration changes 2014-09-27 16:02:50 -07:00
Juan Batiz-Benet
53f0b117f5 update net with peerstore 2014-09-26 02:41:46 -07:00
Brian Tiger Chow
e2a9c5de00 feat(net:service, routing) remove error return value 2014-09-24 23:35:36 -04:00
Jeromy
c044d9c32e move mock routing tests to proper directory 2014-09-23 18:23:46 -04:00
Jeromy
414ff34194 change back to using Client method 2014-09-23 18:23:46 -04:00
Jeromy
c45cc8c448 implement a mock dht for use in testing 2014-09-23 18:23:46 -04:00
Juan Batiz-Benet
10a1a01cf7 ping: return sme msg
This fixes the broken pinging. (the issue was the cluster
level, it's bein set incorrectly (off by one))

Anyway, this works now:

    [peer: QmfQTbC3LxfpK5WoyHW2WgnAzo6d6GePuq2wHTsJNXM5PS] Sent message type: 'PING' [to = QmNXUeFrV9gxR4aqJddEsfhWZLSJrUsfpUSeRb3R7xvSp9]
    [QmfQTbC3LxfpK5WoyHW2WgnAzo6d6GePuq2wHTsJNXM5PS] ping QmNXUeFrV9gxR4aqJddEsfhWZLSJrUsfpUSeRb3R7xvSp9 end (err = %!s(<nil>))

cc @whyrusleeping
2014-09-23 05:23:54 -07:00
Jeromy
7228786981 make a few tests perform operations in two directions instead of one 2014-09-22 22:34:30 -07:00
Jeromy
7bc4fbfa5d turn logging on by default, also make Provide not fail when no peers connected 2014-09-22 19:22:04 -07:00
Juan Batiz-Benet
adcf0bfe70 better logging for ping 2014-09-22 15:53:37 -07:00
Brian Tiger Chow
197046c9d2 fix(routing:dht) add ctx args 2014-09-22 04:06:19 -07:00
Brian Tiger Chow
d514b91ff3 fix(routing:dht) implement FindProvidersAsync in terms of FindProviders
until construction is complete on the actual async method

reverts changes from ec50703395098f75946f0bad01816cc54ab18a58

ec50703395
2014-09-22 04:06:18 -07:00
Juan Batiz-Benet
52cefb16cd Routing uses context now
@perfmode boom
2014-09-22 04:06:18 -07:00
Juan Batiz-Benet
aa29603923 dht tests pass again 2014-09-22 04:06:16 -07:00
Juan Batiz-Benet
afb1d01048 provider testing 2014-09-22 04:06:15 -07:00
Brian Tiger Chow
0bd8f2092b refac(routing) replace timeout -> ctx
@jbenet oh hai there!
2014-09-22 04:06:14 -07:00
Juan Batiz-Benet
043c09e14b fixed get/put 2014-09-22 04:06:12 -07:00
Juan Batiz-Benet
9dd39de491 Fixed connections all over. 2014-09-22 04:06:12 -07:00