typedef enum RAD_LISTEN_STATUS {
RAD_LISTEN_STATUS_INIT = 0,
RAD_LISTEN_STATUS_KNOWN,
+ RAD_LISTEN_STATUS_PAUSE,
+ RAD_LISTEN_STATUS_RESUME,
RAD_LISTEN_STATUS_FROZEN,
RAD_LISTEN_STATUS_EOL,
RAD_LISTEN_STATUS_REMOVE_NOW
/*
* All sockets: add the FD to the event handler.
*/
+ insert_fd:
if (fr_event_fd_insert(el, 0, this->fd,
event_socket_handler, this)) {
this->status = RAD_LISTEN_STATUS_KNOWN;
this->status = RAD_LISTEN_STATUS_REMOVE_NOW;
} /* end of INIT */
+ if (this->status == RAD_LISTEN_STATUS_PAUSE) {
+ fr_event_fd_delete(el, 0, this->fd);
+ return;
+ }
+
+ if (this->status == RAD_LISTEN_STATUS_RESUME) goto insert_fd;
+
#ifdef WITH_TCP
/*
* The socket has reached a timeout. Try to close it.
request->packet->data[3] = 20;
sock->state = LISTEN_TLS_CHECKING;
PTHREAD_MUTEX_UNLOCK(&sock->mutex);
+
+ /*
+ * Don't read from the socket until the request
+ * returns.
+ */
+ listener->status = RAD_LISTEN_STATUS_PAUSE;
+ radius_update_listener(listener);
+
return 1;
}
return 0;
}
+ /*
+ * Resume reading from the listener.
+ */
+ listener->status = RAD_LISTEN_STATUS_RESUME;
+ radius_update_listener(listener);
+
rad_assert(sock->request->packet != request->packet);
sock->state = LISTEN_TLS_SETUP;