summaryrefslogtreecommitdiff
path: root/source/net_common.c
AgeCommit message (Collapse)Author
2010-09-15Renamed source tree subdirectory into ‘src’, moved ‘asm’ ↵Andrey Nazarov
subdirectory there and renamed it into ‘i386’.
2010-08-02Made client and server buildable with mingw32 again.Andrey Nazarov
Use uint64_t type for network counters.
2010-07-03Yet another huge commit.Andrey Nazarov
Implemented new error reporting framework based on errno and custom error codes. Converted filesystem code, image and model managers, BSP loader to use the new framework and report errors more accurately. Replaced fileHandle_t with qhandle_t. Removed INVALID_LENGTH definition. Killed USE_LOADBUF code. Defined FS_FileExists(Ex) macro, implemented FS_EasyOpenFile and FS_WriteFile helper functions. When testing for free screenshot slots, open the file with O_EXCL flag to avoid race conditions (works only on glibc yet). Don't allow quake paths with high bits set. Don't tolerate any fatal errors encountered when searching for files and pass errors back to the caller. FS_Seek() now fails on files from packs instead of returning an invalid position. Fixed ‘mvdskip’ command not working properly. Avoid inefficient usage of MakeColor macro in image loading functions. Prevent memory leak in JPEG and PNG image functions after calling longjmp() by marking some local variables volatile. Added support for loading monochrome JPEG images. Fixed signed integer overflow in GetWavinfo(). Fixed missing return statement in BSP_LoadSurfEdges() causing out of range edge indices to be left uncaught. Fixed possible access to uninitialized memory in BSP_LoadLeafs() for maps with no leafs. Properly NUL terminate the buffer in SCR_ScoreDump_f(), also check for being in a level. Always free latched_string when cvar is set back to current value. Fixed a crash in ‘mvdplay’ command possible when demo file is invalid.
2010-06-03Don't use IP_PMTUDISC_PROBE on old systems where it is not defined.Andrey Nazarov
2010-05-31Do not retry sendto() if destination address is found in the error queue to ↵Andrey Nazarov
prevent looping. Experimental support for path MTU discovery enabled by setting ‘net_ignore_icmp’ to negative value. Moved net_from into net_common.c from net_chan.c
2010-05-29Include files.h in net_common.c when building with _DEBUG.Andrey Nazarov
2010-05-29On Linux, disable Path MTU Discovery when creating UDP socket so that IP ↵Andrey Nazarov
fragmentation is allowed.
2009-10-30Properly handle EWOULDBLOCK when doing accept().Andrey Nazarov
2009-10-24NET_RunStream may now only reset ‘want’ flags on IO entries, but not set ↵Andrey Nazarov
them back.
2009-10-23Properly handle EWOULDBLOCK in NET_RunStream and reset corresponding ↵Andrey Nazarov
canread/canwrite flags.
2009-10-22Added a wrapper around select() for waiting on multiple file descriptors.Andrey Nazarov
Converted all TCP streams code to use single select() call per server frame.
2009-10-19Always suck ICMP error queue on Linux once recvfrom/sento returned an error, ↵Andrey Nazarov
don't attempt to be smart about error types.
2009-09-04Allow ‘a.b.c’, ‘a.b’ and ‘a’ IP address notations in ↵Andrey Nazarov
NET_StringToSockaddr.
2009-06-11Fixed TCP_OpenSocket broken around r345.Andrey Nazarov
Fixed ‘wait’ command processing in the client buffer. Fixed compilation error.
2009-06-03Don't cap maxmsglen on loopback connections.Andrey Nazarov
Use seperate buffer for stuffcmd processing on client so that something like ‘map foobar;wait;wait;wait;give shells’ works (original Q2 used deferred buffer for this). Don't include netgraph code into release builds. Made ‘changing’ and ‘precache’ commands not available from console, since they may confuse the client when typed manually. Client now handles newlines embedded into ‘cstring’ and ‘cstring2’ layout commands properly. Fixed a crash when displaying inventory. Detect zero bytes embedded into config files and refuse to execute them.
2009-05-23Fixed scrolling in MVD clients menu.Andrey Nazarov
Implemented automatic chasecam hack for MVD observers. Correctly handle ICMP errors resluting in sendto() failing on Linux. Added ‘--disable-icmp’ option to configure script. Implemented ‘net_stats’ console command.
2009-05-12Fixed Win32 compilation warning.Andrey Nazarov
2009-05-12Do not include network packet logger into release build.Andrey Nazarov
Use ‘int’ type instead of ‘u_long’ for socket ioctls.
2009-05-10Reworked error handling in UDP/TCP_OpenSocket so that errors enabling ↵Andrey Nazarov
certain non-important socket options are no longer fatal and just result in a warning.
2009-01-30Client now works around the fact R1Q2 servers always report the highestAndrey Nazarov
protocol number they support in svc_serverdata message, regardless of the actual protocol version being used. Be silent and try to preserve reliable data at least when client demo message overflows, do not dump entire message. Use playerstate coordinates for positioning player's own entity in case it is invisible regardless of server protocol version. Changed ‘map_allsolid_bug’ default to 0, since it seems to break some mods. Implemented ‘recycle’ command for dedicated servers. Correctly parse comments from ‘/etc/default/q2pro’ config file. Install SIGHUP handler when running dedicated server only. It can now be used to reopen server logfile for rotation. Allow ${arg1-arg2} syntax when expanding alias parameters.
2009-01-10Made MinGW built OpenFFA game DLL loadable on Win32.Andrey Nazarov
Server now disallows ‘map’ command by default if no latched variables were changed. Added ‘sv_allow_map’ cvar to turn this check off. Implemented ‘kickban’ server command. Made address/mask matching code endianess safe. Made ‘dumpuser’ server command more verbose. Display client FPS value in the output of ‘status’ command. Fixed a crash when MVD channel with an active GTV connection was destroyed. Made it possible to re-enable old Q2 brush tracing bug via ‘map_allsolid_bug’ cvar. Added ‘allow_download_textures’ and ‘allow_download_pics’ cvar for fine tuning download options on client and server sides. Changed ‘allow_download’ default value to 0.
2008-12-15Put -lm back as it seems to break on non-i386 arches.Andrey Nazarov
Removed `sys_stdio' cvar in favor of `sys_console' on Unix. Unix client no longer writes anything on stdout by default if launched without a terminal (e.g. from X session). Server now uses entity origin instead of view origin when performing PVS/PHS culling of multicast data (fixes railing/chaining out of the water, etc). MVD client now clears roll angle of player entities. Really fixed MVD channel overflow recovery. Use RTLD_LAZY for loading game library on Unix to work around old mods. When adjusting lightmap/texture color saturation, calculate luminance accoring to sRGB colorspace specification. Fixed OpenGL renderer's PVS glitches when crossing water boundaries. Re-enable MD3 model support.
2008-11-13Hacked the source to get it compile on Windows Mobile using CeGCC toolchain.Andrey Nazarov
Fixed nasty memory corruption bug in UI scripts loading code. Fixed software refresh compilation issues on Windows. Inactive MVD channels are now completely destroyed and recreated once they are active again, and they are no longer allowed to stay in waiting state forever. Fixed delay buffer overflow resulting in fatal connection error. Preserve MVD stream flags in demos recorded on GTV server, and handle `inuse' flag correctly on players when writing gamestate. Updated documentation and Debian package descriptions.
2008-10-30Added ICMP error queue support on Linux.Andrey Nazarov
Client no longer drops connection immediately after an ICMP error is received, but waits some time for valid packets from server. Fixed FreeBSD build.
2008-10-26Removed `net_tcp_clientip', always bind to `net_ip' for outgoing TCPAndrey Nazarov
connections to avoid problems with AC or MVD/GTV auth on multi IP systems.
2008-10-18Renamed `gtv.h' to `mvd_gtv.h'.Andrey Nazarov
A few fixes here and there.
2008-10-14Added `sv_mvd_bufsize', `sv_mvd_disconnect_time', `sv_mvd_suspend_time' cvars.Andrey Nazarov
MVD dummy no longer attempts to reopen the scoreboard while suspended. Extended maximum MVD/GTV client message size to 256 bytes. Don't break message order client expects in parse_stream_start(). Support maxclients value change between MVD gamestates. Added `mvd_suspend_time', `mvd_username', `mvd_password' cvars. Fixed MVD client retry backoff time.
2008-10-12Removed `mvd_chase_msgs' cvar, corresponding flag is now stored in MVD stream.Andrey Nazarov
Do not initialize MVD server in active state, check for players instead. Allow MVD/GTV client dynamically change `maxbuf' setting. Changed MVD/GTV stream suspend semantics. Fixed possible server crash due to an error in NET_Accept. Updated documentation.
2008-10-11Oops, fixed NET_RunConnect() broken on Win32.Andrey Nazarov
2008-10-11Major redesign of GTV protocol: added support for persistent GTV connections,Andrey Nazarov
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.
2008-10-03Consolidated all MVD server code in a single file for easier portability.Andrey Nazarov
Perform more strict configstring length checks server side. No longer stop reading packets in a loop after an ICMP error.
2008-09-26Fixed Win32 build.Andrey Nazarov
2008-09-26Removed useless `net_tcp_clientport' cvar.Andrey Nazarov
Server no longer honours `port' cvar, `net_port' should be used instead. Server no longer searches for a free port and fails to start after the first unsuccessful attempt. Added documentation of the network stuff. Do not optimize `oldorigin' stuff on player entities for non-Q2PRO clients. Only active MVD channels are now listed in the menu.
2008-09-24Com_sprintf -> Q_snprintf, Q_strncpyz -> Q_strlcpy, Q_strcat -> Q_strlcat.Andrey Nazarov
Q_vsnprintf, Q_sprintf, Q_concat, Q_strlcpy, Q_strcat all return number of characters to be written into the buffer regardless of overflow. Removed COM_AppendExtension, FS_CopyFile, FS_RemoveFile, FS_CopyFile_f. Made sure Q2PRO can only write files into subdirectories of the game directory with a fixed extension. Moved `play' command implementation into main client code. Added support for `s_ambient' value of 3. Renamed `net_log_active' cvar to `net_log_enable'. Log files are now written into `logs/' subdirectory.
2008-08-30Output number of active players along with number of spectators inAndrey Nazarov
the Channel Chooser menu. Unknown commands from GTV spectators are now handled as chat. It is up to GTV admin to block mod-specific commands which spectators usually have bound to keyboard via `addfiltercmd' facility. Added `sys_parachute' cvar (default 1) which allows one to disable fatal signal handlers on Unix for automatic core dump creation purpose. Build all binaries with debugging symbols included by default.
2008-08-28Added `net_tcp_clientip' cvar, which is used instead of 'net_tcp_ip' forAndrey Nazarov
specifying which network interface is used for outgoing TCP connections.
2008-08-28Added `net_tcp_ip', `net_tcp_port' and `net_tcp_clientport' cvars.Andrey Nazarov
The first two of these mirror `net_ip' and `net_port' cvars by default. Syncronization of cvars is lost once overridden by user from console. In context of `net_ip' cvar `localhost' now means loopback interface address, not any address. Default value of `net_ip' changed to empty string, which means listening on all interfaces. Renamed `net_backlog' into `net_tcp_backlog' for consistency. Do not build useless loopback code into dedicated server binaries.
2008-08-28Removed unimplemented `sv_mvd_wait' cvar.Andrey Nazarov
Bind server TCP socket with SO_REUSEADDR option, close it properly on shutdown. Implemented server console logging over HTTP, accessible at `/console' URI. Added `sv_console_auth' cvar controlling access to server console. Never allow server realtime go back. Spectator chat on GTV is no longer audible. Moved POV name on the very top of the screen.
2008-08-23Changes to `net_ip', `net_port' and `net_clientport' cvars now takeAndrey Nazarov
effect immediately (`net_restart' is no longer required). Console title now properly updates on server port change. Added ability to display ban reason to clients, which should be specified as `comment' argument to `addban' command.
2008-08-16Split some monolithic include files into smaller ones.Andrey Nazarov
Use single BSP models cache for refresh and collision subsystems. Refresh libraries may not longer be dynamically loaded. Made gi.TagMalloc use separate tag namespace to avoid conflicts with engine reserverd tags. Fixed listing order of MVD channels in chooser menu. A lot of misc changes... MSVC build is definitely broken now.
2008-05-18Accept `all' as special argument to `delstuffcmd' command.Andrey Nazarov
Cleaned up Cvar_Get and fixed semantic bug. Accept `background keyword in menu scripts. Renamed `gl_fastsky' to `gl_drawsky'. If at least one of the sky env maps fails lo load, disable entire sky drawing. Reworked loading screen. Fixed Com_Quit argument string handling. Catch more signals on *nix. Updated server docs.
2008-05-08Removed hardcoded menus in favor of scriptable ones.Andrey Nazarov
Made UI module part of the client, removed all glue. Added `pushmenu', `popmenu', 'forcemenuoff' commands. Detect gzipped files by contents, not by *.gz extension (TODO).
2008-04-02Use size_t instead of int where possible.Andrey Nazarov
Added initial support for Win64 port.
2008-03-30Added UF_MUTE_MISC flag and corresponding MVD menu entry.Andrey Nazarov
Avoid spamming MVD channels with broadcasts when client is dropped. Allow referencing MVD channels by name along with numeric ID. When spectator enters a MVD channel for the first time, start following the most followed player by default. Changed default GL driver to `libGL.so.1' on Unix.
2008-03-25Report ICMP errors as developer print.Andrey Nazarov
Fixed `mvdrecord' crash when issued on MVD client.
2008-03-24Remove useless time wraparound checks.Andrey Nazarov
Apply more careful input sanitizing in several places (issues revealed by zzuf(1)). Remove stereo *.wav loading stuff, Q2 has never supported it properly. Fixed a memory leak in Image_LoadPCX. Mark clients after receiving ICMP errors from them, drop after `sv_ghostime' seconds.
2008-03-13Setting `s_ambient' to 2 now disables ambientAndrey Nazarov
sounds from all entities except player's own. Other insignificant changes.
2008-03-07Network code cleanup.Andrey Nazarov
Fixed port endianess bug in MVD_Connect_f.
2008-02-17Huge search and replace commit.Andrey Nazarov
Use fixed size integer types from stdint.h instead of custom defined ones. Get endianess infromation form endian.h. Added `remotemode' console command. Link with -ldl only on Linux.
2008-01-28Added `sv_mvd_capture_flags' variable.Andrey Nazarov
Re-introduced FOV compensation for player gun model. Made `gl_fastsky' actually work. Added support for following powerup carriers in MVD_Follow_f.