Warn about tunnel buffer being full only once per second
Otherwise, when the network output bandwidth is full, we additionally fill the disk with logs.
This commit is contained in:
parent
b0a93e8809
commit
7fd81113e6
1 changed files with 14 additions and 1 deletions
15
l2tpns.c
15
l2tpns.c
|
|
@ -1301,7 +1301,20 @@ void tunnelsend(uint8_t * buf, uint16_t l, tunnelidt t)
|
|||
|
||||
if (sendto(udpfd[tunnel[t].indexudp], buf, l, 0, (void *) &addr, sizeof(addr)) < 0)
|
||||
{
|
||||
LOG(0, ntohs((*(uint16_t *) (buf + 6))), t, "Error sending data out tunnel: %s (udpfd=%d, buf=%p, len=%d, dest=%s)\n",
|
||||
sessionidt s = ntohs((*(uint16_t *) (buf + 6)));
|
||||
if (errno == EAGAIN)
|
||||
{
|
||||
static time_t lastwarn;
|
||||
time_t newtime = time(NULL);
|
||||
|
||||
if (lastwarn != newtime)
|
||||
{
|
||||
lastwarn = newtime;
|
||||
LOG(0, 0, t, "Error sending data out tunnel: buffer full\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
LOG(0, s, t, "Error sending data out tunnel: %s (udpfd=%d, buf=%p, len=%d, dest=%s)\n",
|
||||
strerror(errno), udpfd[tunnel[t].indexudp], buf, l, inet_ntoa(addr.sin_addr));
|
||||
STAT(tunnel_tx_errors);
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue