diff options
| author | andreykproductengine <none@none> | 2016-10-12 20:18:05 +0300 | 
|---|---|---|
| committer | andreykproductengine <none@none> | 2016-10-12 20:18:05 +0300 | 
| commit | b98bc258f23c3497a5c0605d1be56d44a058be88 (patch) | |
| tree | 119f01c23802f29e3476ed8b6dc3ac2893753d2a /indra/llmessage | |
| parent | 67c24d933b2aaebadcb86878b4cadf28ce719f56 (diff) | |
MAINT-6487 Viewer Objects should not queue too many downloads
Diffstat (limited to 'indra/llmessage')
| -rw-r--r-- | indra/llmessage/llxfer.cpp | 2 | ||||
| -rw-r--r-- | indra/llmessage/llxfermanager.cpp | 38 | ||||
| -rw-r--r-- | indra/llmessage/llxfermanager.h | 3 | 
3 files changed, 35 insertions, 8 deletions
diff --git a/indra/llmessage/llxfer.cpp b/indra/llmessage/llxfer.cpp index 4aba5cae72..e0590dfdff 100644 --- a/indra/llmessage/llxfer.cpp +++ b/indra/llmessage/llxfer.cpp @@ -294,7 +294,7 @@ S32 LLXfer::processEOF()  	}  	else  	{ -		LL_INFOS() << "xfer from " << mRemoteHost << " failed, code " +		LL_INFOS() << "xfer from " << mRemoteHost << " failed or aborted, code "  				<< mCallbackResult << ": " << getFileName() << LL_ENDL;  	} diff --git a/indra/llmessage/llxfermanager.cpp b/indra/llmessage/llxfermanager.cpp index 0ab67b8dda..58d3ee47a1 100644 --- a/indra/llmessage/llxfermanager.cpp +++ b/indra/llmessage/llxfermanager.cpp @@ -401,7 +401,7 @@ U64 LLXferManager::registerXfer(const void *datap, const S32 length)  /////////////////////////////////////////////////////////// -void LLXferManager::requestFile(const std::string& local_filename, +U64 LLXferManager::requestFile(const std::string& local_filename,  								const std::string& remote_filename,  								ELLPath remote_path,  								const LLHost& remote_host, @@ -424,10 +424,12 @@ void LLXferManager::requestFile(const std::string& local_filename,  		{  			// cout << "requested a xfer already in progress" << endl; -			return; +			return xferp->mID;  		}  	} +	U64 xfer_id = 0; +  	S32 chunk_size = use_big_packets ? LL_XFER_LARGE_PAYLOAD : -1;  	xferp = (LLXfer *) new LLXfer_File(chunk_size);  	if (xferp) @@ -438,13 +440,15 @@ void LLXferManager::requestFile(const std::string& local_filename,  		// around.  		// Note: according to AaronB, this is here to deal with locks on files that were  		// in transit during a crash, -		if(delete_remote_on_completion && -		   (remote_filename.substr(remote_filename.length()-4) == ".tmp")) +		if( delete_remote_on_completion +			&& (remote_filename.substr(remote_filename.length()-4) == ".tmp") +			&& gDirUtilp->fileExists(local_filename))  		{  			LLFile::remove(local_filename);  		} +		xfer_id = getNextID();  		((LLXfer_File *)xferp)->initializeRequest( -			getNextID(), +			xfer_id,  			local_filename,  			remote_filename,  			remote_path, @@ -457,6 +461,7 @@ void LLXferManager::requestFile(const std::string& local_filename,  	{  		LL_ERRS() << "Xfer allocation error" << LL_ENDL;  	} +	return xfer_id;  }  void LLXferManager::requestFile(const std::string& remote_filename, @@ -616,7 +621,7 @@ void LLXferManager::processReceiveData (LLMessageSystem *mesgsys, void ** /*user  	if (!xferp)   	{  		char U64_BUF[MAX_STRING];		/* Flawfinder : ignore */ -		LL_WARNS() << "received xfer data from " << mesgsys->getSender() +		LL_INFOS() << "received xfer data from " << mesgsys->getSender()  			<< " for non-existent xfer id: "  			<< U64_to_str(id, U64_BUF, sizeof(U64_BUF)) << LL_ENDL;  		return; @@ -1103,6 +1108,27 @@ void LLXferManager::retransmitUnackedPackets ()  	}  } +/////////////////////////////////////////////////////////// + +void LLXferManager::abortRequestById(U64 xfer_id, S32 result_code) +{ +	LLXfer * xferp = findXfer(xfer_id, mReceiveList); +	if (xferp) +	{ +		if (xferp->mStatus == e_LL_XFER_IN_PROGRESS) +		{ +			// causes processAbort(); +			xferp->abort(result_code); +		} +		else +		{ +			xferp->mCallbackResult = result_code; +			xferp->processEOF(); //should norify requestor +			removeXfer(xferp, &mReceiveList); +			startPendingDownloads(); +		} +	} +}  /////////////////////////////////////////////////////////// diff --git a/indra/llmessage/llxfermanager.h b/indra/llmessage/llxfermanager.h index b3d110e7a1..d258f0a5ce 100644 --- a/indra/llmessage/llxfermanager.h +++ b/indra/llmessage/llxfermanager.h @@ -140,7 +140,7 @@ class LLXferManager  // file requesting routines  // .. to file -	virtual void requestFile(const std::string& local_filename, +	virtual U64 requestFile(const std::string& local_filename,  							 const std::string& remote_filename,  							 ELLPath remote_path,  							 const LLHost& remote_host, @@ -202,6 +202,7 @@ class LLXferManager  	virtual void retransmitUnackedPackets ();  // error handling +	void abortRequestById(U64 xfer_id, S32 result_code);  	virtual void processAbort (LLMessageSystem *mesgsys, void **user_data);  };  | 
