Fix sv_autooffload on linux.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5939 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2021-07-03 01:46:46 +00:00
parent 3409df483e
commit 80399796c7
2 changed files with 10 additions and 3 deletions

View File

@ -487,9 +487,9 @@ static int QDECL Sys_StdinRead (struct vfsfile_s *file, void *buffer, int bytest
ssize_t r;
#if defined(__linux__) && defined(_DEBUG)
int fl = fcntl (STDIN_FILENO, F_GETFL, 0);
if (!(fl & FNDELAY))
if (!(fl & O_NONBLOCK))
{
fcntl(STDIN_FILENO, F_SETFL, fl | FNDELAY);
fcntl(STDIN_FILENO, F_SETFL, fl | O_NONBLOCK);
Sys_Printf(CON_WARNING "stdin flags became blocking - gdb bug?\n");
}
#endif
@ -512,6 +512,11 @@ qboolean QDECL Sys_StdinOutClose(vfsfile_t *fs)
vfsfile_t *Sys_GetStdInOutStream(void)
{
vfsfile_t *stream = Z_Malloc(sizeof(*stream));
//make sure nothing bad is going to happen.
fcntl(STDIN_FILENO, F_SETFL, fcntl(STDIN_FILENO, F_GETFL, 0)|O_NONBLOCK);
fcntl(STDOUT_FILENO, F_SETFL, fcntl(STDOUT_FILENO, F_GETFL, 0)|O_NONBLOCK);
stream->WriteBytes = Sys_StdoutWrite;
stream->ReadBytes = Sys_StdinRead;
stream->Close = Sys_StdinOutClose;

View File

@ -2675,7 +2675,7 @@ SV_SendClientDatagram
*/
qboolean SV_SendClientDatagram (client_t *client)
{
qbyte buf[MAX_OVERALLMSGLEN];
qbyte buf[MAX_OVERALLMSGLEN-64/*play safe*/];
sizebuf_t msg;
size_t clientlimit;
unsigned int sentbytes;
@ -2707,6 +2707,8 @@ qboolean SV_SendClientDatagram (client_t *client)
else
clientlimit = client->netchan.mtu; //try not to overflow
}
else if (client->netchan.remote_address.type == NA_LOOPBACK && ISNQCLIENT(client))
clientlimit = countof(buf); //go wild. demos don't care about reliable/unreliable.
else if (client->netchan.mtu)
clientlimit = client->netchan.mtu;
else if (client->protocol == SCP_NETQUAKE)