1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-15 07:40:23 +02:00

Fix order in which pipes are opened on linux.

This commit is contained in:
James Crook 2018-01-14 11:50:58 +00:00
parent f9dab3679c
commit 549fa48a24

View File

@ -54,13 +54,17 @@ void PipeServer()
for(;;)
{
// open to (incoming) pipe first.
printf( "Obtaining pipe\n" );
bConnected = ConnectNamedPipe(hPipeToSrv, NULL) ?
TRUE : (GetLastError()==ERROR_PIPE_CONNECTED );
printf( "Obtained to-srv %i\n", bConnected );
// open from (outgoing) pipe second. This could block if there is no reader.
bConnected = ConnectNamedPipe(hPipeFromSrv, NULL) ?
TRUE : (GetLastError()==ERROR_PIPE_CONNECTED );
printf( "Obtained from-srv %i\n", bConnected );
if( bConnected )
{
for(;;)
@ -142,13 +146,7 @@ void PipeServer()
// return;
}
fromFifo = fopen(fromFifoName, "w");
if (fromFifo == NULL)
{
perror("Unable to open fifo from server to script");
return;
}
// open to (incoming) pipe first.
toFifo = fopen(toFifoName, "r");
if (toFifo == NULL)
{
@ -158,6 +156,14 @@ void PipeServer()
return;
}
// open from (outgoing) pipe second. This could block if there is no reader.
fromFifo = fopen(fromFifoName, "w");
if (fromFifo == NULL)
{
perror("Unable to open fifo from server to script");
return;
}
while (fgets(buf, sizeof(buf), toFifo) != NULL)
{
int len = strlen(buf);