ssize_t bytes_read;
bytes_read = read(fd, buf, sizeof(buf));
- if (bytes_read < 0)
+ if (bytes_read <= 0)
return false;
send_notification_to_devices(chrc->service->app->database,
io_set_close_on_destroy(io, true);
- io_set_read_handler(io, sock_io_read, user_data, NULL);
-
io_set_disconnect_handler(io, sock_hup, user_data, NULL);
return io;
DBG("AcquireNotify success: fd %d MTU %u\n", fd, mtu);
chrc->notify_io = sock_io_new(fd, chrc);
+ io_set_read_handler(chrc->notify_io, sock_io_read, chrc, NULL);
__sync_fetch_and_add(&chrc->ntfy_cnt, 1);