Index: trunk/willow/src/willow/wnet.cc |
— | — | @@ -121,20 +121,27 @@ |
122 | 122 | #endif |
123 | 123 | int newfd, val; |
124 | 124 | struct fde *newe; |
125 | | - |
| 125 | +static time_t last_nfile = 0; |
| 126 | + time_t now = time(NULL); |
126 | 127 | if ((cdata = (client_data *)wcalloc(1, sizeof(*cdata))) == NULL) |
127 | 128 | outofmemory(); |
128 | 129 | |
129 | 130 | addrlen = sizeof(cdata->cdat_addr); |
130 | 131 | |
131 | 132 | if ((newfd = accept(e->fde_fd, (struct sockaddr *) &cdata->cdat_addr, &addrlen)) < 0) { |
132 | | - wlog(WLOG_NOTICE, "accept error: %s", strerror(errno)); |
| 133 | + if (errno != ENFILE || now - last_nfile > 60) |
| 134 | + wlog(WLOG_NOTICE, "accept error: %s", strerror(errno)); |
| 135 | + if (errno == ENFILE) |
| 136 | + last_nfile = now; |
133 | 137 | wfree(cdata); |
134 | 138 | return; |
135 | 139 | } |
136 | 140 | |
137 | 141 | if (newfd >= max_fd) { |
138 | | - wlog(WLOG_NOTICE, "out of file descriptors!"); |
| 142 | + if (errno != ENFILE || now - last_nfile > 60) |
| 143 | + wlog(WLOG_NOTICE, "out of file descriptors!"); |
| 144 | + if (errno == ENFILE) |
| 145 | + last_nfile = now; |
139 | 146 | wfree(cdata); |
140 | 147 | (void)close(newfd); |
141 | 148 | return; |
— | — | @@ -173,9 +180,13 @@ |
174 | 181 | wnet_open(const char *desc) |
175 | 182 | { |
176 | 183 | int fd, val; |
177 | | - |
| 184 | +static int last_nfile = 0; |
| 185 | + time_t now = time(NULL); |
178 | 186 | if ((fd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) { |
179 | | - wlog(WLOG_WARNING, "socket: %s", strerror(errno)); |
| 187 | + if (errno != ENFILE || now - last_nfile > 60) |
| 188 | + wlog(WLOG_WARNING, "socket: %s", strerror(errno)); |
| 189 | + if (errno == ENFILE) |
| 190 | + last_nfile = now; |
180 | 191 | return -1; |
181 | 192 | } |
182 | 193 | |
Index: trunk/willow/src/willow/wbackend.cc |
— | — | @@ -96,7 +96,9 @@ |
97 | 97 | { |
98 | 98 | struct backend_cb_data *cbd; |
99 | 99 | int s; |
100 | | - |
| 100 | +static time_t last_nfile; |
| 101 | + time_t now = time(NULL); |
| 102 | + |
101 | 103 | WDEBUG((WLOG_DEBUG, "get_backend: called")); |
102 | 104 | |
103 | 105 | cbd = new backend_cb_data; |
— | — | @@ -114,7 +116,10 @@ |
115 | 117 | } |
116 | 118 | |
117 | 119 | if ((s = wnet_open("backend connection")) == -1) { |
118 | | - wlog(WLOG_WARNING, "opening backend socket: %s", strerror(errno)); |
| 120 | + if (errno != ENFILE || now - last_nfile > 60) |
| 121 | + wlog(WLOG_WARNING, "opening backend socket: %s", strerror(errno)); |
| 122 | + if (errno == ENFILE) |
| 123 | + last_nfile = now; |
119 | 124 | wfree(cbd); |
120 | 125 | return -1; |
121 | 126 | } |