diff --git a/direct/src/directd/directd.cxx b/direct/src/directd/directd.cxx index ece25db99f..6cfca2db99 100644 --- a/direct/src/directd/directd.cxx +++ b/direct/src/directd/directd.cxx @@ -134,7 +134,7 @@ DirectD::DirectD() : _host_name("localhost"), _port(8001), _app_pid(0), _reader(&_cm, 1), _writer(&_cm, 1), _listener(&_cm, 0), - _verbose(false), _shutdown(false) { + _shutdown(false) { } DirectD::~DirectD() { @@ -148,10 +148,11 @@ DirectD::~DirectD() { } int -DirectD::client_ready(const string& client_host, int port) { - connect_to(client_host, port); - send_command("s"); - disconnect_from(client_host, port); +DirectD::client_ready(const string& client_host, int port, + const string& cmd) { + stringstream ss; + ss<<"!"< client_ready() calls. @@ -64,7 +66,7 @@ PUBLISHED: // Call listen_to(port) prior to calling // wait_for_servers() (or better yet, prior // to calling client_ready()). - bool wait_for_servers(int count, int timeout_ms); + bool wait_for_servers(int count, int timeout_ms=2*60*1000); // Description: Call this function from the server when // import ShowbaseGlobal is nearly finished. @@ -79,16 +81,15 @@ PUBLISHED: // Description: process command string. void send_command(const string& cmd); -public: +protected: void spawn_background_server(); void start_app(const string& cmd); void kill_app(); - void handle_command(const string& cmd); + virtual void handle_command(const string& cmd); void handle_datagram(NetDatagram& datagram); void send_one_message(const string& host_name, int port, const string& message); -protected: QueuedConnectionManager _cm; QueuedConnectionReader _reader; ConnectionWriter _writer; @@ -100,7 +101,6 @@ protected: typedef pset< PT(Connection) > ConnectionSet; ConnectionSet _connections; - bool _verbose; bool _shutdown; void check_for_new_clients(); diff --git a/direct/src/directdServer/directdClient.cxx b/direct/src/directdServer/directdClient.cxx index 4e076cdec8..09d6aa5e44 100644 --- a/direct/src/directdServer/directdClient.cxx +++ b/direct/src/directdServer/directdClient.cxx @@ -49,9 +49,7 @@ DirectDClient::cli_command(const string& cmd) { void DirectDClient::run_client(const string& host, int port) { - if (_verbose) { - cerr<<"client"< 1) { port=(atoi(argv[argc-1])); diff --git a/direct/src/directdServer/directdServer.h b/direct/src/directdServer/directdServer.h index fc71bf8af2..c755bc3e08 100644 --- a/direct/src/directdServer/directdServer.h +++ b/direct/src/directdServer/directdServer.h @@ -35,6 +35,6 @@ public: protected: void read_command(string& cmd); - void handle_command(const string& cmd); + virtual void handle_command(const string& cmd); };