c->flags &= ~CO_FL_DATA_RD_ENA;
}
-static inline void __conn_data_poll_recv(struct connection *c)
-{
- c->flags |= CO_FL_DATA_RD_ENA;
- fd_cant_recv(c->t.sock.fd);
-}
-
static inline void __conn_data_want_send(struct connection *c)
{
c->flags |= CO_FL_DATA_WR_ENA;
c->flags &= ~CO_FL_DATA_WR_ENA;
}
-static inline void __conn_data_poll_send(struct connection *c)
-{
- c->flags |= CO_FL_DATA_WR_ENA;
- fd_cant_send(c->t.sock.fd);
-}
-
static inline void __conn_data_stop_both(struct connection *c)
{
c->flags &= ~(CO_FL_DATA_WR_ENA | CO_FL_DATA_RD_ENA);
conn_cond_update_data_polling(c);
}
-static inline void conn_data_poll_recv(struct connection *c)
-{
- __conn_data_poll_recv(c);
- conn_cond_update_data_polling(c);
-}
-
static inline void conn_data_want_send(struct connection *c)
{
__conn_data_want_send(c);
conn_cond_update_data_polling(c);
}
-static inline void conn_data_poll_send(struct connection *c)
-{
- __conn_data_poll_send(c);
- conn_cond_update_data_polling(c);
-}
-
static inline void conn_data_stop_both(struct connection *c)
{
__conn_data_stop_both(c);
c->flags &= ~CO_FL_SOCK_RD_ENA;
}
-static inline void __conn_sock_poll_recv(struct connection *c)
-{
- c->flags |= CO_FL_SOCK_RD_ENA;
- fd_cant_recv(c->t.sock.fd);
-}
-
static inline void __conn_sock_want_send(struct connection *c)
{
c->flags |= CO_FL_SOCK_WR_ENA;
c->flags &= ~CO_FL_SOCK_WR_ENA;
}
-static inline void __conn_sock_poll_send(struct connection *c)
-{
- c->flags |= CO_FL_SOCK_WR_ENA;
- fd_cant_send(c->t.sock.fd);
-}
-
static inline void __conn_sock_stop_both(struct connection *c)
{
c->flags &= ~(CO_FL_SOCK_WR_ENA | CO_FL_SOCK_RD_ENA);
conn_cond_update_sock_polling(c);
}
-static inline void conn_sock_poll_recv(struct connection *c)
-{
- __conn_sock_poll_recv(c);
- conn_cond_update_sock_polling(c);
-}
-
static inline void conn_sock_want_send(struct connection *c)
{
__conn_sock_want_send(c);
conn_cond_update_sock_polling(c);
}
-static inline void conn_sock_poll_send(struct connection *c)
-{
- __conn_sock_poll_send(c);
- conn_cond_update_sock_polling(c);
-}
-
static inline void conn_sock_stop_both(struct connection *c)
{
__conn_sock_stop_both(c);
*/
static inline int conn_drain(struct connection *conn)
{
- int ret;
-
if (!conn_ctrl_ready(conn))
return 1;
if (!conn->ctrl->drain)
return 0;
- ret = conn->ctrl->drain(conn->t.sock.fd);
- if (ret < 0)
- __conn_data_poll_recv(conn);
-
- if (ret <= 0)
+ if (conn->ctrl->drain(conn->t.sock.fd) <= 0)
return 0;
conn->flags |= CO_FL_SOCK_RD_SH;
if (errno == EINTR)
continue;
if (errno == EAGAIN) {
- __conn_sock_poll_recv(conn);
+ fd_cant_recv(conn->t.sock.fd);
return 0;
}
goto recv_abort;
if (connect(fd, (struct sockaddr *)&conn->addr.to, get_addr_len(&conn->addr.to)) < 0) {
if (errno == EALREADY || errno == EINPROGRESS) {
__conn_sock_stop_recv(conn);
- __conn_sock_poll_send(conn);
+ fd_cant_send(fd);
return 0;
}
#ifndef ASSUME_SPLICE_WORKS
if (splice_detects_close)
#endif
- __conn_data_poll_recv(conn); /* we know for sure that it's EAGAIN */
+ fd_cant_recv(conn->t.sock.fd); /* we know for sure that it's EAGAIN */
break;
}
else if (errno == ENOSYS || errno == EINVAL || errno == EBADF) {
if (ret <= 0) {
if (ret == 0 || errno == EAGAIN) {
- __conn_data_poll_send(conn);
+ fd_cant_send(conn->t.sock.fd);
break;
}
else if (errno == EINTR)
goto read0;
}
else if (errno == EAGAIN) {
- __conn_data_poll_recv(conn);
+ fd_cant_recv(conn->t.sock.fd);
break;
}
else if (errno != EINTR) {
}
else if (ret == 0 || errno == EAGAIN || errno == ENOTCONN) {
/* nothing written, we need to poll for write first */
- __conn_data_poll_send(conn);
+ fd_cant_send(conn->t.sock.fd);
break;
}
else if (errno != EINTR) {
if (ret == SSL_ERROR_WANT_WRITE) {
/* SSL handshake needs to write, L4 connection may not be ready */
__conn_sock_stop_recv(conn);
- __conn_sock_poll_send(conn);
+ __conn_sock_want_send(conn);
+ fd_cant_send(conn->t.sock.fd);
return 0;
}
else if (ret == SSL_ERROR_WANT_READ) {
if (conn->flags & CO_FL_WAIT_L4_CONN)
conn->flags &= ~CO_FL_WAIT_L4_CONN;
__conn_sock_stop_send(conn);
- __conn_sock_poll_recv(conn);
+ __conn_sock_want_recv(conn);
+ fd_cant_recv(conn->t.sock.fd);
return 0;
}
else if (ret == SSL_ERROR_SYSCALL) {
if (ret == SSL_ERROR_WANT_WRITE) {
/* SSL handshake needs to write, L4 connection may not be ready */
__conn_sock_stop_recv(conn);
- __conn_sock_poll_send(conn);
+ __conn_sock_want_send(conn);
+ fd_cant_send(conn->t.sock.fd);
return 0;
}
else if (ret == SSL_ERROR_WANT_READ) {
if (conn->flags & CO_FL_WAIT_L4_CONN)
conn->flags &= ~CO_FL_WAIT_L4_CONN;
__conn_sock_stop_send(conn);
- __conn_sock_poll_recv(conn);
+ __conn_sock_want_recv(conn);
+ fd_cant_recv(conn->t.sock.fd);
return 0;
}
else if (ret == SSL_ERROR_SYSCALL) {
break;
}
/* we need to poll for retry a read later */
- __conn_data_poll_recv(conn);
+ fd_cant_recv(conn->t.sock.fd);
break;
}
/* otherwise it's a real error */
break;
}
/* we need to poll to retry a write later */
- __conn_data_poll_send(conn);
+ fd_cant_send(conn->t.sock.fd);
break;
}
else if (ret == SSL_ERROR_WANT_READ) {
out_wait:
__conn_sock_stop_recv(conn);
- __conn_sock_poll_send(conn);
+ fd_cant_send(conn->t.sock.fd);
return 0;
}