92 Commits

Author SHA1 Message Date
Steven Allen
dbb3d2c0a2
Merge pull request #462 from libp2p/fix/observe-context-in-message-sender
fix: obey the context when sending messages to peers
2020-03-04 22:10:51 -08:00
Michael Muré
faa56381cb
net: address PR comments regarding metrics 2020-03-02 13:11:56 +01:00
Michael Muré
979ed6ab6c
metrics: also record message/request event on error
... otherwise any kinde of error ratio is meaningless.
2020-02-27 16:24:46 +01:00
Michael Muré
fe2d21acf9
immediate buffer release instead of defering 2020-02-27 15:52:40 +01:00
Steven Allen
0b029388bd fix: obey the context when sending messages to peers
Related to #453 but not a fix. This will cause us to actually return early when
we start blocking on sending to some peers, but it won't really _unblock_ those
peers. For that, we need to write with a context.
2020-02-22 16:34:56 -05:00
Steven Allen
3f8b219554 feat: reduce stream idle timeout to 1m
It's currently 10 minutes. This change will kill all inbound DHT streams that
haven't been used in 1 minute.

We keep streams around to avoid the cost of setting up new streams (the
multistream overhead, mostly). However, each one of these takes at least one
goroutine and some other state.

Ideally, this will let us run multiple DHTs side-by-side without keeping one
stream per peer per DHT open.
2020-01-23 09:04:13 -08:00
Steven Allen
3d68f5bf1f metrics: fix memory leak
fixes #389

