mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
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:
parent
057b2afa4e
commit
e232dcb0a3
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user