-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showcase #1
Showcase #1
Conversation
abci/src/server.rs
Outdated
|
||
let _ = thread::spawn( move || { | ||
loop { | ||
let (stream, addr) = self.listener.accept().map_err(Error::io).expect( "failed to accept connection"); |
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.
Why do we expect
now instead of returning the error?
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.
'Cause of this line of code. It blocks the main thread and I chose to move it into a separate thread.
What do you think:
- Call expect on error
- Send error with mpsc
- Ignore error and log it
- Don't panic but request cancellation
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.
Personally I think. Approach with logging error and stopping application better
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.
Agreed
abci/src/server.rs
Outdated
|
||
}); | ||
|
||
while !CancellationSource::is_cancelled() { } |
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.
Isn't this going to consume the CPU?
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.
Yes. I need to add thread::sleep
No description provided.