mirror of https://github.com/status-im/nim-eth.git
more gcsafe pragmas for Nim HEAD
This commit is contained in:
parent
e1dbd76e1f
commit
c5e564d771
|
@ -207,7 +207,7 @@ proc recvNeighbours(d: DiscoveryProtocol, node: Node,
|
|||
neighbours.add(newNode(pk, Address(ip: ip, udpPort: udpPort, tcpPort: tcpPort)))
|
||||
d.kademlia.recvNeighbours(node, neighbours)
|
||||
|
||||
proc recvFindNode(d: DiscoveryProtocol, node: Node, payload: Bytes) {.inline.} =
|
||||
proc recvFindNode(d: DiscoveryProtocol, node: Node, payload: Bytes) {.inline, gcsafe.} =
|
||||
let rlp = rlpFromBytes(payload.toRange)
|
||||
trace "<<< find_node from ", node
|
||||
let rng = rlp.listElem(0).toBytes
|
||||
|
@ -219,7 +219,7 @@ proc expirationValid(rlpEncodedPayload: seq[byte]): bool {.inline.} =
|
|||
let expiration = rlp.listElem(rlp.listLen - 1).toInt(uint32)
|
||||
result = epochTime() <= expiration.float
|
||||
|
||||
proc receive(d: DiscoveryProtocol, a: Address, msg: Bytes) =
|
||||
proc receive(d: DiscoveryProtocol, a: Address, msg: Bytes) {.gcsafe.} =
|
||||
var msgHash: MDigest[256]
|
||||
if validateMsgHash(msg, msgHash):
|
||||
var remotePubkey: PublicKey
|
||||
|
|
|
@ -240,7 +240,7 @@ proc newKademliaProtocol*[Wire](thisNode: Node,
|
|||
|
||||
proc bond(k: KademliaProtocol, n: Node): Future[bool] {.async.}
|
||||
|
||||
proc updateRoutingTable(k: KademliaProtocol, n: Node) =
|
||||
proc updateRoutingTable(k: KademliaProtocol, n: Node) {.gcsafe.} =
|
||||
## Update the routing table entry for the given node.
|
||||
let evictionCandidate = k.routing.addNode(n)
|
||||
if not evictionCandidate.isNil:
|
||||
|
@ -250,7 +250,7 @@ proc updateRoutingTable(k: KademliaProtocol, n: Node) =
|
|||
# replacement cache.
|
||||
asyncCheck k.bond(evictionCandidate)
|
||||
|
||||
proc doSleep(p: proc()) {.async.} =
|
||||
proc doSleep(p: proc() {.gcsafe.}) {.async, gcsafe.} =
|
||||
await sleepAsync(REQUEST_TIMEOUT)
|
||||
p()
|
||||
|
||||
|
@ -275,7 +275,7 @@ proc ping(k: KademliaProtocol, n: Node): seq[byte] =
|
|||
doAssert(n != k.thisNode)
|
||||
result = k.wire.sendPing(n)
|
||||
|
||||
proc waitPing(k: KademliaProtocol, n: Node): Future[bool] =
|
||||
proc waitPing(k: KademliaProtocol, n: Node): Future[bool] {.gcsafe.} =
|
||||
result = newFuture[bool]("waitPing")
|
||||
doAssert(n notin k.pingFutures)
|
||||
k.pingFutures[n] = result
|
||||
|
@ -317,7 +317,7 @@ proc populateNotFullBuckets(k: KademliaProtocol) =
|
|||
for node in bucket.replacementCache:
|
||||
asyncCheck k.bond(node)
|
||||
|
||||
proc bond(k: KademliaProtocol, n: Node): Future[bool] {.async.} =
|
||||
proc bond(k: KademliaProtocol, n: Node): Future[bool] {.async, gcsafe.} =
|
||||
## Bond with the given node.
|
||||
##
|
||||
## Bonding consists of pinging the node, waiting for a pong and maybe a ping as well.
|
||||
|
@ -469,7 +469,7 @@ proc recvNeighbours*(k: KademliaProtocol, remote: Node, neighbours: seq[Node]) =
|
|||
else:
|
||||
trace "Unexpected neighbours, probably came too late", remote
|
||||
|
||||
proc recvFindNode*(k: KademliaProtocol, remote: Node, nodeId: NodeId) =
|
||||
proc recvFindNode*(k: KademliaProtocol, remote: Node, nodeId: NodeId) {.gcsafe.} =
|
||||
if remote notin k.routing:
|
||||
# FIXME: This is not correct; a node we've bonded before may have become unavailable
|
||||
# and thus removed from self.routing, but once it's back online we should accept
|
||||
|
|
Loading…
Reference in New Issue