From: Juliusz Chroboczek Date: Fri, 18 Feb 2011 00:24:40 +0000 (+0000) Subject: Tweak dummy callbacks. X-Git-Tag: 2.30b1~338 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=44e6e4a8f261dcf51d7c9f232bab30188ecd9d2d;p=transmission Tweak dummy callbacks. Don't abort, just log a message and continue. --- diff --git a/libtransmission/peer-io.c b/libtransmission/peer-io.c index 0fcf973c9..55184c21b 100644 --- a/libtransmission/peer-io.c +++ b/libtransmission/peer-io.c @@ -470,13 +470,18 @@ static struct UTPFunctionTable utp_function_table = { static void dummy_read(void *closure, const unsigned char *buf, size_t buflen) { - abort(); + /* This cannot happen, as far as I'm aware. */ + tr_nerr("UTP", "On_read called on closed socket"); + } static void dummy_write(void *closure, unsigned char *buf, size_t buflen) { - abort(); + /* This can very well happen if we've shut down a peer connection that + had unflushed buffers. Complain and send zeroes. */ + tr_ndbg("UTP", "On_write called on closed socket"); + memset(buf, 0, buflen); } static size_t @@ -500,6 +505,7 @@ dummy_on_error(void *closure, int errcode) static void dummy_on_overhead(void *closure, bool send, size_t count, int type) { + return; } static struct UTPFunctionTable dummy_utp_function_table = {