*** empty log message ***

This commit is contained in:
Joe Shochet 2000-10-19 17:09:00 +00:00
parent 88f80d1ad1
commit 8b514d8e65
5 changed files with 68 additions and 17 deletions

View File

@ -9,8 +9,7 @@ class DirectObject:
# Event Handling # Event Handling
# object.accept('mouse', object.handleMouse) # object.accept('mouse', object.handleMouse)
# object.accept('mouse', 'handleMouse') # object.accept('mouse', object.handleMouse, [1,2])
# object.accept('mouse', 'handleMouse', [1,2])
def accept(self, event, method, extraArgs=[]): def accept(self, event, method, extraArgs=[]):
messenger.accept(event, self, method, extraArgs, 1) messenger.accept(event, self, method, extraArgs, 1)

View File

@ -16,7 +16,7 @@ class Messenger:
object2: [method, extraArgs, persistent]}} object2: [method, extraArgs, persistent]}}
Or, for an example with more real data: Or, for an example with more real data:
{'mouseDown' : {avatar : [avatar.jump, (2.0), 1]}} {'mouseDown' : {avatar : [avatar.jump, [2.0], 1]}}
""" """
self.dict = {} self.dict = {}

View File

@ -145,6 +145,18 @@ get_server_multifile_size(string mfname) const {
return (_server_db.get_multifile_record_named(mfname))->_size; return (_server_db.get_multifile_record_named(mfname))->_size;
} }
////////////////////////////////////////////////////////////////////
// Function: DownloadDb::
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
INLINE void DownloadDb::
set_server_multifile_size(string mfname, int size) {
(_server_db.get_multifile_record_named(mfname))->_size = size;
}
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Function: DownloadDb:: // Function: DownloadDb::
// Access: Public // Access: Public
@ -249,3 +261,25 @@ set_client_file_version(string mfname, string fname, Version version) {
write_db(_client_db._filename, _client_db); write_db(_client_db._filename, _client_db);
} }
////////////////////////////////////////////////////////////////////
// Function: DownloadDb::
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
INLINE Hash DownloadDb::
get_client_file_hash(string mfname, string fname) const {
return ((_client_db.get_multifile_record_named(mfname))->get_file_record_named(fname))->_hash;
}
////////////////////////////////////////////////////////////////////
// Function: DownloadDb::
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
INLINE Hash DownloadDb::
get_server_file_hash(string mfname, string fname) const {
return ((_server_db.get_multifile_record_named(mfname))->get_file_record_named(fname))->_hash;
}

View File

