libvchan_server_init() now does not wait for a client to connect. A server should wait for an incoming event and then call libvchan_server_handle_connected().
This commit is contained in:
parent
e31128341b
commit
db324b270e
18
vchan/init.c
18
vchan/init.c
@ -256,7 +256,7 @@ struct libvchan *libvchan_server_init(int devno)
|
||||
return ctrl;
|
||||
}
|
||||
|
||||
#ifndef WINNT
|
||||
|
||||
|
||||
int libvchan_server_handle_connected(struct libvchan *ctrl)
|
||||
{
|
||||
@ -264,14 +264,21 @@ int libvchan_server_handle_connected(struct libvchan *ctrl)
|
||||
char buf[64];
|
||||
int ret = -1;
|
||||
int libvchan_fd;
|
||||
fd_set rfds;
|
||||
// fd_set rfds;
|
||||
|
||||
#ifdef WINNT
|
||||
xs = xs_domain_open();
|
||||
#else
|
||||
xs = xs_daemon_open();
|
||||
#endif
|
||||
if (!xs) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifndef WINNT
|
||||
// clear the pending flag
|
||||
xc_evtchn_pending(ctrl->evfd);
|
||||
#endif
|
||||
|
||||
snprintf(buf, sizeof buf, "device/vchan/%d", ctrl->devno);
|
||||
xs_rm(xs, 0, buf);
|
||||
@ -291,6 +298,8 @@ fail2:
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifndef WINNT
|
||||
|
||||
/**
|
||||
retrieves ring-ref and event-channel numbers from xenstore (if
|
||||
they don't exist, return error, because nobody seems to listen);
|
||||
@ -435,11 +444,6 @@ struct libvchan *libvchan_client_init(int domain, int devno)
|
||||
|
||||
// Windows domains can not be dom0
|
||||
|
||||
int libvchan_server_handle_connected(struct libvchan *ctrl)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
struct libvchan *libvchan_client_init(int domain, int devno)
|
||||
{
|
||||
return NULL;
|
||||
|
17
vchan/io.c
17
vchan/io.c
@ -71,6 +71,22 @@ int libvchan_is_eof(struct libvchan *ctrl)
|
||||
/**
|
||||
\return -1 return value means peer has closed
|
||||
*/
|
||||
|
||||
#ifdef WINNT
|
||||
int libvchan_wait(struct libvchan *ctrl)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = xc_evtchn_pending(ctrl->evfd);
|
||||
if (ret!=-1 && xc_evtchn_unmask(ctrl->evfd, ctrl->evport))
|
||||
return -1;
|
||||
if (ret!=-1 && libvchan_is_eof(ctrl))
|
||||
return -1;
|
||||
return ret;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
int libvchan_wait(struct libvchan *ctrl)
|
||||
{
|
||||
int ret;
|
||||
@ -98,6 +114,7 @@ int libvchan_wait(struct libvchan *ctrl)
|
||||
return -1;
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
may sleep (only if no buffer space available);
|
||||
|
@ -9,6 +9,8 @@ USE_MSVCRT=1
|
||||
|
||||
DLLDEF=libvchan.def
|
||||
|
||||
C_DEFINES = $(C_DEFINES) /DCONFIG_STUBDOM
|
||||
|
||||
INCLUDES=$(INCLUDES); \
|
||||
..\win\include;\
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user