-
Notifications
You must be signed in to change notification settings - Fork 18
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
grpc server scaffolding #8
Conversation
Err(e) => error!(error = ?e, "{}", msg), | ||
} | ||
|
||
shutdown_tx.send(()).await.ok(); |
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.
When will this be hit?
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 guess for any reason the grpc server stops running. I'm not sure the full set of cases, but one common one is when the grpc server address/port is already in use.
@@ -138,7 +180,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> { | |||
}), | |||
nonce: tick_count as u64, // Need the nonce to avoid the gossip duplicate message check | |||
}; | |||
println!("Registering validator with nonce: {}", register_validator.nonce); | |||
info!("Registering validator with nonce: {}", register_validator.nonce); |
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'll swap the remaining printlns with tracing in my next pr
src/server.rs
Outdated
pub struct MySnapchainService; | ||
|
||
#[tonic::async_trait] | ||
impl SnapchainService for MySnapchainService { |
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.
We should put this into network/
"src/proto/rpc.proto", | ||
"src/proto/message.proto", | ||
"src/proto/username_proof.proto", | ||
], &["src/proto"])?; |
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.
Would be nice to autodiscover all the files, but not a priority
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.
Added a TODO
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.
Good to see this implemented as proposed in issue 5 some days ago
#5
grpc server scaffolding
For now, run on port 50060 +
example:
Note that if the server has an error (e.g. port already in use) it will shutdown the process by sending a signal over a channel.