mirror of https://git.kore.io/kore.git
Do not kill a connection if nb->len is 0 when sending data.
This commit is contained in:
parent
8b47863cd4
commit
07079dc8c0
11
src/net.c
11
src/net.c
|
@ -97,11 +97,7 @@ net_send(struct connection *c)
|
||||||
|
|
||||||
while (!TAILQ_EMPTY(&(c->send_queue))) {
|
while (!TAILQ_EMPTY(&(c->send_queue))) {
|
||||||
nb = TAILQ_FIRST(&(c->send_queue));
|
nb = TAILQ_FIRST(&(c->send_queue));
|
||||||
if (nb->len == 0) {
|
if (nb->len != 0) {
|
||||||
kore_debug("net_send(): len is 0");
|
|
||||||
return (KORE_RESULT_ERROR);
|
|
||||||
}
|
|
||||||
|
|
||||||
r = SSL_write(c->ssl,
|
r = SSL_write(c->ssl,
|
||||||
(nb->buf + nb->offset), (nb->len - nb->offset));
|
(nb->buf + nb->offset), (nb->len - nb->offset));
|
||||||
|
|
||||||
|
@ -116,12 +112,15 @@ net_send(struct connection *c)
|
||||||
c->flags &= ~CONN_WRITE_POSSIBLE;
|
c->flags &= ~CONN_WRITE_POSSIBLE;
|
||||||
return (KORE_RESULT_OK);
|
return (KORE_RESULT_OK);
|
||||||
default:
|
default:
|
||||||
kore_debug("SSL_write(): %s", ssl_errno_s);
|
kore_debug("SSL_write(): %s",
|
||||||
|
ssl_errno_s);
|
||||||
return (KORE_RESULT_ERROR);
|
return (KORE_RESULT_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nb->offset += (size_t)r;
|
nb->offset += (size_t)r;
|
||||||
|
}
|
||||||
|
|
||||||
if (nb->offset == nb->len) {
|
if (nb->offset == nb->len) {
|
||||||
TAILQ_REMOVE(&(c->send_queue), nb, list);
|
TAILQ_REMOVE(&(c->send_queue), nb, list);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue