Trying to make QTV more robust with connecting to remote sources.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2199 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2006-04-14 00:59:29 +00:00
parent 95a623820f
commit ebac90e94b
3 changed files with 6 additions and 3 deletions

View file

@ -47,6 +47,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define qerrno WSAGetLastError() #define qerrno WSAGetLastError()
#define EWOULDBLOCK WSAEWOULDBLOCK #define EWOULDBLOCK WSAEWOULDBLOCK
#define EINPROGRESS WSAEINPROGRESS #define EINPROGRESS WSAEINPROGRESS
#define ENOTCONN WSAENOTCONN
#ifdef _MSC_VER #ifdef _MSC_VER
//okay, so warnings are here to help... they're ugly though. //okay, so warnings are here to help... they're ugly though.

View file

@ -1147,7 +1147,7 @@ void UpdateStats(sv_t *qtv, viewer_t *v)
if (qtv && qtv->controller == v) if (qtv && qtv->controller == v)
stats = qtv->players[qtv->thisplayer].stats; stats = qtv->players[qtv->thisplayer].stats;
else if (v->trackplayer < 0 || !qtv) else if (v->trackplayer != -1 || !qtv)
stats = nullstats; stats = nullstats;
else else
stats = qtv->players[v->trackplayer].stats; stats = qtv->players[v->trackplayer].stats;

View file

@ -244,7 +244,7 @@ qboolean Net_ConnectToTCPServer(sv_t *qtv, char *ip)
if (connect(qtv->sourcesock, (struct sockaddr *)&qtv->serveraddress, sizeof(qtv->serveraddress)) == INVALID_SOCKET) if (connect(qtv->sourcesock, (struct sockaddr *)&qtv->serveraddress, sizeof(qtv->serveraddress)) == INVALID_SOCKET)
{ {
if (qerrno != EINPROGRESS) if (qerrno != EINPROGRESS && qerrno != EWOULDBLOCK) //bsd sockets are meant to return EINPROGRESS, but some winsock drivers use EWOULDBLOCK instead. *sigh*...
{ {
closesocket(qtv->sourcesock); closesocket(qtv->sourcesock);
qtv->sourcesock = INVALID_SOCKET; qtv->sourcesock = INVALID_SOCKET;
@ -707,6 +707,7 @@ qboolean Net_ReadStream(sv_t *qtv)
int maxreadable; int maxreadable;
int read; int read;
char *buffer; char *buffer;
int err;
maxreadable = MAX_PROXY_BUFFER - qtv->buffersize; maxreadable = MAX_PROXY_BUFFER - qtv->buffersize;
if (!maxreadable) if (!maxreadable)
@ -733,7 +734,8 @@ qboolean Net_ReadStream(sv_t *qtv)
} }
else else
{ {
if (read == 0 || qerrno != EWOULDBLOCK) err = qerrno;
if (read == 0 || (err != EWOULDBLOCK && err != ENOTCONN)) //ENOTCONN can be returned whilst waiting for a connect to finish.
{ {
if (qtv->sourcesock != INVALID_SOCKET) if (qtv->sourcesock != INVALID_SOCKET)
{ {