- relay_connection = caa_container_of(node,
- struct relay_command, sock_n);
-
- if (revents & (LPOLLERR)) {
- ERR("POLL ERROR");
- relay_cleanup_poll_connection(&events, pollfd);
- relay_del_connection(relay_connections_ht,
- &iter, relay_connection, sessions_ht);
- if (last_seen_data_fd == pollfd) {
- last_seen_data_fd = last_notdel_data_fd;
- }
- } else if (revents & (LPOLLHUP | LPOLLRDHUP)) {
- DBG("Socket %d hung up", pollfd);
- relay_cleanup_poll_connection(&events, pollfd);
- relay_del_connection(relay_connections_ht,
- &iter, relay_connection, sessions_ht);
- if (last_seen_data_fd == pollfd) {
- last_seen_data_fd = last_notdel_data_fd;
- }
- } else if (revents & LPOLLIN) {
- /* control socket */
- if (relay_connection->type == RELAY_CONTROL) {
- ret = relay_connection->sock->ops->recvmsg(
- relay_connection->sock, &recv_hdr,
- sizeof(struct lttcomm_relayd_hdr), 0);
- /* connection closed */
- if (ret <= 0) {
- relay_cleanup_poll_connection(&events, pollfd);
- relay_del_connection(relay_connections_ht,
- &iter, relay_connection, sessions_ht);
- DBG("Control connection closed with %d", pollfd);
- } else {
- if (relay_connection->session) {
- DBG2("Relay worker receiving data for session : %" PRIu64,
- relay_connection->session->id);
- }
- ret = relay_process_control(&recv_hdr,
- relay_connection, relay_ctx);
- if (ret < 0) {
- /* Clear the session on error. */
- relay_cleanup_poll_connection(&events, pollfd);
- relay_del_connection(relay_connections_ht,
- &iter, relay_connection, sessions_ht);
- DBG("Connection closed with %d", pollfd);
- }
- seen_control = 1;
- }
- } else {