mirror of
https://github.com/EnderIce2/rpc-bridge.git
synced 2025-06-03 10:18:00 +00:00
Compare commits
No commits in common. "5d0e6c40267231a03e127af113be2668fe6f1536" and "03d5e8dbc8e90eddbd634a416f3b8892fb38530d" have entirely different histories.
5d0e6c4026
...
03d5e8dbc8
2
LICENSE
2
LICENSE
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2024 EnderIce2
|
Copyright (c) 2023 EnderIce2
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
20
bridge.c
20
bridge.c
@ -299,13 +299,11 @@ void ConnectToSocket(int fd)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HANDLE hOut = NULL;
|
|
||||||
void PipeBufferInThread(LPVOID lpParam)
|
void PipeBufferInThread(LPVOID lpParam)
|
||||||
{
|
{
|
||||||
bridge_thread *bt = (bridge_thread *)lpParam;
|
bridge_thread *bt = (bridge_thread *)lpParam;
|
||||||
print("In thread started using fd %d and pipe %#x\n",
|
print("In thread started using fd %d and pipe %#x\n",
|
||||||
bt->fd, bt->hPipe);
|
bt->fd, bt->hPipe);
|
||||||
int EOFCount = 0;
|
|
||||||
while (TRUE)
|
while (TRUE)
|
||||||
{
|
{
|
||||||
char buffer[1024];
|
char buffer[1024];
|
||||||
@ -319,22 +317,12 @@ void PipeBufferInThread(LPVOID lpParam)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EOFCount > 4)
|
|
||||||
{
|
|
||||||
print("EOF count exceeded\n");
|
|
||||||
RetryNewConnection = TRUE;
|
|
||||||
TerminateThread(hOut, 0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (unlikely(read == 0))
|
if (unlikely(read == 0))
|
||||||
{
|
{
|
||||||
print("EOF\n");
|
print("EOF\n");
|
||||||
Sleep(1000);
|
Sleep(1000);
|
||||||
EOFCount++;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
EOFCount = 0;
|
|
||||||
|
|
||||||
print("Reading %d bytes from unix pipe: \"", read);
|
print("Reading %d bytes from unix pipe: \"", read);
|
||||||
for (int i = 0; i < read; i++)
|
for (int i = 0; i < read; i++)
|
||||||
@ -535,10 +523,10 @@ NewConnection:
|
|||||||
(LPVOID)&bt,
|
(LPVOID)&bt,
|
||||||
0, NULL);
|
0, NULL);
|
||||||
|
|
||||||
hOut = CreateThread(NULL, 0,
|
HANDLE hOut = CreateThread(NULL, 0,
|
||||||
(LPTHREAD_START_ROUTINE)PipeBufferOutThread,
|
(LPTHREAD_START_ROUTINE)PipeBufferOutThread,
|
||||||
(LPVOID)&bt,
|
(LPVOID)&bt,
|
||||||
0, NULL);
|
0, NULL);
|
||||||
|
|
||||||
if (hIn == NULL || hOut == NULL)
|
if (hIn == NULL || hOut == NULL)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user