fix: use closed socket in io watcher

ev_epoll.c:134: epoll_modify: Assertion `("libev: I/O watcher with invalid fd found in epoll_ctl", errno != EBADF && errno != ELOOP && errno != EINVAL)`

Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
This commit is contained in:
Jianhui Zhao
2022-05-09 18:13:35 +08:00
parent ffa5c84eb2
commit 2be649c84c
2 changed files with 5 additions and 4 deletions
+3
View File
@@ -40,6 +40,9 @@ static void send_http_msg(struct http_connection *conn, size_t len, uint8_t *dat
struct rtty *rtty = conn->rtty;
struct buffer *wb = &rtty->wb;
if (rtty->sock == -1)
return;
buffer_put_u8(wb, MSG_TYPE_HTTP);
buffer_put_u16be(wb, 18 + len);
buffer_put_data(wb, conn->addr, 18);
+2 -4
View File
@@ -314,10 +314,8 @@ void rtty_exit(struct rtty *rtty)
}
#endif
if (rtty->sock > 0) {
close(rtty->sock);
rtty->sock = -1;
}
close(rtty->sock);
rtty->sock = -1;
http_conns_free(&rtty->http_conns);