-
Notifications
You must be signed in to change notification settings - Fork 87
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
Rudimentary diffusion socket logging #2746
Conversation
FYI, if this branch is just for yourself, you can just push the branch without opening a PR. Pushing to a branch with a PR creates notifications for the people subscribed to the repo, pushing to a branch without a PR doesn't 🙂. |
366c9da
to
52a2916
Compare
I made some changes and am upgrading to a proper PR. |
Oops, sorry, I had |
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.
A bit more nitpicking ;).
7485ad0
to
a2b56f7
Compare
fa6d505
to
b1b7deb
Compare
b487f75
to
73b933f
Compare
I think you should add the windows' |
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.
LGTM. Just some minor things.
ece0ddd
to
0e33a53
Compare
0e33a53
to
de06585
Compare
1241fb8
to
4fc0390
Compare
4fc0390
to
39955e7
Compare
|
This is how it looks now:
|
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.
A few more comments
|
||
data DiffusionInitializationTracer | ||
= RunServer | ||
| RunLocalServer |
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.
I would add SockAddr
and LocalAddress
on both RunServer
and RunLocalServer
. These are probably the only two messages that should be logged with Notice
severity, all others are either Info
or Debug
messages so it makes sense to show the addresses on both of them.
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.
I wasn't able to get a SockAddr
or LocalAddress
for these points of logging, so I used FileDescriptor
instead. Please advise.
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.
For runServer
you can do this:
addr <- case address of
-- If a socket was provided it should be ready to accept
Left sd -> getLocalName sn sd
Right addr -> do
traceWith dtDiffusionInitializationTracer $ ConfiguringServerSocket addr
Snocket.bind sn sd addr
return addr
Snocket.listen sn sd
traceWith dtDiffusionInitializationTracer (RunServer addr)
Similar thing will work in runLocalServer
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.
Snocket haddoc documentation could help you find the solution (though it could be improved).
@@ -350,17 +384,21 @@ runDataDiffusion tracers | |||
( | |||
case address of | |||
Left sd -> return sd | |||
Right a -> Snocket.open sn (Snocket.addrFamily sn a) | |||
Right addr -> do | |||
traceWith dtDiffusionInitializationTracer $ CreatingServerSocket addr |
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.
The same note as for the other Creating...
message applies, e.g. if things go wrong the diffusion will error.
) | ||
(Snocket.close sn) -- We close the socket here, even if it was provided for us. | ||
(\sd -> do | ||
|
||
case address of | ||
Left _ -> pure () -- If a socket was provided it should be ready to accept | ||
Right addr -> do | ||
traceWith dtDiffusionInitializationTracer $ ConfiguringServerSocket addr |
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.
Similarly for this message, if bind
errors diffusion stops => node stops. The error should be logged by the node.
cadd37b
to
776d1bd
Compare
776d1bd
to
00f1463
Compare
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.
Thanks, I left one layout comment, otherwise it can be merged.
00f1463
to
6719c87
Compare
bors merge |
Build succeeded: |
No description provided.