*** empty log message ***

This commit is contained in:
Mike Goslin 2000-12-13 20:44:40 +00:00
parent c3dbc8fbed
commit 4137f57be8
3 changed files with 18 additions and 1 deletions

View File

@ -78,6 +78,17 @@ get_disk_write_frequency(void) const {
return _disk_write_frequency; return _disk_write_frequency;
} }
////////////////////////////////////////////////////////////////////
// Function: Download::get_bytes_written
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
INLINE int Download::
get_bytes_written(void) const {
nassertr(_current_status != NULL, 0);
return _current_status->_total_bytes_written;
}
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Function: Download::get_bytes_per_second // Function: Download::get_bytes_per_second
// Access: Public // Access: Public
@ -86,5 +97,6 @@ get_disk_write_frequency(void) const {
INLINE float Download:: INLINE float Download::
get_bytes_per_second(void) const { get_bytes_per_second(void) const {
nassertr(_tlast - _tfirst > 0.0, 0.0); nassertr(_tlast - _tfirst > 0.0, 0.0);
nassertr(_current_status != NULL, 0.0);
return (float)((double)_current_status->_total_bytes / (_tlast - _tfirst)); return (float)((double)_current_status->_total_bytes / (_tlast - _tfirst));
} }

View File

@ -361,6 +361,7 @@ run(void) {
if (connect_to_server() == false) if (connect_to_server() == false)
return DS_error_connect; return DS_error_connect;
int ret = DS_ok;
double t0 = _clock.get_real_time(); double t0 = _clock.get_real_time();
if (_tfirst == 0.0) { if (_tfirst == 0.0) {
_tfirst = t0; _tfirst = t0;
@ -376,6 +377,7 @@ run(void) {
if (write_to_disk(_current_status) == false) { if (write_to_disk(_current_status) == false) {
return DS_error_write; return DS_error_write;
} }
ret = DS_write;
} }
// Allocate a new buffer // Allocate a new buffer
@ -395,6 +397,7 @@ run(void) {
<< "Download::run() - Flushing buffer" << endl; << "Download::run() - Flushing buffer" << endl;
if (write_to_disk(_current_status) == false) if (write_to_disk(_current_status) == false)
return DS_error_write; return DS_error_write;
ret = DS_write;
} }
// Attempt to receive the bytes from the socket // Attempt to receive the bytes from the socket
@ -407,6 +410,7 @@ run(void) {
if (_current_status->_bytes_in_buffer > 0) { if (_current_status->_bytes_in_buffer > 0) {
if (write_to_disk(_current_status) == false) if (write_to_disk(_current_status) == false)
return DS_error_write; return DS_error_write;
ret = DS_write;
} }
return DS_success; return DS_success;
} else { } else {
@ -420,7 +424,7 @@ run(void) {
} }
_got_any_data = true; _got_any_data = true;
return DS_ok; return ret;
} }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////

View File

@ -58,6 +58,7 @@ PUBLISHED:
INLINE float get_byte_rate(void) const; INLINE float get_byte_rate(void) const;
INLINE void set_disk_write_frequency(int frequency); INLINE void set_disk_write_frequency(int frequency);
INLINE int get_disk_write_frequency(void) const; INLINE int get_disk_write_frequency(void) const;
INLINE int get_bytes_written(void) const;
INLINE float get_bytes_per_second(void) const; INLINE float get_bytes_per_second(void) const;
private: private: