Changeset 507
- Timestamp:
- 04/06/07 20:02:45 (17 months ago)
- Location:
- museek+/trunk/sources/Museek
- Files:
-
- 3 modified
-
PeerConnection.cc (modified) (1 diff)
-
TransferManager.cc (modified) (4 diffs)
-
TransferManager.hh (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
museek+/trunk/sources/Museek/PeerConnection.cc
r480 r507 345 345 PARSE(PUploadFailed); 346 346 DEBUG("got Upload Failed from %s, %s", mUser.c_str(), s.filename.c_str()); 347 Transfer *transfer = mPeer->download(mMuseek->recoder()->decode_user(mUser, s.filename)); 348 if(! transfer) { 349 DEBUG("couldn't find transfer %s, %s", mUser.c_str(), s.filename.c_str()); 350 break; 351 } if((transfer->state() != TS_Queued) || (! transfer->auto_retry())) 352 transfer->set_error("Upload failed"); 353 else 354 DEBUG("Retrying download"); 347 355 break; 348 356 } -
museek+/trunk/sources/Museek/TransferManager.cc
r314 r507 233 233 Transfer::Transfer(TransferManager* manager, Direction direction, Peer* peer, const wstring& path, const wstring& local_path, const wstring& temp_path, off_t size) 234 234 : mManager(manager), mDirection(direction), mTicketValid(false), mPeer(peer), mPath(path), mLocalPath(local_path), mTempPath(temp_path), 235 mState((direction == Download) ? TS_Offline : TS_Queued), mSize(size), mPos(0), mRate(0), mPlaceInQueue((uint32)-1), 235 mState((direction == Download) ? TS_Offline : TS_Queued), mSize(size), mPos(0), mRate(0), mPlaceInQueue((uint32)-1), mAutoRetries(0), 236 236 mConnection(0), mFD(-1), mCollected(0) { 237 237 CT("transfer %s, %s", peer->user().c_str(), path.c_str()); … … 278 278 mPeer->remove_transfer(this); 279 279 mPeer->add_transfer(this); 280 } 281 282 bool Transfer::auto_retry() { 283 if(mAutoRetries > 3) 284 return false; 285 ++mAutoRetries; 286 retry(); 287 return true; 280 288 } 281 289 … … 343 351 if(mPeer->uploading() == this) 344 352 mPeer->set_uploading(0); 345 353 354 break; 355 356 case TS_Transferring: 357 mAutoRetries = 0; 358 break; 359 346 360 default: ; 347 361 } … … 349 363 mState = state; 350 364 mManager->museek()->cb_transfer_update(this); 365 366 if(mDirection == Download && mState == TS_ConnectionClosed) 367 { 368 DEBUG("connection closed by peer, automatically retrying"); 369 auto_retry(); 370 } 351 371 } 352 372 -
museek+/trunk/sources/Museek/TransferManager.hh
r2 r507 47 47 48 48 void retry(); 49 bool auto_retry(); 49 50 50 51 inline bool ticket_valid() const { return mTicketValid; }; … … 115 116 uint32 mRate, mPlaceInQueue; 116 117 std::vector<uint32> mRatePool; 118 int mAutoRetries; 117 119 118 120 BaseConnection* mConnection;
