mirror of
https://github.com/zhaojh329/rtty.git
synced 2026-02-27 09:53:17 +08:00
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:
@@ -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
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user