uv binding for socket_is_closed
@@ -25,6 +25,7 @@ struct st_h2o_uv_socket_t {
uv_handle_t *handle;
uv_close_cb close_cb;
h2o_timer_t write_cb_timer;
+ int is_closed;
union {
struct {
union {
@@ -147,10 +148,17 @@ void do_dispose_socket(h2o_socket_t *_sock)
void do_close_socket(h2o_socket_t *_sock)
{
struct st_h2o_uv_socket_t *sock = (struct st_h2o_uv_socket_t *)_sock;
+ sock->is_closed = 1;
sock->super._cb.write = NULL; /* avoid the write callback getting called when closing the socket (#1249) */
h2o_timer_unlink(&sock->write_cb_timer);
}
+int socket_is_closed(h2o_socket_t *_sock)
+{
+ struct st_h2o_uv_socket_t *sock = (struct st_h2o_uv_socket_t *)_sock;
+ return sock->is_closed;
+}
+
int h2o_socket_get_fd(h2o_socket_t *_sock)
{
int fd, ret;
