1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-25 09:13:06 +00:00

(trunk, libT) #2253: I love you, valgrind pt 3

This commit is contained in:
Charles Kerr 2009-07-01 00:46:30 +00:00
parent 4658ad9c66
commit d6ed808f9c

View file

@ -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;
}