mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-20 07:16:55 +00:00
pluginloader-win32: Check pipe state in child process
Retry if server is not ready for the connection Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3863>
This commit is contained in:
parent
0df7cd852c
commit
464a8be3a4
1 changed files with 18 additions and 4 deletions
|
@ -1152,12 +1152,26 @@ _gst_plugin_loader_client_run (const gchar * pipe_name)
|
||||||
GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING,
|
GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING,
|
||||||
FILE_FLAG_OVERLAPPED, NULL);
|
FILE_FLAG_OVERLAPPED, NULL);
|
||||||
loader.last_err = GetLastError ();
|
loader.last_err = GetLastError ();
|
||||||
|
if (loader.pipe == INVALID_HANDLE_VALUE) {
|
||||||
|
/* Server should be pending (waiting for connection) state already,
|
||||||
|
* but do retry if it's not the case */
|
||||||
|
if (loader.last_err == ERROR_PIPE_BUSY) {
|
||||||
|
if (WaitNamedPipeA (pipe_name, 5000)) {
|
||||||
|
loader.pipe = CreateFileA (pipe_name,
|
||||||
|
GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING,
|
||||||
|
FILE_FLAG_OVERLAPPED, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
loader.last_err = GetLastError ();
|
||||||
|
}
|
||||||
|
|
||||||
if (loader.pipe == INVALID_HANDLE_VALUE) {
|
if (loader.pipe == INVALID_HANDLE_VALUE) {
|
||||||
err = g_win32_error_message (loader.last_err);
|
err = g_win32_error_message (loader.last_err);
|
||||||
GST_ERROR ("CreateFileA failed with 0x%x (%s)",
|
GST_ERROR ("CreateFileA failed with 0x%x (%s)",
|
||||||
loader.last_err, GST_STR_NULL (err));
|
loader.last_err, GST_STR_NULL (err));
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* We use message mode */
|
/* We use message mode */
|
||||||
if (!SetNamedPipeHandleState (loader.pipe, &pipe_mode, NULL, NULL)) {
|
if (!SetNamedPipeHandleState (loader.pipe, &pipe_mode, NULL, NULL)) {
|
||||||
|
|
Loading…
Reference in a new issue