globally prevent chunk corruption and sendign of enormous messages

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8142 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2015-04-19 15:04:24 +00:00
parent 057b2afa4e
commit e232dcb0a3

View File

@ -604,10 +604,23 @@ void GRouterTunnelInfo::addVirtualPeer(const TurtleVirtualPeerId& vpid)
if(first_tunnel_ok_TS == 0) first_tunnel_ok_TS = now ;
last_tunnel_ok_TS = now ;
}
RsGRouterAbstractMsgItem *GRouterDataInfo::addDataChunk(RsGRouterTransactionChunkItem *chunk)
{
last_activity_TS = time(NULL) ;
// perform some checking
if(chunk->total_size > MAX_GROUTER_DATA_SIZE + 10000 || chunk->chunk_size > chunk->total_size || chunk->chunk_start >= chunk->total_size)
{
std::cerr << " ERROR: chunk size is unconsistent, or too large: size=" << chunk->chunk_size << ", start=" << chunk->chunk_start << ", total size=" << chunk->total_size << ". Chunk will be dropped. Data pipe will be reset." << std::endl;
clear() ;
delete chunk ;
return NULL ;
}
// now add that chunk.
if(incoming_data_buffer == NULL)
{
if(chunk->chunk_start != 0)