0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-11-17 16:48:43 +00:00

Real write is only in sk_maybe_write. Previous change partially reverted.

Thank you MJ.
This commit is contained in:
Ondrej Filip 2005-02-14 23:15:04 +00:00
parent 2eef9e887a
commit c025b85273

View File

@ -75,13 +75,6 @@ tracked_fopen(pool *p, char *name, char *mode)
return f; return f;
} }
void
c_err_hook(struct birdsock *s, int err)
{
s->ttx = s->tpos; /* empty tx buffer */
s->err_hook(s, err);
}
/** /**
* DOC: Timers * DOC: Timers
* *
@ -687,7 +680,7 @@ sk_passive_connected(sock *s, struct sockaddr *sa, int al, int type)
else if (errno != EINTR && errno != EAGAIN) else if (errno != EINTR && errno != EAGAIN)
{ {
log(L_ERR "accept: %m"); log(L_ERR "accept: %m");
c_err_hook(s, errno); s->err_hook(s, errno);
} }
return 0; return 0;
} }
@ -905,7 +898,8 @@ sk_maybe_write(sock *s)
{ {
if (errno != EINTR && errno != EAGAIN) if (errno != EINTR && errno != EAGAIN)
{ {
c_err_hook(s, errno); s->ttx = s->tpos; /* empty tx buffer */
s->err_hook(s, errno);
return -1; return -1;
} }
return 0; return 0;
@ -930,7 +924,8 @@ sk_maybe_write(sock *s)
{ {
if (errno != EINTR && errno != EAGAIN) if (errno != EINTR && errno != EAGAIN)
{ {
c_err_hook(s, errno); s->ttx = s->tpos; /* empty tx buffer */
s->err_hook(s, errno);
return -1; return -1;
} }
return 0; return 0;
@ -1008,10 +1003,10 @@ sk_read(sock *s)
if (c < 0) if (c < 0)
{ {
if (errno != EINTR && errno != EAGAIN) if (errno != EINTR && errno != EAGAIN)
c_err_hook(s, errno); s->err_hook(s, errno);
} }
else if (!c) else if (!c)
c_err_hook(s, 0); s->err_hook(s, 0);
else else
{ {
s->rpos += c; s->rpos += c;
@ -1036,7 +1031,7 @@ sk_read(sock *s)
if (e < 0) if (e < 0)
{ {
if (errno != EINTR && errno != EAGAIN) if (errno != EINTR && errno != EAGAIN)
c_err_hook(s, errno); s->err_hook(s, errno);
return 0; return 0;
} }
s->rpos = s->rbuf + e; s->rpos = s->rbuf + e;
@ -1059,7 +1054,7 @@ sk_write(sock *s)
if (connect(s->fd, (struct sockaddr *) &sa, sizeof(sa)) >= 0 || errno == EISCONN) if (connect(s->fd, (struct sockaddr *) &sa, sizeof(sa)) >= 0 || errno == EISCONN)
sk_tcp_connected(s); sk_tcp_connected(s);
else if (errno != EINTR && errno != EAGAIN && errno != EINPROGRESS) else if (errno != EINTR && errno != EAGAIN && errno != EINPROGRESS)
c_err_hook(s, errno); s->err_hook(s, errno);
return 0; return 0;
} }
default: default: