| 310 | } |
| 311 | |
| 312 | static void |
| 313 | vhost_user_read_cb(int connfd, void *dat, int *remove) |
| 314 | { |
| 315 | struct vhost_user_connection *conn = dat; |
| 316 | struct vhost_user_socket *vsocket = conn->vsocket; |
| 317 | int ret; |
| 318 | |
| 319 | ret = vhost_user_msg_handler(conn->vid, connfd); |
| 320 | if (ret < 0) { |
| 321 | struct virtio_net *dev = get_device(conn->vid); |
| 322 | |
| 323 | close(connfd); |
| 324 | *remove = 1; |
| 325 | |
| 326 | if (dev) |
| 327 | vhost_destroy_device_notify(dev); |
| 328 | |
| 329 | if (vsocket->notify_ops->destroy_connection) |
| 330 | vsocket->notify_ops->destroy_connection(conn->vid); |
| 331 | |
| 332 | vhost_destroy_device(conn->vid); |
| 333 | |
| 334 | if (vsocket->reconnect) { |
| 335 | create_unix_socket(vsocket); |
| 336 | vhost_user_start_client(vsocket); |
| 337 | } |
| 338 | |
| 339 | pthread_mutex_lock(&vsocket->conn_mutex); |
| 340 | TAILQ_REMOVE(&vsocket->conn_list, conn, next); |
| 341 | pthread_mutex_unlock(&vsocket->conn_mutex); |
| 342 | |
| 343 | free(conn); |
| 344 | } |
| 345 | } |
| 346 | |
| 347 | static int |
| 348 | create_unix_socket(struct vhost_user_socket *vsocket) |
nothing calls this directly
no test coverage detected