From c0804534ac323b1162d3d394eda6838f63e0a582 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Wed, 7 Nov 2018 15:14:22 +0100 Subject: Fixes thanks to Dialyzer --- shard/lib/app/file.ex | 4 ++-- shard/lib/app/pagestore.ex | 4 ++-- shard/lib/net/group.ex | 2 +- shard/mix.exs | 1 + shard/mix.lock | 1 + 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/shard/lib/app/file.ex b/shard/lib/app/file.ex index 7f03e1f..6c4a212 100644 --- a/shard/lib/app/file.ex +++ b/shard/lib/app/file.ex @@ -262,10 +262,10 @@ defmodule SApp.File do {k, []} end end - Logger.info("Missing pieces: #{map_size missing} / #{n_blocks}") + Logger.info("Missing pieces for #{state.id|>Base.encode16}: #{map_size missing} / #{n_blocks}") missing false -> - Logger.info("Incomplete Merkle tree meta data, requesting info from peers.") + Logger.info("Incomplete Merkle tree meta data for #{state.id|>Base.encode16}, requesting info from peers.") SApp.PageStore.set_roots(state.store, [state.info.merkle_root]) Process.send_after(self(), {:calc_missing, iter + 1}, iter * 1000) nil diff --git a/shard/lib/app/pagestore.ex b/shard/lib/app/pagestore.ex index 79d39b7..3f7fc0d 100644 --- a/shard/lib/app/pagestore.ex +++ b/shard/lib/app/pagestore.ex @@ -144,7 +144,7 @@ defmodule SApp.PageStore do end def handle_cast({:rec_pull, hash, ask_to}, state) do - if :dets.lookup state.store, hash == [] do + if :dets.lookup(state.store, hash) == [] do why = {:cached, System.os_time(:seconds) + @cache_ttl} init_rec_pull(state, hash, why, ask_to) end @@ -187,7 +187,7 @@ defmodule SApp.PageStore do end value = SData.term_unbin bin for dep <- SData.Page.refs value do - if :dets.lookup state.store, dep == [] do + if :dets.lookup(state.store, dep) == [] do init_rec_pull(state, dep, sub_why, [conn_pid]) end end diff --git a/shard/lib/net/group.ex b/shard/lib/net/group.ex index f3d5962..c982cd0 100644 --- a/shard/lib/net/group.ex +++ b/shard/lib/net/group.ex @@ -46,7 +46,7 @@ defmodule SNet.PubShardGroup do GenServer.cast(notify_to, {:peer_connected, pid}) end for peer_info <- Shard.Manager.get_shard_peers id do - if SNet.Manager.get_connections_to peer_info == [] do + if SNet.Manager.get_connections_to(peer_info) == [] do SNet.Manager.add_peer(peer_info, callback: fn pid -> GenServer.cast(notify_to, {:peer_connected, pid}) diff --git a/shard/mix.exs b/shard/mix.exs index ec80c6b..fc10da7 100644 --- a/shard/mix.exs +++ b/shard/mix.exs @@ -28,6 +28,7 @@ defmodule Shard.MixProject do {:excoveralls, "~> 0.10", only: :test}, {:briefly, "~> 0.3", only: :test}, {:ex_doc, "~> 0.19", only: :dev, runtime: false}, + {:dialyxir, "~> 0.5", only: :dev, runtime: false}, {:enacl, git: "https://github.com/jlouis/enacl.git", tag: "0.16.0"}, # {:salty, "~> 0.1.3", hex: :libsalty}, diff --git a/shard/mix.lock b/shard/mix.lock index 662738e..28e53b7 100644 --- a/shard/mix.lock +++ b/shard/mix.lock @@ -3,6 +3,7 @@ "certifi": {:hex, :certifi, "2.3.1", "d0f424232390bf47d82da8478022301c561cf6445b5b5fb6a84d49a9e76d2639", [:rebar3], [{:parse_trans, "3.2.0", [hex: :parse_trans, repo: "hexpm", optional: false]}], "hexpm"}, "cowboy": {:hex, :cowboy, "1.1.2", "61ac29ea970389a88eca5a65601460162d370a70018afe6f949a29dca91f3bb0", [:rebar3], [{:cowlib, "~> 1.0.2", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "~> 1.3.2", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm"}, "cowlib": {:hex, :cowlib, "1.0.2", "9d769a1d062c9c3ac753096f868ca121e2730b9a377de23dec0f7e08b1df84ee", [:make], [], "hexpm"}, + "dialyxir": {:hex, :dialyxir, "0.5.1", "b331b091720fd93e878137add264bac4f644e1ddae07a70bf7062c7862c4b952", [:mix], [], "hexpm"}, "earmark": {:hex, :earmark, "1.2.6", "b6da42b3831458d3ecc57314dff3051b080b9b2be88c2e5aa41cd642a5b044ed", [:mix], [], "hexpm"}, "elixir_make": {:hex, :elixir_make, "0.4.2", "332c649d08c18bc1ecc73b1befc68c647136de4f340b548844efc796405743bf", [:mix], [], "hexpm"}, "enacl": {:git, "https://github.com/jlouis/enacl.git", "61be95caadaaceae9f8d0cad7f5149ce3f44b65f", [tag: "0.16.0"]}, -- cgit v1.2.3