nim-libp2p/libp2p/protocols/pubsub
Jacek Sieka f46bf0faa4
remove send lock (#334)
* remove send lock

When mplex receives data it will block until a reader has processed the
data. Thus, when a large message is received, such as a gossipsub
subscription table, all of mplex will be blocked until all reading is
finished.

However, if at the same time a `dial` to establish a gossipsub send
connection is ongoing, that `dial` will be blocked because mplex is no
longer reading data - specifically, it might indeed be the connection
that's processing the previous data that is waiting for a send
connection.

There are other problems with the current code:
* If an exception is raised, it is not necessarily raised for the same
connection as `p.sendConn`, so resetting `p.sendConn` in the exception
handling is wrong
* `p.isConnected` is checked before taking the lock - thus, if it
returns false, a new dial will be started. If a new task enters `send`
before dial is finished, it will also determine `p.isConnected` is
false, then get stuck on the lock - when the previous task finishes and
releases the lock, the new task will _also_ dial and thus reset
`p.sendConn` causing a leak.

* prefer existing connection

simplifies flow
2020-08-17 12:38:27 +02:00
..
rpc Rework pubsub (#322) 2020-08-11 18:05:49 -06:00
floodsub.nim avoid crash when subscribe is received (#333) 2020-08-17 12:10:22 +02:00
gossipsub.nim avoid crash when subscribe is received (#333) 2020-08-17 12:10:22 +02:00
mcache.nim allow message id provider to be specified (#243) 2020-06-28 09:56:38 -06:00
peertable.nim Rework pubsub (#322) 2020-08-11 18:05:49 -06:00
pubsub.nim remove send lock (#334) 2020-08-17 12:38:27 +02:00
pubsubpeer.nim remove send lock (#334) 2020-08-17 12:38:27 +02:00
timedcache.nim proper name for topics so that we can filter dynamically using chronicles (#210) 2020-06-10 10:48:01 +02:00