mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 18:31:55 -04:00
reduced writer threads
This commit is contained in:
parent
11dba6c42b
commit
d6518039d4
@ -132,7 +132,7 @@ namespace {
|
|||||||
|
|
||||||
DirectD::DirectD() :
|
DirectD::DirectD() :
|
||||||
_app_pid(0),
|
_app_pid(0),
|
||||||
_reader(&_cm, 1), _writer(&_cm, 1), _listener(&_cm, 0),
|
_reader(&_cm, 1), _writer(&_cm, 0), _listener(&_cm, 0),
|
||||||
_shutdown(false) {
|
_shutdown(false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,13 +174,12 @@ DirectD::wait_for_servers(int count, int timeout_ms) {
|
|||||||
while (_reader.data_available()) {
|
while (_reader.data_available()) {
|
||||||
NetDatagram datagram;
|
NetDatagram datagram;
|
||||||
if (_reader.get_data(datagram)) {
|
if (_reader.get_data(datagram)) {
|
||||||
nout << "Got datagram " /*<< datagram <<*/ "from "
|
cout << count << ": Server at " << datagram.get_address()
|
||||||
<< datagram.get_address() << endl;
|
<< " is ready." << endl;
|
||||||
datagram.dump_hex(nout);
|
datagram.dump_hex(nout);
|
||||||
//handle_datagram(datagram);
|
//handle_datagram(datagram);
|
||||||
DatagramIterator di(datagram);
|
DatagramIterator di(datagram);
|
||||||
string s=di.get_string();
|
string s=di.get_string();
|
||||||
nout<<"wait_for_servers() count="<<count<<", s="<<s<<endl;
|
|
||||||
if (s=="r" && !--count) {
|
if (s=="r" && !--count) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -205,6 +204,7 @@ DirectD::server_ready(const string& client_host, int port) {
|
|||||||
void
|
void
|
||||||
DirectD::start_app(const string& cmd) {
|
DirectD::start_app(const string& cmd) {
|
||||||
nout<<"start_app(cmd="<<cmd<<")"<<endl;
|
nout<<"start_app(cmd="<<cmd<<")"<<endl;
|
||||||
|
kill_app();
|
||||||
_app_pid=StartApp(cmd);
|
_app_pid=StartApp(cmd);
|
||||||
nout<<" _app_pid="<<_app_pid<<endl;
|
nout<<" _app_pid="<<_app_pid<<endl;
|
||||||
}
|
}
|
||||||
@ -268,6 +268,7 @@ DirectD::send_one_message(const string& host_name,
|
|||||||
_writer.send(datagram, c);
|
_writer.send(datagram, c);
|
||||||
|
|
||||||
//PR_Sleep(PR_MillisecondsToInterval(200));
|
//PR_Sleep(PR_MillisecondsToInterval(200));
|
||||||
|
//wait_for_servers(1, 10*1000);
|
||||||
//_reader.remove_connection(c);
|
//_reader.remove_connection(c);
|
||||||
_cm.close_connection(c);
|
_cm.close_connection(c);
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ DirectDClient::~DirectDClient() {
|
|||||||
void
|
void
|
||||||
DirectDClient::cli_command(const string& cmd) {
|
DirectDClient::cli_command(const string& cmd) {
|
||||||
cerr<<"command "<<cmd<<endl;
|
cerr<<"command "<<cmd<<endl;
|
||||||
if (cmd[0]=='!') {
|
if (cmd[0]==':') {
|
||||||
// ...connect to host.
|
// ...connect to host.
|
||||||
cerr<<"Local command "<<flush;
|
cerr<<"Local command "<<flush;
|
||||||
string code;
|
string code;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user