mirror of
https://github.com/status-im/nim-libp2p.git
synced 2025-01-12 05:54:51 +00:00
903e79ede1
Backporting proper connection cleanup from #36 to align with latest chronos changes. * add close event * use proper varint encoding * add proper channel cleanup in mplex * add connection cleanup in secio * tidy up * add dollar operator * fix tests * don't close connections prematurely * handle closing streams properly * misc * implement address filtering logic * adding pipe tests * don't use gcsafe if not needed * misc * proper connection cleanup and stream muxing * re-enable pubsub tests
29 lines
733 B
Nim
29 lines
733 B
Nim
## Nim-LibP2P
|
|
## Copyright (c) 2019 Status Research & Development GmbH
|
|
## Licensed under either of
|
|
## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE))
|
|
## * MIT license ([LICENSE-MIT](LICENSE-MIT))
|
|
## at your option.
|
|
## This file may not be copied, modified, or distributed except according to
|
|
## those terms.
|
|
|
|
import chronos
|
|
import secure, ../../connection
|
|
|
|
const PlainTextCodec* = "/plaintext/1.0.0"
|
|
|
|
type
|
|
PlainText* = ref object of Secure
|
|
|
|
method init(p: PlainText) {.gcsafe.} =
|
|
proc handle(conn: Connection, proto: string)
|
|
{.async, gcsafe.} = discard
|
|
## plain text doesn't do anything
|
|
|
|
p.codec = PlainTextCodec
|
|
p.handler = handle
|
|
|
|
proc newPlainText*(): PlainText =
|
|
new result
|
|
result.init()
|