nim-libp2p/tests/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
..
testfloodsub.nim remove send lock (#334) 2020-08-17 12:38:27 +02:00
testgossipinternal.nim Rework pubsub (#322) 2020-08-11 18:05:49 -06:00
testgossipsub.nim Rework pubsub (#322) 2020-08-11 18:05:49 -06:00
testmcache.nim reuse single RNG instance for all crypto key generation (#249) 2020-07-07 13:14:11 +02:00
testmessage.nim Rework pubsub (#322) 2020-08-11 18:05:49 -06:00
testpubsub.nim Gossipsub interop (#189) 2020-05-27 12:33:49 -06:00
utils.nim Rework pubsub (#322) 2020-08-11 18:05:49 -06:00