whoops, fix startup order dependency

This commit is contained in:
David Rose 2009-12-22 02:58:10 +00:00
parent 707bfa14fa
commit 3627e9ff2c
4 changed files with 51 additions and 6 deletions

View File

@ -1774,8 +1774,6 @@ mark_p3d_trusted() {
// Only call this once.
assert(!_p3d_trusted);
_p3d_trusted = true;
// Extract the application desc file from the p3d file.
stringstream sstream;
if (!_mf_reader.extract_one(sstream, "p3d_info.xml")) {
@ -1805,9 +1803,16 @@ mark_p3d_trusted() {
send_notify("onauth");
// Now that we're all set up, start downloading the required
// packages, and then start the instance itself if we're already
// fully downloaded.
// packages.
add_packages();
// Until we've done all of the above processing, we haven't fully
// committed to setting the trusted flag. (Setting this flag down
// here instead of a few lines above avoids starting the instance in
// add_packages(), before we've had a chance to finish processing
// this method.)
_p3d_trusted = true;
if (get_packages_ready()) {
mark_download_complete();
}
@ -2604,6 +2609,7 @@ set_button_image(ImageType image_type) {
////////////////////////////////////////////////////////////////////
void P3DInstance::
report_package_info_ready(P3DPackage *package) {
nout << "report_package_info_ready: " << package->get_package_name() << "\n";
if (package == _image_package || package == _certlist_package ||
package == _p3dcert_package) {
// A special case: these packages get immediately downloaded,
@ -2674,7 +2680,7 @@ ready_to_install() {
_download_package_index = 0;
_total_downloaded = 0;
_download_begin = time(NULL);
nout << "Beginning install of " << _downloading_packages.size()
<< " packages, total " << _total_download_size
<< " bytes required.\n";

View File

@ -284,6 +284,18 @@ set_plugin_version(int major, int minor, int sequence,
_plugin_distributor = distributor;
_coreapi_host_url = coreapi_host_url;
_coreapi_timestamp = coreapi_timestamp;
nout << "Plugin version: "
<< _plugin_major_version << "."
<< _plugin_minor_version << "."
<< _plugin_sequence_version;
if (!_plugin_official_version) {
nout << "c";
}
nout << "\n";
nout << "Plugin distributor: " << _plugin_distributor << "\n";
nout << "Core API host URL: " << _coreapi_host_url << "\n";
nout << "Core API date: " << ctime(&_coreapi_timestamp) << "\n";
}
////////////////////////////////////////////////////////////////////
@ -1303,7 +1315,7 @@ create_runtime_environment() {
_temp_directory += "/";
}
nout << "_root_dir = " << _root_dir
nout << "\n_root_dir = " << _root_dir
<< ", _temp_directory = " << _temp_directory
<< ", platform = " << _platform
<< ", host_url = " << _host_url

View File

@ -1080,6 +1080,9 @@ start_p3dpython(P3DInstance *inst) {
return;
}
nout << "Setting environment:\n";
write_env();
// Get the filename of the Panda3D multifile. We need to pass this
// to p3dpython.
_mf_filename = inst->_panda3d->get_archive_file_pathname();
@ -1637,3 +1640,25 @@ p3dpython_thread_run() {
nout << "Failure on startup.\n";
}
}
////////////////////////////////////////////////////////////////////
// Function: P3DSession::write_env
// Access: Private
// Description: Writes _env, which is formatted as a string
// containing zero-byte-terminated environment
// defintions, to the nout stream, one definition per
// line.
////////////////////////////////////////////////////////////////////
void P3DSession::
write_env() const {
size_t p = 0;
size_t zero = _env.find('\0', p);
while (zero != string::npos) {
nout << " ";
nout.write(_env.data() + p, zero - p);
nout << "\n";
p = zero + 1;
zero = _env.find('\0', p);
}
}

View File

@ -88,6 +88,8 @@ private:
THREAD_CALLBACK_DECLARATION(P3DSession, p3dpython_thread_run);
void p3dpython_thread_run();
void write_env() const;
private:
int _session_id;
string _session_key;