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
39
src/net.c
39
src/net.c
|
@ -97,31 +97,30 @@ 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");
|
r = SSL_write(c->ssl,
|
||||||
return (KORE_RESULT_ERROR);
|
(nb->buf + nb->offset), (nb->len - nb->offset));
|
||||||
}
|
|
||||||
|
|
||||||
r = SSL_write(c->ssl,
|
kore_debug("net_send(%ld/%ld bytes), progress with %d",
|
||||||
(nb->buf + nb->offset), (nb->len - nb->offset));
|
nb->offset, nb->len, r);
|
||||||
|
|
||||||
kore_debug("net_send(%ld/%ld bytes), progress with %d",
|
if (r <= 0) {
|
||||||
nb->offset, nb->len, r);
|
r = SSL_get_error(c->ssl, r);
|
||||||
|
switch (r) {
|
||||||
if (r <= 0) {
|
case SSL_ERROR_WANT_READ:
|
||||||
r = SSL_get_error(c->ssl, r);
|
case SSL_ERROR_WANT_WRITE:
|
||||||
switch (r) {
|
c->flags &= ~CONN_WRITE_POSSIBLE;
|
||||||
case SSL_ERROR_WANT_READ:
|
return (KORE_RESULT_OK);
|
||||||
case SSL_ERROR_WANT_WRITE:
|
default:
|
||||||
c->flags &= ~CONN_WRITE_POSSIBLE;
|
kore_debug("SSL_write(): %s",
|
||||||
return (KORE_RESULT_OK);
|
ssl_errno_s);
|
||||||
default:
|
return (KORE_RESULT_ERROR);
|
||||||
kore_debug("SSL_write(): %s", ssl_errno_s);
|
}
|
||||||
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