mirror of https://github.com/vacp2p/nim-libp2p.git
feat: use error pragma to signal abstract methods
This commit is contained in:
parent
a91c15c47a
commit
5f8e633c0f
|
@ -44,3 +44,5 @@ method dial*(t: TcpTransport, address: MultiAddress): Future[Connection] {.async
|
|||
## dial a peer
|
||||
let client: StreamTransport = await connect(address)
|
||||
result = await t.connHandler(t.server, client)
|
||||
|
||||
method supports(t: Transport, address: MultiAddress): bool = true
|
||||
|
|
|
@ -33,7 +33,7 @@ method connHandler*(t: Transport,
|
|||
t.connections.add(connHolder)
|
||||
result = conn
|
||||
|
||||
method init*(t: Transport) {.base.} =
|
||||
method init*(t: Transport) {.base, error: "not implemented".} =
|
||||
## perform protocol initialization
|
||||
discard
|
||||
|
||||
|
@ -53,12 +53,12 @@ method listen*(t: Transport, ma: MultiAddress, handler: ConnHandler) {.base, asy
|
|||
t.ma = ma
|
||||
t.handler = handler
|
||||
|
||||
method dial*(t: Transport, address: MultiAddress): Future[Connection] {.base, async.} =
|
||||
method dial*(t: Transport, address: MultiAddress): Future[Connection] {.base, async, error: "not implemented".} =
|
||||
## dial a peer
|
||||
discard
|
||||
|
||||
method supports(t: Transport, address: MultiAddress): bool {.base.} =
|
||||
method supports(t: Transport, address: MultiAddress): bool {.base, error: "not implemented".} =
|
||||
## check if transport supportes the multiaddress
|
||||
# TODO: this should implement generic logic that would use the multicodec
|
||||
# declared in the multicodec field and set by each individual transport
|
||||
result = true
|
||||
discard
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue