1) Fix some assertion for reconnect.
2) Call VMCISock_GetAFValueFd so we do not hold vsock usage all the time.
2) Cut off the dependency of SIGUSR1 with dndcp plugin.
3) Change function name vmware_unblock_vmware_user to send_vmware_user_sigusr1.
Signed-off-by: Dmitry Torokhov <dtor@vmware.com>
RpcChannel_New(void)
{
RpcChannel *chan;
-#if 0 /* defined(linux) || defined(_WIN32)
- This is a temporarily workaround for bug 1053489 */
+#if defined(linux) || defined(_WIN32)
chan = VSockChannel_New();
#else
chan = BackdoorChannel_New();
if (chan != NULL && chan->funcs != NULL && chan->funcs->shutdown != NULL) {
if (chan->in != NULL) {
+ if (chan->inStarted) {
+ RpcIn_stop(chan->in);
+ }
+ chan->inStarted = FALSE;
RpcIn_Destruct(chan->in);
+ chan->in = NULL;
+ } else {
+ ASSERT(!chan->inStarted);
}
+
if (chan->mainCtx != NULL) {
g_main_context_unref(chan->mainCtx);
}
/* Already started. Make sure both channels are in sync and return. */
ASSERT(chan->in == NULL || chan->inStarted);
return TRUE;
- } else {
- ASSERT(chan->in == NULL || !chan->inStarted);
}
- if (chan->in != NULL) {
+ if (chan->in != NULL && !chan->inStarted) {
ok = RpcIn_start(chan->in, RPCIN_MAX_DELAY, RpcChannel_Error, chan);
chan->inStarted = ok;
}
SockConnError error = SOCKERR_GENERIC;
int sysErr;
socklen_t addrLen = sizeof addr;
+ int vsockDev = -1;
+ int family = VMCISock_GetAFValueFd(&vsockDev);
if (outError) {
*outError = SOCKERR_SUCCESS;
goto error;
}
+ if (family == -1) {
+ g_warning(LGPFX "Couldn't get VMCI socket family info.");
+ goto error;
+ }
+
memset((char *)&addr, 0, sizeof addr);
- addr.svm_family = VMCISock_GetAFValue();
+ addr.svm_family = family;
addr.svm_cid = cid;
addr.svm_port = port;
goto error;
}
+ VMCISock_ReleaseAFValueFd(vsockDev);
g_debug(LGPFX "socket %d connected\n", fd);
return fd;
if (outError) {
*outError = error;
}
+ VMCISock_ReleaseAFValueFd(vsockDev);
return INVALID_SOCKET;
}
BlockService::ShutdownSignalHandler(const siginfo_t *siginfo,
gpointer data)
{
- ToolsAppCtx *ctx = (ToolsAppCtx *)data;
TRACE_CALL();
+ g_debug("Shutting down block service on SIGUSR1 ...\n");
GetInstance()->Shutdown();
- /* shutdown rpc channel to free up VMCI/VSOCKET module usage */
- if (ctx->rpc != NULL) {
- RpcChannel_Shutdown(ctx->rpc);
- ctx->rpc = NULL;
- }
-
return FALSE;
}
/**
* Handles a USR1 signal; logs the current service state.
+ * Also shutdown rpc connection so we can do tools upgrade.
*
* @param[in] info Unused.
* @param[in] data Unused.
gpointer data)
{
ToolsCore_DumpState(&gState);
+
+ g_info("Shutting down guestrpc on signal USR1 ...\n");
+ if (strcmp(gState.ctx.name, VMTOOLS_USER_SERVICE) == 0) {
+ RpcChannel_Shutdown(gState.ctx.rpc);
+ gState.ctx.rpc = NULL;
+ }
+
return TRUE;
}