firmware-utils/mktplinkfw: add support for the TL-MR3220 v1
[openwrt.git] / package / busybox / patches / 610-syslog-remote-retry-connection.patch
1 --- a/sysklogd/syslogd.c
2 +++ b/sysklogd/syslogd.c
3 @@ -555,6 +555,7 @@ static void do_syslogd(void)
4 {
5 int sock_fd;
6 #if ENABLE_FEATURE_REMOTE_LOG
7 + int send_err = 0;
8 llist_t *item;
9 #endif
10 #if ENABLE_FEATURE_SYSLOGD_DUP
11 @@ -636,11 +637,23 @@ static void do_syslogd(void)
12 if (rh->remoteFD == -1)
13 continue;
14 }
15 - /* Send message to remote logger, ignore possible error */
16 - /* TODO: on some errors, close and set G.remoteFD to -1
17 - * so that DNS resolution and connect is retried? */
18 - sendto(rh->remoteFD, recvbuf, sz+1, MSG_DONTWAIT,
19 - &(rh->remoteAddr->u.sa), rh->remoteAddr->len);
20 + /* Send message to remote logger */
21 + if (sendto(rh->remoteFD, recvbuf, sz+1, MSG_DONTWAIT,
22 + &(rh->remoteAddr->u.sa), rh->remoteAddr->len) == -1)
23 + send_err = errno;
24 +
25 + /* On some errors, close and set G.remoteFD to -1
26 + * so that DNS resolution and connect is retried */
27 + switch (send_err) {
28 + case ECONNRESET:
29 + case EDESTADDRREQ:
30 + case EISCONN:
31 + case ENOTCONN:
32 + case EPIPE:
33 + close(rh->remoteFD);
34 + rh->remoteFD = -1;
35 + break;
36 + }
37 }
38 #endif
39 if (!ENABLE_FEATURE_REMOTE_LOG || (option_mask32 & OPT_locallog)) {
This page took 0.042992 seconds and 5 git commands to generate.