@ -177,8 +177,10 @@ client_file_version_correct(string mfname, string filename) const {
// Description: // Description:
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
bool DownloadDb:: bool DownloadDb::
client_file_crc_correct(string mfname, string filename) const { client_file_hash_correct(string mfname, string filename) const {
return true; Hash client_hash = get_client_file_hash(mfname, filename);
Hash server_hash = get_server_file_hash(mfname, filename);
return (client_hash == server_hash);
} }
// Operations on multifiles // Operations on multifiles
@ -303,9 +305,9 @@ server_add_multifile(string mfname, Phase phase, Version version, int size, int
// Description: // Description:
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
void DownloadDb:: void DownloadDb::
server_add_file(string mfname, string fname, Version version) { server_add_file(string mfname, string fname, Version version, Hash hash) {
// Make the new file record // Make the new file record
PT(FileRecord) fr = new FileRecord(fname, version); PT(FileRecord) fr = new FileRecord(fname, version, hash);
// Find the multifile with mfname // Find the multifile with mfname
vector<PT(MultifileRecord)>::iterator i = _server_db._mfile_records.begin(); vector<PT(MultifileRecord)>::iterator i = _server_db._mfile_records.begin();
@ -656,9 +658,12 @@ parse_fr(uchar *start, int size) {
PN_int32 fr_name_length = di.get_int32(); PN_int32 fr_name_length = di.get_int32();
fr->_name = di.extract_bytes(fr_name_length); fr->_name = di.extract_bytes(fr_name_length);
fr->_version = di.get_int32(); fr->_version = di.get_int32();
fr->_hash = di.get_int32();
downloader_cat.debug() downloader_cat.debug()
<< "Parsed file record: " << fr->_name << " version: " << fr->_version << endl; << "Parsed file record: " << fr->_name
<< " version: " << fr->_version
<< " hash: " << fr->_hash << endl;
// Return the new MultifileRecord // Return the new MultifileRecord
return fr; return fr;
@ -888,6 +893,7 @@ DownloadDb::FileRecord::
FileRecord(void) { FileRecord(void) {
_name = ""; _name = "";
_version = 0; _version = 0;
_hash = 0;
} }
@ -897,9 +903,10 @@ FileRecord(void) {
// Description: // Description:
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
DownloadDb::FileRecord:: DownloadDb::FileRecord::
FileRecord(string name, Version version) { FileRecord(string name, Version version, Hash hash) {
_name = name; _name = name;
_version = version; _version = version;
_hash = hash;
} }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
@ -909,7 +916,9 @@ FileRecord(string name, Version version) {
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
void DownloadDb::FileRecord:: void DownloadDb::FileRecord::
output(ostream &out) const { output(ostream &out) const {
out << " FileRecord: " << _name << " version: " << _version << endl; out << " FileRecord: " << _name
<< " version: " << _version
<< " hash: " << _hash << endl;
} }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////

View File

@ -27,20 +27,24 @@
magic_number magic_number
number_of_multifiles number_of_multifiles
header_length multifile_name phase version size status num_files header_length multifile_name phase version size status num_files
header_length file_name version header_length file_name version hash
header_length file_name version header_length file_name version hash
header_length multifile_name phase version size status num_files header_length multifile_name phase version size status num_files
header_length file_name version header_length file_name version hash
header_length file_name version header_length file_name version hash
... ...
... ...
Note: the has value will not be valid on the client db. Only
the server db will have the hash value stored
A Db is a Vector<MultifileRecord> A Db is a Vector<MultifileRecord>
MultifileRecord is a Vector<FileRecord> MultifileRecord is a Vector<FileRecord>
*/ */
typedef int Version; typedef int Version;
typedef ulong Hash;
typedef int Phase; typedef int Phase;
class EXPCL_PANDAEXPRESS DownloadDb { class EXPCL_PANDAEXPRESS DownloadDb {
@ -81,6 +85,7 @@ public:
INLINE void set_client_multifile_size(string mfname, int size); INLINE void set_client_multifile_size(string mfname, int size);
INLINE void set_client_multifile_delta_size(string mfname, int size); INLINE void set_client_multifile_delta_size(string mfname, int size);
INLINE int get_server_multifile_size(string mfname) const; INLINE int get_server_multifile_size(string mfname) const;
INLINE void set_server_multifile_size(string mfname, int size);
INLINE int get_client_multifile_phase(string mfname) const; INLINE int get_client_multifile_phase(string mfname) const;
INLINE int get_server_multifile_phase(string mfname) const; INLINE int get_server_multifile_phase(string mfname) const;
@ -99,6 +104,9 @@ public:
INLINE Version get_server_file_version(string mfname, string fname) const; INLINE Version get_server_file_version(string mfname, string fname) const;
INLINE void set_client_file_version(string mfname, string fname, Version version); INLINE void set_client_file_version(string mfname, string fname, Version version);
INLINE Hash get_client_file_hash(string mfname, string fname) const;
INLINE Hash get_server_file_hash(string mfname, string fname) const;
// Check client db against server db // Check client db against server db
bool client_db_current_version(void) const; bool client_db_current_version(void) const;
@ -109,7 +117,7 @@ public:
bool client_multifile_expanded(string mfname) const; bool client_multifile_expanded(string mfname) const;
bool client_multifile_version_correct(string mfname) const; bool client_multifile_version_correct(string mfname) const;
bool client_file_version_correct(string mfname, string filename) const; bool client_file_version_correct(string mfname, string filename) const;
bool client_file_crc_correct(string mfname, string filename) const; bool client_file_hash_correct(string mfname, string filename) const;
// Operations on multifiles // Operations on multifiles
void delete_client_multifile(string mfname); void delete_client_multifile(string mfname);
@ -119,17 +127,18 @@ public:
// Server side operations to create multifile records // Server side operations to create multifile records
void create_new_server_db(); void create_new_server_db();
void server_add_multifile(string mfname, Phase phase, Version version, int size, int status); void server_add_multifile(string mfname, Phase phase, Version version, int size, int status);
void server_add_file(string mfname, string fname, Version version); void server_add_file(string mfname, string fname, Version version, Hash hash);
public: public:
class EXPCL_PANDAEXPRESS FileRecord : public ReferenceCount { class EXPCL_PANDAEXPRESS FileRecord : public ReferenceCount {
public: public:
FileRecord(void); FileRecord(void);
FileRecord(string name, Version version); FileRecord(string name, Version version, Hash hash);
void output(ostream &out) const; void output(ostream &out) const;
string _name; string _name;
Version _version; Version _version;
Hash _hash;
}; };
typedef vector<PT(FileRecord)> FileRecords; typedef vector<PT(FileRecord)> FileRecords;