10 namespace VsnetDownload
48 , _filename( filename )
85 if (_notify) _notify->setTotalBytes( len );
91 if (_notify) _notify->addBytes( bufsize );
96 COUT<<__FUNCTION__<<
" "<<s<<
" "<<(
int) _error<<endl;
102 if (_notify) _notify->notify( s, e );
107 COUT<<__FUNCTION__<<
" "<<s<<
" "<<(
int) e<<endl;
113 if (_notify) _notify->notify( s, e );
141 Item( sock, filename, ft, notify )
142 , _destfile( filename )
143 , _localbasepath( localbasepath )
152 const string &filename,
153 string localbasepath,
156 Item( sock, filename, ft, notify )
157 , _destfile( destfile )
158 , _localbasepath( localbasepath )
191 _of->
Write( (
const char*) buffer, bufsize );
193 if (_offset >= _len) {
254 _buf.reset(
new uchar[len] );
259 if (_offset+bufsize <= _len) {
272 COUT<<
"Created TestItem for downloading "<<filename<<endl;
302 if (s ==
Completed) _fileset->update( _file, (e ==
Ok) );
312 std::list< std::string >::const_iterator cit;
313 std::list< Item* >items;
314 for (cit = filenames.begin(); cit != filenames.end(); cit++) {
315 _files.insert( std::pair< std::string, int > ( *cit, -1 ) );
320 mgr->addItems( items );
330 std::map< std::string, int >::iterator it;
331 it = _files.find( s );
332 if (it != _files.end() && it->second == -1) {
333 it->second = (v ? 1 : 0);
343 _filename( filename )
354 (*_fun)(_filename, s, e, _total, _offset);
373 cerr<<
"!!! DOWNLOAD ERROR : State="<<s<<
" - Error="<<(
int) e<<endl;