MEDIUM: connection: remove conn_{data,sock}_poll_{recv,send}
We simply remove these functions and replace their calls with the
appropriate ones :
- if we're in the data phase, we can simply report wait on the FD
- if we're in the socket phase, we may also have to signal the
desire to read/write on the socket because it might not be
active yet.
diff --git a/src/connection.c b/src/connection.c
index 0056ec0..2538cc5 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -261,7 +261,7 @@
if (errno == EINTR)
continue;
if (errno == EAGAIN) {
- __conn_sock_poll_recv(conn);
+ fd_cant_recv(conn->t.sock.fd);
return 0;
}
goto recv_abort;
diff --git a/src/proto_tcp.c b/src/proto_tcp.c
index 4460bb4..cb10661 100644
--- a/src/proto_tcp.c
+++ b/src/proto_tcp.c
@@ -657,7 +657,7 @@
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;
}
diff --git a/src/raw_sock.c b/src/raw_sock.c
index 2e3a0cb..3d42781 100644
--- a/src/raw_sock.c
+++ b/src/raw_sock.c
@@ -145,7 +145,7 @@
#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) {
@@ -203,7 +203,7 @@
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)
@@ -298,7 +298,7 @@
goto read0;
}
else if (errno == EAGAIN) {
- __conn_data_poll_recv(conn);
+ fd_cant_recv(conn->t.sock.fd);
break;
}
else if (errno != EINTR) {
@@ -376,7 +376,7 @@
}
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) {
diff --git a/src/ssl_sock.c b/src/ssl_sock.c
index 0cfcca7..d30a8eb 100644
--- a/src/ssl_sock.c
+++ b/src/ssl_sock.c
@@ -1191,7 +1191,8 @@
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) {
@@ -1206,7 +1207,8 @@
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) {
@@ -1249,7 +1251,8 @@
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) {
@@ -1257,7 +1260,8 @@
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) {
@@ -1404,7 +1408,7 @@
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 */
@@ -1485,7 +1489,7 @@
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) {
diff --git a/src/stream_interface.c b/src/stream_interface.c
index 063c173..6096dd7 100644
--- a/src/stream_interface.c
+++ b/src/stream_interface.c
@@ -487,7 +487,7 @@
out_wait:
__conn_sock_stop_recv(conn);
- __conn_sock_poll_send(conn);
+ fd_cant_send(conn->t.sock.fd);
return 0;
}