From: Andre Noll Date: Tue, 6 Apr 2010 17:32:32 +0000 (+0200) Subject: udp_send_fec(): Treat ECONNREFUSED like EAGAIN. X-Git-Tag: v0.4.2~11^2~1 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=c1d6c466251d21d1fb7b513ba2297ebf94d44853 udp_send_fec(): Treat ECONNREFUSED like EAGAIN. Writes to udp sockets may return ECONNREFUSED. As this is often only a temporary condition, there is no need to kick the target. This patch makes the udp sender ignore such errors rather than kicking the client from the udp target list on the first error. Thanks to Gerrit Renker for suggesting this change. --- diff --git a/udp_send.c b/udp_send.c index efe80b6d..533af63a 100644 --- a/udp_send.c +++ b/udp_send.c @@ -237,6 +237,8 @@ static int udp_send_fec(char *buf, size_t len, void *private_data) if (ret < 0) goto fail; ret = send_queued_chunks(ut->fd, ut->cq, 0); + if (ret == -ERRNO_TO_PARA_ERROR(ECONNREFUSED)) + ret = 0; if (ret < 0) goto fail; if (!len) @@ -247,6 +249,8 @@ static int udp_send_fec(char *buf, size_t len, void *private_data) goto fail; } ret = write_nonblock(ut->fd, buf, len, 0); + if (ret == -ERRNO_TO_PARA_ERROR(ECONNREFUSED)) + ret = 0; if (ret < 0) goto fail; if (ret != len) {