mirror of
https://github.com/0glabs/0g-storage-node.git
synced 2025-04-04 15:35:18 +00:00
Fix comment
This commit is contained in:
parent
a42fad5572
commit
65f0aade69
@ -348,18 +348,25 @@ impl Libp2pEventHandler {
|
||||
}
|
||||
}
|
||||
|
||||
async fn get_listen_addr_or_add(&self) -> Option<Multiaddr> {
|
||||
async fn construct_announced_ip(&self) -> Option<Multiaddr> {
|
||||
// public address configured
|
||||
if let Some(ip) = self.config.public_address {
|
||||
let mut addr = Multiaddr::empty();
|
||||
addr.push(ip.into());
|
||||
addr.push(Protocol::Tcp(self.network_globals.listen_port_tcp()));
|
||||
return Some(addr);
|
||||
}
|
||||
|
||||
// public listen address
|
||||
if let Some(addr) = self.get_listen_addr() {
|
||||
return Some(addr);
|
||||
}
|
||||
|
||||
let ip_protocol = match self.config.public_address {
|
||||
Some(addr) => addr.into(),
|
||||
None => Protocol::Ip4(public_ip::addr_v4().await?),
|
||||
};
|
||||
// auto detect public IP address
|
||||
let ipv4_addr = public_ip::addr_v4().await?;
|
||||
|
||||
let mut addr = Multiaddr::empty();
|
||||
addr.push(ip_protocol);
|
||||
addr.push(Protocol::Ip4(ipv4_addr));
|
||||
addr.push(Protocol::Tcp(self.network_globals.listen_port_tcp()));
|
||||
|
||||
self.network_globals
|
||||
@ -422,7 +429,7 @@ impl Libp2pEventHandler {
|
||||
|
||||
let peer_id = *self.network_globals.peer_id.read();
|
||||
|
||||
let addr = self.get_listen_addr_or_add().await?;
|
||||
let addr = self.construct_announced_ip().await?;
|
||||
|
||||
let timestamp = timestamp_now();
|
||||
let shard_config = self.store.get_store().get_shard_config();
|
||||
@ -454,7 +461,7 @@ impl Libp2pEventHandler {
|
||||
shard_config: ShardConfig,
|
||||
) -> Option<PubsubMessage> {
|
||||
let peer_id = *self.network_globals.peer_id.read();
|
||||
let addr = self.get_listen_addr_or_add().await?;
|
||||
let addr = self.construct_announced_ip().await?;
|
||||
let timestamp = timestamp_now();
|
||||
|
||||
let msg = AnnounceShardConfig {
|
||||
@ -530,7 +537,7 @@ impl Libp2pEventHandler {
|
||||
index_end: u64,
|
||||
) -> Option<PubsubMessage> {
|
||||
let peer_id = *self.network_globals.peer_id.read();
|
||||
let addr = self.get_listen_addr_or_add().await?;
|
||||
let addr = self.construct_announced_ip().await?;
|
||||
let timestamp = timestamp_now();
|
||||
|
||||
let msg = AnnounceChunks {
|
||||
|
Loading…
Reference in New Issue
Block a user