Przeglądaj źródła

fix loop->nios error (#210)

SeeWhy 3 lat temu
rodzic
commit
468ad68977
1 zmienionych plików z 3 dodań i 8 usunięć
  1. 3 8
      event/nio.c

+ 3 - 8
event/nio.c

@@ -70,9 +70,7 @@ static void ssl_server_handshake(hio_t* io) {
     int ret = hssl_accept(io->ssl);
     if (ret == 0) {
         // handshake finish
-        iowatcher_del_event(io->loop, io->fd, HV_READ);
-        io->events &= ~HV_READ;
-        io->cb = NULL;
+        hio_del(io, HV_READ);
         printd("ssl handshake finished.\n");
         __accept_cb(io);
     }
@@ -93,9 +91,7 @@ static void ssl_client_handshake(hio_t* io) {
     int ret = hssl_connect(io->ssl);
     if (ret == 0) {
         // handshake finish
-        iowatcher_del_event(io->loop, io->fd, HV_READ);
-        io->events &= ~HV_READ;
-        io->cb = NULL;
+        hio_del(io, HV_READ);
         printd("ssl handshake finished.\n");
         __connect_cb(io);
     }
@@ -403,8 +399,7 @@ static void hio_handle_events(hio_t* io) {
         // NOTE: del HV_WRITE, if write_queue empty
         hrecursive_mutex_lock(&io->write_mutex);
         if (write_queue_empty(&io->write_queue)) {
-            iowatcher_del_event(io->loop, io->fd, HV_WRITE);
-            io->events &= ~HV_WRITE;
+            hio_del(io, HV_WRITE);
         }
         hrecursive_mutex_unlock(&io->write_mutex);
         if (io->connect) {