mirror of
https://github.com/vacp2p/nim-libp2p.git
synced 2025-01-11 09:16:15 +00:00
caac8191d2
* newBufferStream -> BufferStream.new * newMultistream -> MultistreamSelect.new * newSecio -> Secio.new * newNoise -> Noise.new * newPlainText -> PlainText.new * newPubSubPeer -> PubSubPeer.new * newIdentify -> Identify.new * newMuxerProvider -> MuxerProvider.new
31 lines
594 B
Nim
31 lines
594 B
Nim
import chronos, nimcrypto/utils
|
|
import ../libp2p/[stream/connection,
|
|
stream/bufferstream]
|
|
|
|
import ./helpers
|
|
|
|
suite "Connection":
|
|
asyncTest "close":
|
|
var conn = BufferStream.new()
|
|
await conn.close()
|
|
check:
|
|
conn.closed == true
|
|
|
|
asyncTest "parent close":
|
|
var buf = BufferStream.new()
|
|
var conn = buf
|
|
|
|
await conn.close()
|
|
check:
|
|
conn.closed == true
|
|
buf.closed == true
|
|
|
|
asyncTest "child close":
|
|
var buf = BufferStream.new()
|
|
var conn = buf
|
|
|
|
await buf.close()
|
|
check:
|
|
conn.closed == true
|
|
buf.closed == true
|