fix not close udp fd
@@ -328,8 +328,10 @@ read:
return;
read_error:
disconnect:
+ if (io->io_type & HIO_TYPE_SOCK_STREAM) {
hio_close(io);
}
+}
static void nio_write(hio_t* io) {
// printd("nio_write fd=%d\n", io->fd);
@@ -382,8 +384,10 @@ write:
write_error:
disconnect:
hrecursive_mutex_unlock(&io->write_mutex);
+ if (io->io_type & HIO_TYPE_SOCK_STREAM) {
hio_close(io);
}
+}
static void hio_handle_events(hio_t* io) {
if ((io->events & HV_READ) && (io->revents & HV_READ)) {
@@ -538,7 +542,9 @@ disconnect:
* if hio_close_sync, we have to be very careful to avoid using freed resources.
* But if hio_close_async, we do not have to worry about this.
*/
+ if (io->io_type & HIO_TYPE_SOCK_STREAM) {
hio_close_async(io);
+ }
return nwrite < 0 ? nwrite : -1;
}
