mirror of https://github.com/vacp2p/nim-libp2p.git
Fix after gcsafe requirements change and other issues on devel (#795)
This commit is contained in:
parent
d9305bda84
commit
6ab6ab48ef
|
@ -108,6 +108,7 @@ task examples_build, "Build the samples":
|
|||
buildSample("tutorial_4_gossipsub", true)
|
||||
buildSample("tutorial_5_discovery", true)
|
||||
# Nico doesn't work in 1.2
|
||||
exec "nimble install -y nimpng@#HEAD" # this is to fix broken build on 1.7.3, remove it when nimpng version 0.3.2 or later is released
|
||||
exec "nimble install -y nico"
|
||||
buildSample("tutorial_6_game", false, "--styleCheck:off")
|
||||
|
||||
|
|
|
@ -130,7 +130,7 @@ type
|
|||
|
||||
knownTopics*: HashSet[string]
|
||||
|
||||
method unsubscribePeer*(p: PubSub, peerId: PeerId) {.base.} =
|
||||
method unsubscribePeer*(p: PubSub, peerId: PeerId) {.base, gcsafe.} =
|
||||
## handle peer disconnects
|
||||
##
|
||||
|
||||
|
@ -377,7 +377,7 @@ method handleConn*(p: PubSub,
|
|||
finally:
|
||||
await conn.closeWithEOF()
|
||||
|
||||
method subscribePeer*(p: PubSub, peer: PeerId) {.base.} =
|
||||
method subscribePeer*(p: PubSub, peer: PeerId) {.base, gcsafe.} =
|
||||
## subscribe to remote peer to receive/send pubsub
|
||||
## messages
|
||||
##
|
||||
|
@ -400,7 +400,7 @@ proc updateTopicMetrics(p: PubSub, topic: string) =
|
|||
|
||||
libp2p_pubsub_topic_handlers.set(others, labelValues = ["other"])
|
||||
|
||||
method onTopicSubscription*(p: PubSub, topic: string, subscribed: bool) {.base.} =
|
||||
method onTopicSubscription*(p: PubSub, topic: string, subscribed: bool) {.base, gcsafe.} =
|
||||
# Called when subscribe is called the first time for a topic or unsubscribe
|
||||
# removes the last handler
|
||||
|
||||
|
@ -433,7 +433,7 @@ proc unsubscribe*(p: PubSub, topics: openArray[TopicPair]) {.public.} =
|
|||
for t in topics:
|
||||
p.unsubscribe(t.topic, t.handler)
|
||||
|
||||
proc unsubscribeAll*(p: PubSub, topic: string) {.public.} =
|
||||
proc unsubscribeAll*(p: PubSub, topic: string) {.public, gcsafe.} =
|
||||
## unsubscribe every `handler` from `topic`
|
||||
if topic notin p.topics:
|
||||
debug "unsubscribeAll called for an unknown topic", topic
|
||||
|
@ -495,7 +495,7 @@ method initPubSub*(p: PubSub)
|
|||
|
||||
method addValidator*(p: PubSub,
|
||||
topic: varargs[string],
|
||||
hook: ValidatorHandler) {.base, public.} =
|
||||
hook: ValidatorHandler) {.base, public, gcsafe.} =
|
||||
## Add a validator to a `topic`. Each new message received in this
|
||||
## will be sent to `hook`. `hook` can return either `Accept`,
|
||||
## `Ignore` or `Reject` (which can descore the peer)
|
||||
|
|
Loading…
Reference in New Issue