From: Juliusz Chroboczek Date: Fri, 18 Feb 2011 00:36:05 +0000 (+0000) Subject: Set the read buffer of UTP sockets to a well-defined value. X-Git-Tag: 2.30b1~326 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=236fb3d9d6591988925debd34faf5dfb8fe67a70;p=transmission Set the read buffer of UTP sockets to a well-defined value. --- diff --git a/libtransmission/peer-io.c b/libtransmission/peer-io.c index 763cd7624..8c3e7e581 100644 --- a/libtransmission/peer-io.c +++ b/libtransmission/peer-io.c @@ -47,6 +47,10 @@ #define EPIPE WSAECONNRESET #endif +/* The amount of read bufferring that we allow for uTP sockets. */ + +#define UTP_READ_BUFFER_SIZE (256 * 1024) + static size_t guessPacketOverhead( size_t d ) { @@ -572,9 +576,11 @@ tr_peerIoNew( tr_session * session, } else { tr_ndbg( "UTP", "New %s connection", isIncoming ? "incoming" : "outgoing" ); + UTP_SetSockopt( utp_socket, SO_RCVBUF, UTP_READ_BUFFER_SIZE ); UTP_SetCallbacks( utp_socket, &utp_function_table, io ); + } return io;