Commit 000136e5 authored by Stavros Korokithakis's avatar Stavros Korokithakis

Update Eternum node hostname

parent e3ee45b8
......@@ -67,9 +67,8 @@ lazy_static! {
}
lazy_static! {
static ref IPFS_API_HOST: SocketAddr = SocketAddr::new(
IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 5001
);
static ref IPFS_API_HOST: SocketAddr =
SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 5001);
}
static IPFS_EXECUTABLE: &str = "ipfs";
......@@ -174,7 +173,8 @@ fn notify_ipfs(fs_event: bool) {
if last_event_time.is_none()
|| Instant::now()
.duration_since(last_event_time.unwrap())
.as_secs() < 5
.as_secs()
< 5
{
// It there was no event, or there hasn't been long enough since the last one, return.
return;
......@@ -229,7 +229,8 @@ fn start_ipfs() {
while sys_time
.duration_since(sys_time)
.expect("SystemTime::duration_since failed")
.as_secs() < timeout
.as_secs()
< timeout
{
let conn = TcpStream::connect_timeout(&IPFS_API_HOST, Duration::from_secs(1));
if conn.is_ok() {
......@@ -241,7 +242,7 @@ fn start_ipfs() {
// Connect this node to Eternum directly.
Command::new(IPFS_EXECUTABLE)
.env("IPFS_PATH", &*IPFS_PATH)
.args(&["swarm", "connect", "/ip4/195.201.40.251/tcp/4001/ipfs/QmXRxDBWU7zA6yBDtLNM3HMU2W8BRVjRhew42bKHE63yfe"]);
.args(&["swarm", "connect", "/dns4/door.eternum.io/tcp/4001/ipfs/QmUAzL9Fpp1fsZnrkANcitMevCoTWKP3TJcgTuc2D3b7vi"]);
// After all initialization has been done, spawn the cron thread (so we can add
// files to IPFS at startup as well).
......@@ -293,9 +294,12 @@ fn cron_thread() {
/// Handle the inotify events in the Hearth directory.
fn files_changed(op: notify::Op, path: std::path::PathBuf) {
debug!("Got new event: {:?}, {:?}", op, path);
if op.contains(notify::op::CREATE) || op.contains(notify::op::REMOVE)
|| op.contains(notify::op::RENAME) || op.contains(notify::op::WRITE)
|| op.contains(notify::op::RESCAN) || op.contains(notify::op::CLOSE_WRITE)
if op.contains(notify::op::CREATE)
|| op.contains(notify::op::REMOVE)
|| op.contains(notify::op::RENAME)
|| op.contains(notify::op::WRITE)
|| op.contains(notify::op::RESCAN)
|| op.contains(notify::op::CLOSE_WRITE)
{
notify_ipfs(true);
}
......@@ -322,7 +326,6 @@ fn create_watcher() {
}
}
/// Send a request to Eternum, for estimating how many Hearth installations there are.
/// IP addresses or other identifying data is not stored.
fn ping_eternum() {
......@@ -334,7 +337,9 @@ fn ping_eternum() {
let peer_id = String::from_utf8(output.stdout).unwrap();
let client = reqwest::Client::new();
let _ = client.get(format!("https://www.eternum.io/track/hearth/?id={}", peer_id).as_str()).send();
let _ = client
.get(format!("https://www.eternum.io/track/hearth/?id={}", peer_id).as_str())
.send();
}
fn main() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment