From d02633af4e780c4b6f6d938c67d84d2c968adb79 Mon Sep 17 00:00:00 2001 From: Andrey Nazarov Date: Sat, 11 Oct 2008 15:05:50 +0000 Subject: Major redesign of GTV protocol: added support for persistent GTV connections, bidirectional pinging, low traffic (`suspended') modes. HTTP server is now gone (remote console logging is temporary gone too), custom binary protocol is used for GTV connections now. MVD client no longer serves other MVD clients, only regular spectators. Changed FIFO buffers to be regular circular buffers, not BIP-buffers. Removed `sv_http_*', `sv_console_auth' variables. Added `sv_mvd_maxclients' variable, `addgtvhost', `delgtvhost' and `listgtvhosts' commands. Renamed `sv_mvd_max*' cvars for consistency. Reset `sv_ghostime' default value back to 6, but changed semantics: it now waits for any packet from client, not just `begin' packet. Added `--disable-mvd-server' and `--disable-mvd-client' options to configure script. FS_Restart() no longer chokes on real files opened for reading. Fixed client chat prompt length. Stubbed out more debugging stuff from dedicated server builds. --- source/common.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'source/common.c') diff --git a/source/common.c b/source/common.c index e5ec0c3..e3bf26d 100644 --- a/source/common.c +++ b/source/common.c @@ -294,7 +294,7 @@ void Com_Printf( const char *fmt, ... ) { Sys_ConsoleOutput( msg ); // remote console - SV_ConsoleOutput( msg ); + //SV_ConsoleOutput( msg ); // logfile if( com_logFile ) { @@ -976,6 +976,28 @@ size_t FIFO_Write( fifo_t *fifo, const void *buffer, size_t len ) { return tail + wrapped; } +qboolean FIFO_ReadMessage( fifo_t *fifo, size_t msglen ) { + size_t len; + byte *data; + + data = FIFO_Peek( fifo, &len ); + if( len < msglen ) { + // read in two chunks into message buffer + if( !FIFO_TryRead( fifo, msg_read_buffer, msglen ) ) { + return qfalse; // not yet available + } + SZ_Init( &msg_read, msg_read_buffer, sizeof( msg_read_buffer ) ); + } else { + // read in a single block without copying any memory + SZ_Init( &msg_read, data, msglen ); + FIFO_Decommit( fifo, msglen ); + } + + msg_read.cursize = msglen; + return qtrue; +} + + /* ============================================================================== -- cgit v1.2.3