1
0
Fork 0
forked from fte/fteqw

Fixed a couple of rerouting issues,

Warning: RAW mode is not requested, this will break compatability with the origional qtv protocol, including with mvdsv.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2435 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2006-10-27 13:41:27 +00:00
parent b26e4c51f7
commit bce372f236
2 changed files with 41 additions and 4 deletions

View file

@ -266,6 +266,9 @@ void Net_SendConnectionMVD(sv_t *qtv, oproxy_t *prox)
netmsg_t msg;
int prespawn;
if (!*qtv->mapname)
return;
InitNetMsg(&msg, buffer, sizeof(buffer));
prox->flushing = false;
@ -1068,6 +1071,10 @@ qboolean SV_ReadPendingProxy(cluster_t *cluster, oproxy_t *pend)
Net_ProxySend(cluster, pend, s, strlen(s));
pend->flushing = true;
}
else if (!strcmp(s, "AUTH"))
{ //lists the demos available on this proxy
//part of the connection process, can be ignored if there's no password
}
else
printf("Unrecognised token in QTV connection request (%s)\n", s);
}

View file

@ -247,19 +247,41 @@ SOCKET Net_MVDListen(int port)
return sock;
}
char *strchrrev(char *str, char chr)
{
char *firstchar = str;
for (str = str + strlen(str)-1; str>=firstchar; str--)
if (*str == chr)
return str;
return NULL;
}
void Net_SendQTVConnectionRequest(sv_t *qtv, char *authmethod, char *challenge)
{
char *at;
char *str;
char hash[512];
//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 = !!*qtv->connectpassword;
qtv->parsingqtvheader = true;//!!*qtv->connectpassword;
str = "QTV\n"; Net_QueueUpstream(qtv, strlen(str), str);
str = "VERSION: 1\n"; Net_QueueUpstream(qtv, strlen(str), str);
at = strchrrev(qtv->server, '@');
if (at)
{
*at = '\0';
str = "SOURCE: "; Net_QueueUpstream(qtv, strlen(str), str);
str = qtv->server; Net_QueueUpstream(qtv, strlen(str), str);
str = "\n"; Net_QueueUpstream(qtv, strlen(str), str);
*at = '@';
}
if (!qtv->parsingqtvheader)
{
str = "RAW: 1\n"; Net_QueueUpstream(qtv, strlen(str), str);
@ -408,6 +430,9 @@ qboolean Net_ConnectToUDPServer(sv_t *qtv, char *ip)
qboolean Net_ConnectToServer(sv_t *qtv, char *ip)
{
char *at;
qboolean status;
qtv->usequkeworldprotocols = false;
if (!strncmp(ip, "file:", 5) || !strncmp(ip, "demo:", 5))
@ -427,18 +452,23 @@ qboolean Net_ConnectToServer(sv_t *qtv, char *ip)
qtv->nextconnectattempt = qtv->curtime + RECONNECT_TIME; //wait half a minuite before trying to reconnect
at = strchrrev(ip, '@');
if (at)
ip = at+1;
if (!strncmp(ip, "udp:", 4))
{
qtv->usequkeworldprotocols = true;
return Net_ConnectToUDPServer(qtv, ip);
status = Net_ConnectToUDPServer(qtv, ip);
}
else if (!strncmp(ip, "tcp:", 4))
return Net_ConnectToTCPServer(qtv, ip);
status = Net_ConnectToTCPServer(qtv, ip);
else
{
Sys_Printf(qtv->cluster, "Unknown source type %s\n", ip);
return false;
status = false;
}
return status;
}
void Net_QueueUpstream(sv_t *qtv, int size, char *buffer)