]> git.sesse.net Git - stockfish/commitdiff
Make server address into an UCI option.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 21 Mar 2016 23:48:48 +0000 (00:48 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Wed, 26 Dec 2018 09:43:37 +0000 (10:43 +0100)
src/main.cpp
src/ucioption.cpp

index e80d066dfdad353082fea62dc017b3e9f15be7bf..d0817a3d07b8b3c7c6ab126645af04e71afb2a77 100644 (file)
@@ -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);
index 1c6ef777257dda39e24753674f801ddbbe905d0d..4aa0136e4e25fc08873446a6eb608b736a2172ee 100644 (file)
 #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<HashProbeThread> 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("<empty>", on_rpc_server_address);
 }