mirror of
https://github.com/transmission/transmission
synced 2024-12-25 01:03:01 +00:00
(trunk, libT) #2253: I love you, valgrind pt 3
This commit is contained in:
parent
4658ad9c66
commit
d6ed808f9c
1 changed files with 8 additions and 0 deletions
|
@ -267,6 +267,14 @@ tr_evbuffer_write( tr_peerIo * io, int fd, size_t howmuch )
|
|||
if( n > 0 )
|
||||
evbuffer_drain( buffer, n );
|
||||
|
||||
/* keep the iobuf's excess capacity from growing too large */
|
||||
if( buffer->totallen > ( EVBUFFER_LENGTH( buffer ) + 1024 ) ) {
|
||||
struct evbuffer * swap = evbuffer_new( );
|
||||
evbuffer_add( swap, EVBUFFER_DATA( buffer ), EVBUFFER_LENGTH( buffer ) );
|
||||
evbuffer_free( buffer );
|
||||
io->outbuf = swap;
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue