From: Steinar H. Gunderson Date: Mon, 21 Mar 2016 23:48:48 +0000 (+0100) Subject: Make server address into an UCI option. X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=45e6f04bd15212c306046d917f982f76295d7386 Make server address into an UCI option. --- diff --git a/src/main.cpp b/src/main.cpp index e80d066d..d0817a3d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -173,8 +173,6 @@ int main(int argc, char* argv[]) { Threads.set(Options["Threads"]); Search::clear(); // After threads are up - HashProbeThread thr("0.0.0.0:50051"); - UCI::loop(argc, argv); Threads.set(0); diff --git a/src/ucioption.cpp b/src/ucioption.cpp index 1c6ef777..4aa0136e 100644 --- a/src/ucioption.cpp +++ b/src/ucioption.cpp @@ -27,11 +27,13 @@ #include "thread.h" #include "tt.h" #include "uci.h" +#include "hashprobe.h" #include "syzygy/tbprobe.h" using std::string; UCI::OptionsMap Options; // Global object +std::unique_ptr hash_probe_thread; namespace UCI { @@ -41,7 +43,13 @@ void on_hash_size(const Option& o) { TT.resize(o); } void on_logger(const Option& o) { start_logger(o); } void on_threads(const Option& o) { Threads.set(o); } void on_tb_path(const Option& o) { Tablebases::init(o); } - +void on_rpc_server_address(const Option& o) { + if (hash_probe_thread) { + hash_probe_thread->Shutdown(); + } + std::string addr = o; + hash_probe_thread.reset(new HashProbeThread(addr)); +} /// Our case insensitive less() function as required by UCI protocol bool CaseInsensitiveLess::operator() (const string& s1, const string& s2) const { @@ -77,6 +85,7 @@ void init(OptionsMap& o) { o["SyzygyProbeDepth"] << Option(1, 1, 100); o["Syzygy50MoveRule"] << Option(true); o["SyzygyProbeLimit"] << Option(7, 0, 7); + o["RPCServerAddress"] << Option("", on_rpc_server_address); }