Skip to content

Commit

Permalink
Correct typo
Browse files Browse the repository at this point in the history
  • Loading branch information
alrevuelta committed Sep 28, 2023
1 parent b905a35 commit 6914cde
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions waku/node/peer_manager/peer_manager.nim
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ type
PeerManager* = ref object of RootObj
switch*: Switch
peerStore*: PeerStore
wakuMetadata*: WwakuMetadata
wakuMetadata*: WakuMetadata
initialBackoffInSec*: int
backoffFactor*: int
maxFailedAttempts*: int
Expand Down Expand Up @@ -366,7 +366,7 @@ proc onPeerEvent(pm: PeerManager, peerId: PeerId, event: PeerEvent) {.async.} =

proc new*(T: type PeerManager,
switch: Switch,
wakuMetadata: WwakuMetadata = nil, # todo quick workaround
wakuMetadata: WakuMetadata = nil, # todo quick workaround
maxRelayPeers: Option[int] = none(int),
storage: PeerStorage = nil,
initialBackoffInSec = InitialBackoffInSec,
Expand Down
4 changes: 2 additions & 2 deletions waku/node/waku_node.nim
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ type
wakuLightPush*: WakuLightPush
wakuLightpushClient*: WakuLightPushClient
wakuPeerExchange*: WakuPeerExchange
wakuMetadata*: WwakuMetadata
wakuMetadata*: WakuMetadata
enr*: enr.Record
libp2pPing*: Ping
rng*: ref rand.HmacDrbgContext
Expand Down Expand Up @@ -155,7 +155,7 @@ proc new*(T: type WakuNode,
)

# todo temporal PoC
let metadata = WwakuMetadata.new(netConfig.networkId)
let metadata = WakuMetadata.new(netConfig.networkId)
node.switch.mount(metadata, protocolMatcher(WakuMetadataCodec))
node.wakuMetadata = metadata

Expand Down
12 changes: 6 additions & 6 deletions waku/waku_metadata/protocol.nim
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ const WakuMetadataCodec* = "/vac/waku/metadata/1.0.0"
const RpcResponseMaxBytes* = 1024

type
WwakuMetadata* = ref object of LPProtocol
WakuMetadata* = ref object of LPProtocol
metadata*: Metadata

Metadata* = object
networkId*: uint32

proc respond(m: WwakuMetadata, conn: Connection): Future[Result[void, string]] {.async, gcsafe.} =
proc respond(m: WakuMetadata, conn: Connection): Future[Result[void, string]] {.async, gcsafe.} =
let rpc = WakuMetadataResponse(
networkId: m.metadata.networkId
)
Expand All @@ -43,7 +43,7 @@ proc respond(m: WwakuMetadata, conn: Connection): Future[Result[void, string]] {

return ok()

proc request*(m: WwakuMetadata, conn: Connection): Future[Result[WakuMetadataResponse, string]] {.async, gcsafe.} =
proc request*(m: WakuMetadata, conn: Connection): Future[Result[WakuMetadataResponse, string]] {.async, gcsafe.} =
var buffer: seq[byte]
var error: string
try:
Expand All @@ -64,7 +64,7 @@ proc request*(m: WwakuMetadata, conn: Connection): Future[Result[WakuMetadataRes
echo decodedBuff.get().networkId
return ok(decodedBuff.get())

proc initProtocolHandler*(m: WwakuMetadata) = # typoo
proc initProtocolHandler*(m: WakuMetadata) =
proc handle(conn: Connection, proto: string) {.async, gcsafe, closure.} =
# request is empty, no need to read data, just respond
discard await m.respond(conn)
Expand All @@ -75,8 +75,8 @@ proc initProtocolHandler*(m: WwakuMetadata) = # typoo
m.handler = handle
m.codec = WakuMetadataCodec

proc new*(T: type WwakuMetadata, networkId: uint32): T =
let m = WwakuMetadata(metadata: Metadata(networkId: networkId))
proc new*(T: type WakuMetadata, networkId: uint32): T =
let m = WakuMetadata(metadata: Metadata(networkId: networkId))
m.initProtocolHandler()
info "Created WakuMetadata protocol", networkId=networkId
return m

0 comments on commit 6914cde

Please sign in to comment.