Cygwin: FIFO: fix indentation
This commit is contained in:
parent
6b8a829496
commit
b0418138fe
|
@ -501,98 +501,98 @@ fhandler_fifo::fifo_reader_thread_func ()
|
||||||
}
|
}
|
||||||
|
|
||||||
owner_listen:
|
owner_listen:
|
||||||
fifo_client_lock ();
|
fifo_client_lock ();
|
||||||
cleanup_handlers ();
|
cleanup_handlers ();
|
||||||
if (add_client_handler () < 0)
|
if (add_client_handler () < 0)
|
||||||
api_fatal ("Can't add a client handler, %E");
|
api_fatal ("Can't add a client handler, %E");
|
||||||
|
|
||||||
/* Listen for a writer to connect to the new client handler. */
|
/* Listen for a writer to connect to the new client handler. */
|
||||||
fifo_client_handler& fc = fc_handler[nhandlers - 1];
|
fifo_client_handler& fc = fc_handler[nhandlers - 1];
|
||||||
fifo_client_unlock ();
|
fifo_client_unlock ();
|
||||||
shared_fc_handler_updated (false);
|
shared_fc_handler_updated (false);
|
||||||
owner_unlock ();
|
owner_unlock ();
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
IO_STATUS_BLOCK io;
|
IO_STATUS_BLOCK io;
|
||||||
bool cancel = false;
|
bool cancel = false;
|
||||||
bool update = false;
|
bool update = false;
|
||||||
|
|
||||||
status = NtFsControlFile (fc.h, conn_evt, NULL, NULL, &io,
|
status = NtFsControlFile (fc.h, conn_evt, NULL, NULL, &io,
|
||||||
FSCTL_PIPE_LISTEN, NULL, 0, NULL, 0);
|
FSCTL_PIPE_LISTEN, NULL, 0, NULL, 0);
|
||||||
if (status == STATUS_PENDING)
|
if (status == STATUS_PENDING)
|
||||||
|
{
|
||||||
|
HANDLE w[3] = { conn_evt, update_needed_evt, cancel_evt };
|
||||||
|
switch (WaitForMultipleObjects (3, w, false, INFINITE))
|
||||||
{
|
{
|
||||||
HANDLE w[3] = { conn_evt, update_needed_evt, cancel_evt };
|
case WAIT_OBJECT_0:
|
||||||
switch (WaitForMultipleObjects (3, w, false, INFINITE))
|
status = io.Status;
|
||||||
{
|
debug_printf ("NtFsControlFile STATUS_PENDING, then %y",
|
||||||
case WAIT_OBJECT_0:
|
status);
|
||||||
status = io.Status;
|
|
||||||
debug_printf ("NtFsControlFile STATUS_PENDING, then %y",
|
|
||||||
status);
|
|
||||||
break;
|
|
||||||
case WAIT_OBJECT_0 + 1:
|
|
||||||
status = STATUS_WAIT_1;
|
|
||||||
update = true;
|
|
||||||
break;
|
|
||||||
case WAIT_OBJECT_0 + 2:
|
|
||||||
status = STATUS_THREAD_IS_TERMINATING;
|
|
||||||
cancel = true;
|
|
||||||
update = true;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
api_fatal ("WFMO failed, %E");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
debug_printf ("NtFsControlFile status %y, no STATUS_PENDING",
|
|
||||||
status);
|
|
||||||
HANDLE ph = NULL;
|
|
||||||
NTSTATUS status1;
|
|
||||||
|
|
||||||
fifo_client_lock ();
|
|
||||||
switch (status)
|
|
||||||
{
|
|
||||||
case STATUS_SUCCESS:
|
|
||||||
case STATUS_PIPE_CONNECTED:
|
|
||||||
record_connection (fc);
|
|
||||||
break;
|
break;
|
||||||
case STATUS_PIPE_CLOSING:
|
case WAIT_OBJECT_0 + 1:
|
||||||
record_connection (fc, fc_closing);
|
status = STATUS_WAIT_1;
|
||||||
|
update = true;
|
||||||
break;
|
break;
|
||||||
case STATUS_THREAD_IS_TERMINATING:
|
case WAIT_OBJECT_0 + 2:
|
||||||
case STATUS_WAIT_1:
|
status = STATUS_THREAD_IS_TERMINATING;
|
||||||
/* Try to connect a bogus client. Otherwise fc is still
|
cancel = true;
|
||||||
listening, and the next connection might not get recorded. */
|
update = true;
|
||||||
status1 = open_pipe (ph);
|
|
||||||
WaitForSingleObject (conn_evt, INFINITE);
|
|
||||||
if (NT_SUCCESS (status1))
|
|
||||||
/* Bogus cilent connected. */
|
|
||||||
delete_client_handler (nhandlers - 1);
|
|
||||||
else
|
|
||||||
/* Did a real client connect? */
|
|
||||||
switch (io.Status)
|
|
||||||
{
|
|
||||||
case STATUS_SUCCESS:
|
|
||||||
case STATUS_PIPE_CONNECTED:
|
|
||||||
record_connection (fc);
|
|
||||||
break;
|
|
||||||
case STATUS_PIPE_CLOSING:
|
|
||||||
record_connection (fc, fc_closing);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
debug_printf ("NtFsControlFile status %y after failing to connect bogus client or real client", io.Status);
|
|
||||||
fc.state = fc_unknown;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
api_fatal ("WFMO failed, %E");
|
||||||
}
|
}
|
||||||
if (ph)
|
}
|
||||||
NtClose (ph);
|
else
|
||||||
if (update && update_shared_handlers () < 0)
|
debug_printf ("NtFsControlFile status %y, no STATUS_PENDING",
|
||||||
api_fatal ("Can't update shared handlers, %E");
|
status);
|
||||||
fifo_client_unlock ();
|
HANDLE ph = NULL;
|
||||||
if (cancel)
|
NTSTATUS status1;
|
||||||
goto canceled;
|
|
||||||
|
fifo_client_lock ();
|
||||||
|
switch (status)
|
||||||
|
{
|
||||||
|
case STATUS_SUCCESS:
|
||||||
|
case STATUS_PIPE_CONNECTED:
|
||||||
|
record_connection (fc);
|
||||||
|
break;
|
||||||
|
case STATUS_PIPE_CLOSING:
|
||||||
|
record_connection (fc, fc_closing);
|
||||||
|
break;
|
||||||
|
case STATUS_THREAD_IS_TERMINATING:
|
||||||
|
case STATUS_WAIT_1:
|
||||||
|
/* Try to connect a bogus client. Otherwise fc is still
|
||||||
|
listening, and the next connection might not get recorded. */
|
||||||
|
status1 = open_pipe (ph);
|
||||||
|
WaitForSingleObject (conn_evt, INFINITE);
|
||||||
|
if (NT_SUCCESS (status1))
|
||||||
|
/* Bogus cilent connected. */
|
||||||
|
delete_client_handler (nhandlers - 1);
|
||||||
|
else
|
||||||
|
/* Did a real client connect? */
|
||||||
|
switch (io.Status)
|
||||||
|
{
|
||||||
|
case STATUS_SUCCESS:
|
||||||
|
case STATUS_PIPE_CONNECTED:
|
||||||
|
record_connection (fc);
|
||||||
|
break;
|
||||||
|
case STATUS_PIPE_CLOSING:
|
||||||
|
record_connection (fc, fc_closing);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
debug_printf ("NtFsControlFile status %y after failing to connect bogus client or real client", io.Status);
|
||||||
|
fc.state = fc_unknown;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (ph)
|
||||||
|
NtClose (ph);
|
||||||
|
if (update && update_shared_handlers () < 0)
|
||||||
|
api_fatal ("Can't update shared handlers, %E");
|
||||||
|
fifo_client_unlock ();
|
||||||
|
if (cancel)
|
||||||
|
goto canceled;
|
||||||
}
|
}
|
||||||
canceled:
|
canceled:
|
||||||
if (conn_evt)
|
if (conn_evt)
|
||||||
|
|
Loading…
Reference in New Issue