-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use asyncraises in p2p #675
Conversation
@@ -155,7 +155,7 @@ type | |||
MessageHandlerDecorator* = proc(msgId: int, n: NimNode): NimNode | |||
|
|||
ThunkProc* = proc(x: Peer, msgId: int, data: Rlp): Future[void] | |||
{.gcsafe, raises: [RlpError].} | |||
{.gcsafe, async: (raises: [RlpError, CatchableError]).} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's no point adding CatchableError
to raises - that's already the default at which point it's generally better to use just plain async
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay, thanks. But unfortunately it doesn't works. The compiler/chronos still complaints.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this would be because you need to match usages to the declaration - ie either all use {.async.}
or all use {.async: [errors].}
- this is related to the guarantees that you want to uphold, ie either the thunk proc is responsible for handling errors or the thing calling it is and one needs to decide.
broadly though, this declaration is non-sensical: RlpError
is a subclass of CatchableError
so if this declaration is needed, something went wrong "somewhere else" and it would be interesting perhaps to investigate where that was - ie likely, there is some deeper change that will either remove RlpError
or remove CatcahbleError
from this declaration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, the rlpx needs overhaul.
eth/p2p/rlpx.nim
Outdated
@@ -176,7 +176,7 @@ proc messagePrinter[MsgType](msg: pointer): string {.gcsafe.} = | |||
# result = $(cast[ptr MsgType](msg)[]) | |||
|
|||
proc disconnect*(peer: Peer, reason: DisconnectionReason, | |||
notifyOtherPeer = false) {.gcsafe, async.} | |||
notifyOtherPeer = false) {.gcsafe, async: (raises:[CatchableError]).} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need for gcsafe
when async
is specified
72dafb2
to
f4e1745
Compare
No description provided.