Fix from Spike. Increase some buffer sizes to solve the "invalid mvd length" messages. FTEQTV still loses connection at mapchange on certain versions of MVDSV.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2784 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Molgrum 2007-11-15 21:19:52 +00:00
parent bc19d31dc3
commit 868c81db4f
5 changed files with 28 additions and 22 deletions

View file

@ -794,7 +794,7 @@ qboolean SV_ReadPendingProxy(cluster_t *cluster, oproxy_t *pend)
//start up a new stream
//FIXME: does this work?
#if 1 //left disabled until properly tested
#if 0 //left disabled until properly tested
qtv = QTV_NewServerConnection(cluster, "reverse"/*server*/, "", true, 2, false, 0);
Net_ProxySendString(cluster, pend, QTVSVHEADER);

View file

@ -13,7 +13,7 @@
#define MAX_LIGHTSTYLES 64
#define MAX_PROXY_INBUFFER 4096
#define MAX_PROXY_BUFFER (1<<14) //must be power-of-two
#define MAX_PROXY_BUFFER (1<<17) //must be power-of-two
#define PREFERED_PROXY_BUFFER 4096 //the ammount of data we try to leave in our input buffer (must be large enough to contain any single mvd frame)
#define ENTS_PER_FRAME 64 //max number of entities per frame (OUCH!).
@ -56,10 +56,11 @@
//limits
#define NQ_PACKETS_PER_SECOND 20
#define MAX_NQMSGLEN 8000
#define MAX_MSGLEN 1450
#define MAX_NQDATAGRAM 1024
#define MAX_BACKBUF_SIZE 1000 //this is smaller so we don't loose entities when lagging
#define MAX_MSGLEN 8000 //the biggest we can possibly allow
#define MAX_NQMSGLEN 8000 //nq has large reliable packets for the connection data
#define MAX_QWMSGLEN 1450 //qw is fully split into individual packets
#define MAX_NQDATAGRAM 1024 //nq datagrams are only 1k
#define MAX_BACKBUF_SIZE 1000 //this is smaller so we don't loose too many entities when lagging
//NQ transport layer defines

View file

@ -216,14 +216,17 @@ typedef struct {
unsigned int last_received;
unsigned int cleartime;
int maxdatagramlen;
int maxreliablelen;
int reliable_length;
qboolean drop;
qboolean isclient;
qboolean isnqprotocol;
netmsg_t message;
char message_buf[MAX_NQMSGLEN]; //reliable message being built
char reliable_buf[MAX_NQMSGLEN]; //reliable message that we're making sure arrives.
char message_buf[MAX_MSGLEN]; //reliable message being built
char reliable_buf[MAX_MSGLEN]; //reliable message that we're making sure arrives.
float rate;

View file

@ -367,12 +367,9 @@ void QW_ClearViewerState(viewer_t *viewer)
void SendServerData(sv_t *tv, viewer_t *viewer)
{
netmsg_t msg;
char buffer[MAX_NQMSGLEN];
char buffer[MAX_MSGLEN];
if (viewer->netchan.isnqprotocol)
InitNetMsg(&msg, buffer, sizeof(buffer));
else
InitNetMsg(&msg, buffer,1024);
InitNetMsg(&msg, buffer, viewer->netchan.maxreliablelen);
if (tv && (tv->controller == viewer || !tv->controller))
viewer->thisplayer = tv->thisplayer;
@ -887,6 +884,8 @@ void NewNQClient(cluster_t *cluster, netadr_t *addr)
Netchan_Setup (cluster->qwdsocket, &viewer->netchan, *addr, 0, false);
viewer->netchan.isnqprotocol = true;
viewer->netchan.maxdatagramlen = MAX_NQDATAGRAM;
viewer->netchan.maxreliablelen = MAX_NQMSGLEN;
viewer->next = cluster->viewers;
cluster->viewers = viewer;
@ -950,7 +949,9 @@ void NewQWClient(cluster_t *cluster, netadr_t *addr, char *connectmessage)
memset(viewer, 0, sizeof(viewer_t));
Netchan_Setup (cluster->qwdsocket, &viewer->netchan, *addr, atoi(qport), false);
viewer->netchan.message.maxsize = MAX_MSGLEN;
viewer->netchan.message.maxsize = MAX_QWMSGLEN;
viewer->netchan.maxdatagramlen = MAX_QWMSGLEN;
viewer->netchan.maxreliablelen = MAX_QWMSGLEN;
viewer->next = cluster->viewers;
cluster->viewers = viewer;
@ -1171,7 +1172,7 @@ void QTV_Status(cluster_t *cluster, netadr_t *from)
void ConnectionlessPacket(cluster_t *cluster, netadr_t *from, netmsg_t *m)
{
char buffer[MAX_MSGLEN];
char buffer[MAX_QWMSGLEN];
int i;
ReadLong(m);
@ -4502,7 +4503,7 @@ void QW_FreeViewer(cluster_t *cluster, viewer_t *viewer)
void SendViewerPackets(cluster_t *cluster, viewer_t *v)
{
char buffer[MAX_MSGLEN*2];
char buffer[MAX_MSGLEN];
netmsg_t m;
int read;
sv_t *useserver;
@ -4542,7 +4543,7 @@ void SendViewerPackets(cluster_t *cluster, viewer_t *v)
}
v->maysend = false;
InitNetMsg(&m, buffer, MAX_MSGLEN);
InitNetMsg(&m, buffer, v->netchan.maxdatagramlen);
m.cursize = 0;
if (v->thinksitsconnected)
{
@ -4595,7 +4596,7 @@ void SendViewerPackets(cluster_t *cluster, viewer_t *v)
}
void QW_UpdateUDPStuff(cluster_t *cluster)
{
char buffer[MAX_MSGLEN*2];
char buffer[MAX_MSGLEN]; //contains read info
char tempbuffer[256];
netadr_t from;
int fromsize = sizeof(from);
@ -4620,7 +4621,8 @@ void QW_UpdateUDPStuff(cluster_t *cluster)
cluster->mastersendtime = cluster->curtime + 3*1000*60; //3 minuites.
}
InitNetMsg(&m, buffer, MAX_MSGLEN);
/* initialised for reading */
InitNetMsg(&m, buffer, sizeof(buffer));
for (;;)
{

View file

@ -267,8 +267,8 @@ void Net_SendQTVConnectionRequest(sv_t *qtv, char *authmethod, char *challenge)
//due to mvdsv sucking and stuff, we try using raw connections where possibleso that we don't end up expecting a header.
//at some point, this will be forced to 1
qtv->parsingqtvheader = true;//!!*qtv->connectpassword;
qtv->buffersize = 0;
qtv->forwardpoint = 0;
str = "QTV\n"; Net_QueueUpstream(qtv, strlen(str), str);
str = "VERSION: 1\n"; Net_QueueUpstream(qtv, strlen(str), str);
@ -731,7 +731,7 @@ int SV_EarlyParse(sv_t *qtv, unsigned char *buffer, int remaining)
length = (buffer[lengthofs]<<0) + (buffer[lengthofs+1]<<8) + (buffer[lengthofs+2]<<16) + (buffer[lengthofs+3]<<24);
length += lengthofs+4;
if (length > 1500)
if (length > MAX_MSGLEN)
printf("Probably corrupt mvd (length %i)\n", length);
}
else