mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 18:31:55 -04:00
fix error handling for core API re-download case
This commit is contained in:
parent
abc64b3915
commit
c17f0dce3d
@ -301,6 +301,33 @@ full_verify(const string &package_dir) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: FileSpec::force_get_actual_file
|
||||||
|
// Access: Public
|
||||||
|
// Description: Returns a FileSpec that represents the actual data
|
||||||
|
// read on disk. This will read the disk to determine
|
||||||
|
// the data if necessary.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
const FileSpec *FileSpec::
|
||||||
|
force_get_actual_file(const string &pathname) {
|
||||||
|
if (_actual_file == NULL) {
|
||||||
|
#ifdef _WIN32
|
||||||
|
struct _stat st;
|
||||||
|
wstring pathname_w;
|
||||||
|
if (string_to_wstring(pathname_w, pathname)) {
|
||||||
|
_wstat(pathname_w.c_str(), &st);
|
||||||
|
}
|
||||||
|
#else // _WIN32
|
||||||
|
struct stat st;
|
||||||
|
stat(pathname.c_str(), &st);
|
||||||
|
#endif // _WIN32
|
||||||
|
|
||||||
|
priv_check_hash(pathname, &st);
|
||||||
|
}
|
||||||
|
|
||||||
|
return _actual_file;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: FileSpec::check_hash
|
// Function: FileSpec::check_hash
|
||||||
// Access: Public
|
// Access: Public
|
||||||
|
@ -47,6 +47,7 @@ public:
|
|||||||
bool quick_verify_pathname(const string &pathname);
|
bool quick_verify_pathname(const string &pathname);
|
||||||
bool full_verify(const string &package_dir);
|
bool full_verify(const string &package_dir);
|
||||||
inline const FileSpec *get_actual_file() const;
|
inline const FileSpec *get_actual_file() const;
|
||||||
|
const FileSpec *force_get_actual_file(const string &pathname);
|
||||||
|
|
||||||
bool check_hash(const string &pathname) const;
|
bool check_hash(const string &pathname) const;
|
||||||
bool read_hash(const string &pathname);
|
bool read_hash(const string &pathname);
|
||||||
|
@ -1670,12 +1670,20 @@ downloaded_plugin(const string &filename) {
|
|||||||
// Make sure the DLL was correctly downloaded before continuing.
|
// Make sure the DLL was correctly downloaded before continuing.
|
||||||
if (!_coreapi_dll.quick_verify_pathname(filename)) {
|
if (!_coreapi_dll.quick_verify_pathname(filename)) {
|
||||||
nout << "After download, " << _coreapi_dll.get_filename() << " is no good.\n";
|
nout << "After download, " << _coreapi_dll.get_filename() << " is no good.\n";
|
||||||
|
nout << "Expected:\n";
|
||||||
|
_coreapi_dll.write(nout);
|
||||||
|
const FileSpec *actual = _coreapi_dll.force_get_actual_file(filename);
|
||||||
|
if (actual != NULL) {
|
||||||
|
nout << "Found:\n";
|
||||||
|
actual->write(nout);
|
||||||
|
}
|
||||||
|
|
||||||
// That DLL came out wrong. Try the next URL.
|
// That DLL came out wrong. Try the next URL.
|
||||||
if (!_core_urls.empty()) {
|
if (!_core_urls.empty()) {
|
||||||
string url = _core_urls.back();
|
string url = _core_urls.back();
|
||||||
_core_urls.pop_back();
|
_core_urls.pop_back();
|
||||||
|
|
||||||
|
_core_dll_temp_file.cleanup();
|
||||||
PPDownloadRequest *req = new PPDownloadRequest(PPDownloadRequest::RT_core_dll);
|
PPDownloadRequest *req = new PPDownloadRequest(PPDownloadRequest::RT_core_dll);
|
||||||
start_download(url, req);
|
start_download(url, req);
|
||||||
return;
|
return;
|
||||||
@ -3260,7 +3268,13 @@ open() {
|
|||||||
bool PPInstance::StreamTempFile::
|
bool PPInstance::StreamTempFile::
|
||||||
feed(size_t total_expected_data, const void *this_data,
|
feed(size_t total_expected_data, const void *this_data,
|
||||||
size_t this_data_size) {
|
size_t this_data_size) {
|
||||||
assert(!_finished);
|
if (_finished) {
|
||||||
|
nout << "feed(" << total_expected_data << ", " << (void *)this_data
|
||||||
|
<< ", " << this_data_size << ") to " << _filename
|
||||||
|
<< ", but already finished at " << _current_size << "\n";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!_opened) {
|
if (!_opened) {
|
||||||
open();
|
open();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user