Commit a15e2460 authored by Scott Vokes's avatar Scott Vokes
Browse files

Fix EINTR and SSL read control flow in listener.

parent 491deb21
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@ void ListenerCmd_NotifyCaller(int fd) {
        if (wres == -1) {
            if (errno == EINTR) {
                errno = 0;
                continue;
            } else {
                err(1, "write");
            }
+1 −0
Original line number Diff line number Diff line
@@ -77,6 +77,7 @@ bool listener_helper_push_message(struct listener *l, listener_msg *msg, int *re
        } else {
            if (errno == EINTR) { /* signal interrupted; retry */
                errno = 0;
                continue;
            } else {
                BUS_LOG_SNPRINTF(b, 10, LOG_LISTENER, b->udata, 64,
                    "write_commit error, errno %d", errno);
+6 −3
Original line number Diff line number Diff line
@@ -92,6 +92,7 @@ static bool socket_read_plain(struct bus *b, listener *l, int pfd_i, connection_
                    "read: socket error reading, %d", errno);
                set_error_for_socket(l, pfd_i, ci->fd, RX_ERROR_READ_FAILURE);
                errno = 0;
                return false;
            }
        }
        
@@ -142,11 +143,13 @@ static bool socket_read_ssl(struct bus *b, listener *l, int pfd_i, connection_in
                    BUS_ASSERT(b, b->udata, false);
                } else if (util_is_resumable_io_error(errno)) {
                    errno = 0;
                    continue;
                } else {
                    BUS_LOG_SNPRINTF(b, 3, LOG_LISTENER, b->udata, 64,
                        "SSL_read fd %d: errno %d\n", ci->fd, errno);
                    print_SSL_error(b, ci, 1, "SSL_ERROR_SYSCALL");
                    set_error_for_socket(l, pfd_i, ci->fd, RX_ERROR_READ_FAILURE);
                    return false;
                }
                break;
            }
@@ -155,7 +158,7 @@ static bool socket_read_ssl(struct bus *b, listener *l, int pfd_i, connection_in
                BUS_LOG_SNPRINTF(b, 3, LOG_LISTENER, b->udata, 64,
                    "SSL_read fd %d: ZERO_RETURN (HUP)\n", ci->fd);
                set_error_for_socket(l, pfd_i, ci->fd, RX_ERROR_POLLHUP);
                break;
                return false;
            }
            
            default: