Skip to content

Commit

Permalink
Merge pull request #102 from cita-cloud/updata_deps
Browse files Browse the repository at this point in the history
bump version; update deps; support dual stack
  • Loading branch information
rink1969 committed Jul 10, 2024
2 parents 8fffc5d + d8c166f commit c4f63da
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[package]
name = "consensus"
version = "6.7.3"
version = "6.7.4"
authors = ["Rivtower Technologies <contact@rivtower.com>"]
edition = "2021"

[dependencies]
clap = { version = "4.5", features = ["cargo"] }
tonic = "0.11"
tonic = "0.12"
toml = "0.8"
rand = "0.8"
# `release_max_level_trace` enables configuring log level at runtime.
Expand All @@ -15,10 +15,10 @@ sloggers = "2.2"
log = "0.4"
hex = "0.4"
raft = { git = "https://github.com/JLerxky/raft-rs", default-features = false, features = ["prost-codec"] }
prost = "0.12"
tokio = { version = "1.36", features = ["fs", "io-util", "rt", "macros"] }
prost = "0.13"
tokio = { version = "1.38", features = ["fs", "io-util", "rt", "macros"] }
serde = "1.0"
bytes = "1.5"
bytes = "1.6"
tower = "0.4"
flume = "0.11"

Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,17 @@ OPTIONS:
```
$ consensus run -c example/config.toml -d . -f consensus.log
$ cat consensus.log
Mar 14 08:32:55.131 INFO controller grpc addr: http://127.0.0.1:50004, tag: controller, module: consensus::client:45
Mar 14 08:32:55.131 INFO network grpc addr: http://127.0.0.1:50000, tag: network, module: consensus::client:167
Mar 14 08:32:55.131 INFO controller grpc addr: http://localhost:50004, tag: controller, module: consensus::client:45
Mar 14 08:32:55.131 INFO network grpc addr: http://localhost:50000, tag: network, module: consensus::client:167
Mar 14 08:32:55.131 INFO registering network msg handler..., tag: network, module: consensus::client:191
```

输出到标准输出:
```
$ consensus run -c example/config.toml --stdout
Mar 14 08:34:00.124 INFO controller grpc addr: http://127.0.0.1:50004, tag: controller, module: consensus::client:45
Mar 14 08:34:00.125 INFO network grpc addr: http://127.0.0.1:50000, tag: network, module: consensus::client:167
Mar 14 08:34:00.124 INFO controller grpc addr: http://localhost:50004, tag: controller, module: consensus::client:45
Mar 14 08:34:00.125 INFO network grpc addr: http://localhost:50000, tag: network, module: consensus::client:167
Mar 14 08:34:00.125 INFO registering network msg handler..., tag: network, module: consensus::client:191
```

Expand Down
6 changes: 3 additions & 3 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub struct Controller {
impl Controller {
pub fn new(port: u16, logger: Logger) -> Self {
let client_options =
ClientOptions::new(CLIENT_NAME.to_string(), format!("http://127.0.0.1:{port}"));
ClientOptions::new(CLIENT_NAME.to_string(), format!("http://localhost:{port}"));
let client = match client_options.connect_controller() {
Ok(retry_client) => retry_client,
Err(e) => panic!("client init error: {:?}", &e),
Expand Down Expand Up @@ -141,7 +141,7 @@ impl Inner {
) -> Self {
let client_options = ClientOptions::new(
CLIENT_NAME.to_string(),
format!("http://127.0.0.1:{network_port}"),
format!("http://localhost:{network_port}"),
);
let client = match client_options.connect_network() {
Ok(retry_client) => retry_client,
Expand All @@ -162,7 +162,7 @@ impl Inner {

let request = RegisterInfo {
module_name: "consensus".to_owned(),
hostname: "127.0.0.1".to_owned(),
hostname: "localhost".to_owned(),
port: local_port.to_string(),
};

Expand Down
4 changes: 2 additions & 2 deletions src/grpc_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ pub async fn start_grpc_server(
if let Some(layer) = layer {
tokio::spawn(async move {
info!(logger_cloned, "metrics on");
let addr = format!("127.0.0.1:{grpc_listen_port}").parse().unwrap();
let addr = format!("[::]:{grpc_listen_port}").parse().unwrap();
let res = Server::builder()
.layer(layer)
.add_service(ConsensusServiceServer::new(raft_svc))
Expand All @@ -112,7 +112,7 @@ pub async fn start_grpc_server(
} else {
tokio::spawn(async move {
info!(logger_cloned, "metrics off");
let addr = format!("127.0.0.1:{grpc_listen_port}").parse().unwrap();
let addr = format!("[::]:{grpc_listen_port}").parse().unwrap();
let res = Server::builder()
.add_service(ConsensusServiceServer::new(raft_svc))
.add_service(NetworkMsgHandlerServiceServer::new(network))
Expand Down

0 comments on commit c4f63da

Please sign in to comment.