@@ -1262,8 +1262,22 @@ static struct hyper_event_ops hyper_ttyfd_ops = {
12621262 .wbuf_size = 10240 ,
12631263};
12641264
1265- static struct hyper_event_ops hyper_vsock_listen_ops = {
1266- .read = hyper_vsock_accept ,
1265+ static int hyper_vsock_ctl_accept (struct hyper_event * he , int efd , int events )
1266+ {
1267+ return hyper_vsock_accept (he , efd , & hyper_epoll .ctl , & hyper_ctlfd_ops );
1268+ }
1269+
1270+ static int hyper_vsock_msg_accept (struct hyper_event * he , int efd , int events )
1271+ {
1272+ return hyper_vsock_accept (he , efd , & hyper_epoll .tty , & hyper_ttyfd_ops );
1273+ }
1274+
1275+ static struct hyper_event_ops hyper_vsock_ctl_listen_ops = {
1276+ .read = hyper_vsock_ctl_accept ,
1277+ };
1278+
1279+ static struct hyper_event_ops hyper_vsock_msg_listen_ops = {
1280+ .read = hyper_vsock_msg_accept ,
12671281};
12681282
12691283static int hyper_loop (void )
@@ -1340,14 +1354,14 @@ static int hyper_loop(void)
13401354
13411355 if (hyper_epoll .vsock_ctl_listener .fd > 0 ) {
13421356 fprintf (stdout , "hyper_init_event hyper vsock control channel listener event %p, ops %p, fd %d\n" ,
1343- & hyper_epoll .vsock_ctl_listener , & hyper_vsock_listen_ops , hyper_epoll .vsock_ctl_listener .fd );
1344- if (hyper_init_event (& hyper_epoll .vsock_ctl_listener , & hyper_vsock_listen_ops , pod ) < 0 ||
1357+ & hyper_epoll .vsock_ctl_listener , & hyper_vsock_ctl_listen_ops , hyper_epoll .vsock_ctl_listener .fd );
1358+ if (hyper_init_event (& hyper_epoll .vsock_ctl_listener , & hyper_vsock_ctl_listen_ops , pod ) < 0 ||
13451359 hyper_add_event (hyper_epoll .efd , & hyper_epoll .vsock_ctl_listener , EPOLLIN ) < 0 ) {
13461360 return -1 ;
13471361 }
13481362 fprintf (stdout , "hyper_init_event hyper vsock message channel listener event %p, ops %p, fd %d\n" ,
1349- & hyper_epoll .vsock_msg_listener , & hyper_vsock_listen_ops , hyper_epoll .vsock_msg_listener .fd );
1350- if (hyper_init_event (& hyper_epoll .vsock_msg_listener , & hyper_vsock_listen_ops , pod ) < 0 ||
1363+ & hyper_epoll .vsock_msg_listener , & hyper_vsock_msg_listen_ops , hyper_epoll .vsock_msg_listener .fd );
1364+ if (hyper_init_event (& hyper_epoll .vsock_msg_listener , & hyper_vsock_msg_listen_ops , pod ) < 0 ||
13511365 hyper_add_event (hyper_epoll .efd , & hyper_epoll .vsock_msg_listener , EPOLLIN ) < 0 ) {
13521366 return -1 ;
13531367 }
0 commit comments