Skip to content
This repository has been archived by the owner on Mar 26, 2019. It is now read-only.

Commit

Permalink
remove some dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
zah committed Jun 18, 2018
1 parent 41d022b commit 6bd09b1
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions eth_p2p/rlpx.nim
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,6 @@ proc hash(d: Dispatcher): int =
proc `==`(lhs, rhs: Dispatcher): bool =
lhs.protocolOffsets == rhs.protocolOffsets

template totalThunks(d: Dispatcher): int =
d.thunks.len

template getThunk(d: Dispatcher, idx: int): MessageHandler =
rlpxProtocols.thunks[idx]

proc describeProtocols(d: Dispatcher): string =
result = ""
for i in 0 ..< rlpxProtocols.len:
Expand Down Expand Up @@ -658,18 +652,21 @@ when isMainModule:
var p = Peer()
discard p.bar(10, "test")

when false:
# The assignment below can be used to investigate if the RLPx procs
when true:
# The assignments below can be used to investigate if the RLPx procs
# are considered GcSafe. The short answer is that they aren't, because
# they dispatch into user code that might use the GC.
type
GcSafeDispatchMsg = proc (peer: Peer, msgId: int, msgData: var Rlp)

GcSafeRecvMsg = proc (peer: Peer):
Future[tuple[msgId: int, msgData: Rlp]] {.gcsafe.}

GcSafeAccept = proc (transp: StreamTransport, myKeys: KeyPair):
Future[Peer] {.gcsafe.}

var
dispatchMsgPtr = dispatchMsg
recvMsgPtr: GcSafeRecvMsg = recvMsg
acceptPtr: GcSafeAccept = rlpxAccept

0 comments on commit 6bd09b1

Please sign in to comment.