Credit goes to @sidenaio for finding this.
2019-09-04 16:06:10 -07:00
Cole Brown
855b46d37e Address review comments
Update msgio to latest version
Use max size in msgio readers
Fix error handling in reads
2019-06-18 08:52:46 -04:00
Cole Brown
f0593aa9f9 Replace delimited reader in message sender 2019-06-17 18:36:27 -04:00
Cole Brown
feee52a32b Replace delimited reader with msgio VarintReader 2019-06-17 18:13:12 -04:00
Raúl Kripalani
31765355df
migrate to consolidated types. (#344) 2019-05-26 23:33:15 +01:00
Steven Allen
b55fad1580 kill idle streams after 10 minutes 2019-05-24 01:15:27 -07:00
Steven Allen
5bf9cf5e1a drop the go-context dependency
This was causing us to build up a bunch of background goroutines. Technically,
we should be resetting all these streams when the DHT stops. However, we don't
actually unregister stream handlers from the host so, really, nothing will
actually stop till the host stops. When it does, it'll kill all the streams
anyways.
2019-05-24 01:13:52 -07:00
Steven Allen
c8cce79033 fix: reduce memory used by buffered writers
Allocate them as-needed and use a pool.

Work towards #322.
2019-05-07 18:00:58 -07:00
Adrian Lanzafame
cf9bd9b649 Add opencensus basic metrics (#317)
Add initial set of metrics exposed via OpenCensus.
2019-04-15 13:18:47 +10:00
Steven Allen
6eafd65baa thread context to prep (#286)
We usually _explicitly_ call connect before calling `prep` but we may disconnect
somewhere in-between. We _don't_ want to get stuck here dialing if the context
has been canceled.
2019-03-07 18:53:16 +11:00
Matt Joiner
4d5f60195f
Rework handleNewStream (#267) 2019-02-19 13:38:03 +11:00
Raúl Kripalani
120a585ebf Revert "Test go mod in travis and use major versioning in import paths (#236)"
This reverts commit 7e68ac3c60c15243c7d2e622b91aed92245a2677.
2019-02-12 14:12:53 +00:00
Adrian Lanzafame
7e68ac3c60 Test go mod in travis and use major versioning in import paths (#236) 2019-02-12 17:38:06 +11:00
Matt Joiner
8b37385468 Rename log to logger 2019-02-03 13:14:35 +11:00
Marten Seemann
da02d4a7d5 also use the buffered writer for handling new messages 2018-08-05 16:43:15 +07:00
Marten Seemann
6d6ed07850 buffer writes when sending protobufs
The protobuf writer performs multiple small writes when writing a
message. We need to buffer these, otherwise we'll send out a packet for
each Write call.
2018-08-05 13:03:29 +07:00
Steven Allen
63b47bb368
Merge pull request #166 from libp2p/fix/161
fix dht client bugs
2018-06-26 00:03:58 +00:00
Steven Allen
94fc630110 avoid adding dht *clients* to routing tables
fixes #162
2018-06-14 20:14:11 -07:00
Steven Allen
1d13eafc97 be more polite about closing streams
When a peer sends use a EOF after they're done sending us messages, we should be
polite and send one back.
2018-06-12 17:13:05 -07:00
Steven Allen
16de81932c fully close streams
That is, actually wait for the other end to send us an EOF.
2018-06-04 21:45:40 -07:00
Erin Swenson-Healey
d94deae41d make DHT protocols pluggable 2018-06-01 14:55:16 -07:00
Steven Allen
5b673372eb fix comment on invalidate. 2017-09-19 15:42:01 -07:00
Jeromy
4237ef0939 fix memory leak holding onto streams unnecessarily 2017-09-19 12:00:42 -07:00
Steven Allen
5bc13bf691 reset streams on error instead of closing. 2017-09-14 10:30:55 -07:00
Steven Allen
d3d572b74d Retry queries if a write to the stream fails.
Previously, we'd only retry when a write failed (in case the peer was using
single-use streams). However, in the new world of half-open streams, writes
still succeed on remote-closed streams so this isn't sufficient. Instead, we
need to retry on read failure as well.

Note: this was technically broken before because a peer could write on a stream
before receiving the close message causing the write to succeed but the
subsequent read to fail.
2017-09-14 10:30:52 -07:00
Steven Allen
286dd24fd2 update stream muxer 2017-09-14 09:41:26 -07:00
Jeromy
6894f33507 update dependencies after package extraction funtime 2016-10-05 12:34:28 -07:00
Jeromy
e00b3ca0a4 use stdlib context and clean up deps 2016-09-30 10:24:03 -07:00
Jeromy
d09b2e73d0 add back patch with protocol updates 2016-09-23 02:45:58 -07:00
George Antoniadis
9b3d1b5661 Bump deps, revert protobuf 2016-09-03 20:35:59 +01:00
George Antoniadis
30d43d22e0 Fix dependencies 2016-09-02 20:21:23 +01:00
George Antoniadis
5f3e63aa46 Undo gx rewrites and add gx package.json 2016-08-21 17:18:58 +01:00
Jeromy
95553964a2 update go-libp2p
License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
2016-07-04 12:27:26 -07:00
Jakub Sztandera
22af8d1151 Update go-log in whole dependency tree (#2898)
* Update golog in go-ipfs

License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>

* Update go-libp2p for go-log

License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>

* Update go-libp2p-secio for go-log

License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>

* Update go-libp2p-crypto for go-log

License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>

* Update go-libp2p-peer for go-log

License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>

* Import peersore, it wasn't imported

License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>

* Update peerstore

License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>

* Update peer

License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>

* Update secio

License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>

* Update go-libp2p

License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
2016-06-24 09:38:07 -07:00
Jeromy
c29e3e29fd implement some simple dht request read timeouts
License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
2016-06-17 11:01:41 -07:00
Jeromy Johnson
3f05aa0579 Merge pull request #2853 from ipfs/feature/decapitalize-Debug
Decapitalized log.Debug messages
2016-06-17 10:26:20 -07:00
Jeromy
47d10d7be6 update go-libp2p to 3.3.4
License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
2016-06-15 13:04:49 -07:00
Jeromy Johnson
e7519fa51a Merge pull request #2856 from ipfs/fix/send-msg-race
pass reference to reader instead of using the one on the object
2016-06-15 12:47:01 -07:00
Jeromy
23050f9e30 pass reference to reader instead of using the one on the object
License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
2016-06-15 11:13:35 -07:00
Richard Littauer
2203d3b1fe Decapitalized log.Debug messages
According to golang standards, these should not be capitalized nor having a trailing period, AFAIK.

License: MIT
Signed-off-by: Richard Littauer <richard.littauer@gmail.com>
2016-06-15 08:56:34 +01:00
Jakub Sztandera
478d32510a Remove errors pointed out by govet
License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
2016-06-14 13:40:16 +02:00
Jeromy
63b6db0589 pull in libp2p updates with utp fixes
License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
2016-06-11 10:33:44 -07:00
Jeromy
cd34bf85e0 respect contexts while reading messages in dht
License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
2016-06-09 15:10:06 -07:00
Jeromy Johnson
9454558e9d Merge pull request #2817 from ipfs/feat/dht-reuse-stream
reuse streams for dht messaging
2016-06-08 10:08:25 -07:00