send XVFB_CMD_QUIT command to pcxvfb process when terminating the IAL engine

This commit is contained in:
Vincent Wei
2020-03-16 17:34:13 +08:00
parent 43b8b8de59
commit 072ac4e166
+17 -11
View File
@@ -689,21 +689,19 @@ BOOL ial_InitPCXVFBInput (INPUT* input, const char* mdev, const char* mtype)
{ {
char path[PATH_MAX], *template; char path[PATH_MAX], *template;
template = getenv("MG_ENV_RECORD_IAL"); template = getenv("MG_ENV_RECORD_IAL");
if (template) if (template) {
{
#if 0 #if 0
snprintf(path, sizeof(path), "%s%ld", template, time(NULL)); snprintf(path, sizeof(path), "%s%ld", template, time(NULL));
#else #else
snprintf(path, sizeof(path), "%s", template); snprintf(path, sizeof(path), "%s", template);
#endif #endif
path[sizeof(path)/sizeof(path[0])-1] = 0; path[sizeof(path)/sizeof(path[0])-1] = 0;
open_rec (path); open_rec (path);
record_time_start = getcurtime(); record_time_start = getcurtime();
} }
} }
return TRUE; return TRUE;
} }
@@ -725,6 +723,14 @@ void TermPCXVFBInput (void)
socket_file[49] = '\0'; socket_file[49] = '\0';
if (__mg_pcxvfb_client_sockfd >= 0) { if (__mg_pcxvfb_client_sockfd >= 0) {
/* Since 5.0.0: send a quit command to XVFB */
XVFBCmdEventData cmd = { CMD_TYPE, XVFB_CMD_QUIT };
if (mg_writesocket (__mg_pcxvfb_client_sockfd, &cmd, sizeof (cmd)) <
sizeof (cmd)) {
// do nothing
}
close(__mg_pcxvfb_client_sockfd); close(__mg_pcxvfb_client_sockfd);
__mg_pcxvfb_client_sockfd = -1; __mg_pcxvfb_client_sockfd = -1;
} }
@@ -733,7 +739,7 @@ void TermPCXVFBInput (void)
__mg_pcxvfb_server_sockfd = -1; __mg_pcxvfb_server_sockfd = -1;
} }
unlink(socket_file); unlink(socket_file);
#if defined(_MGRM_PROCESSES) && !defined(_MGRM_STANDALONE) #if defined(_MGRM_PROCESSES)
if (mgIsServer) { if (mgIsServer) {
remove("/tmp/.pcxvfb_tmp"); remove("/tmp/.pcxvfb_tmp");
} }
@@ -741,4 +747,4 @@ void TermPCXVFBInput (void)
#endif /* WIN32 */ #endif /* WIN32 */
} }
#endif /* _MGGAL_PCXVFB*/ #endif /* _MGGAL_PCXVFB */