Also disable avatar retrieval on server. Fixed nasty send "wrong return value" (Linux only).

This commit is contained in:
lotodore
2007-10-31 22:33:52 +00:00
parent ec5196c417
commit 3a0fc4a71e
5 changed files with 33 additions and 32 deletions
+1 -1
View File
@@ -248,7 +248,7 @@ ClientStateStartConnect::Process(ClientThread &client)
else else
{ {
int errCode = SOCKET_ERRNO(); int errCode = SOCKET_ERRNO();
if (errCode == SOCKET_ERR_WOULDBLOCK) if (IS_SOCKET_ERR_WOULDBLOCK(errCode))
{ {
boost::timers::portable::microsec_timer connectTimer; boost::timers::portable::microsec_timer connectTimer;
ClientStateConnecting::Instance().SetTimer(connectTimer); ClientStateConnecting::Instance().SetTimer(connectTimer);
+1 -1
View File
@@ -66,7 +66,7 @@ ReceiverHelper::Recv(SOCKET sock, ReceiveBuffer &buf)
if (!IS_VALID_RECV(bytesRecvd)) if (!IS_VALID_RECV(bytesRecvd))
{ {
int errCode = SOCKET_ERRNO(); int errCode = SOCKET_ERRNO();
if (errCode != SOCKET_ERR_WOULDBLOCK) if (!IS_SOCKET_ERR_WOULDBLOCK(errCode))
throw NetException(__FILE__, __LINE__, ERR_SOCK_RECV_FAILED, SOCKET_ERRNO()); throw NetException(__FILE__, __LINE__, ERR_SOCK_RECV_FAILED, SOCKET_ERRNO());
} }
else if (bytesRecvd == 0) else if (bytesRecvd == 0)
+2 -2
View File
@@ -178,7 +178,7 @@ SenderThread::Main()
{ {
// Never assume that this is a fatal error. // Never assume that this is a fatal error.
int errCode = SOCKET_ERRNO(); int errCode = SOCKET_ERRNO();
if (errCode == SOCKET_ERR_WOULDBLOCK) if (IS_SOCKET_ERR_WOULDBLOCK(errCode))
{ {
fd_set writeSet; fd_set writeSet;
struct timeval timeout; struct timeval timeout;
@@ -193,7 +193,7 @@ SenderThread::Main()
{ {
// Never assume that this is a fatal error. // Never assume that this is a fatal error.
int errCode = SOCKET_ERRNO(); int errCode = SOCKET_ERRNO();
if (errCode != SOCKET_ERR_WOULDBLOCK) if (!IS_SOCKET_ERR_WOULDBLOCK(errCode))
{ {
// Skip this packet - this is bad, and is therefore reported. // Skip this packet - this is bad, and is therefore reported.
// Ignore invalid or not connected sockets. // Ignore invalid or not connected sockets.
+3 -3
View File
@@ -387,9 +387,9 @@ ServerLobbyThread::HandleNetPacketInit(SessionWrapper session, const NetPacketIn
m_sessionManager.SetSessionPlayerData(session.sessionData->GetId(), tmpPlayerData); m_sessionManager.SetSessionPlayerData(session.sessionData->GetId(), tmpPlayerData);
session.playerData = tmpPlayerData; session.playerData = tmpPlayerData;
if (initData.showAvatar && !GetAvatarManager().HasAvatar(initData.avatar)) // if (initData.showAvatar && !GetAvatarManager().HasAvatar(initData.avatar))
RequestPlayerAvatar(session); // RequestPlayerAvatar(session);
else // else
EstablishSession(session); EstablishSession(session);
} }
+26 -25
View File
@@ -28,42 +28,43 @@
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
#define CLOSESOCKET closesocket #define CLOSESOCKET closesocket
#define IOCTLSOCKET ioctlsocket #define IOCTLSOCKET ioctlsocket
#define SOCKET_ERRNO() WSAGetLastError() #define SOCKET_ERRNO() WSAGetLastError()
#define SOCKET_ERR_WOULDBLOCK WSAEWOULDBLOCK #define IS_SOCKET_ERR_WOULDBLOCK(_e) ((_e) == WSAEWOULDBLOCK)
#define SOCKET_ERR_NOTCONN WSAENOTCONN #define SOCKET_ERR_NOTCONN WSAENOTCONN
#define SOCKET_ERR_NOTSOCK WSAENOTSOCK #define SOCKET_ERR_NOTSOCK WSAENOTSOCK
#define SOCKET_SEND_FLAGS 0 #define SOCKET_SEND_FLAGS 0
#ifndef IPV6_V6ONLY #ifndef IPV6_V6ONLY
#define IPV6_V6ONLY 27 #define IPV6_V6ONLY 27
#endif #endif
#ifdef __GNUC__ /* mingw provides stdint.h */ #ifdef __GNUC__ /* mingw provides stdint.h */
#include <stdint.h> #include <stdint.h>
typedef uint16_t u_int16_t; typedef uint16_t u_int16_t;
typedef uint32_t u_int32_t; typedef uint32_t u_int32_t;
#else #else
typedef unsigned __int16 u_int16_t; typedef unsigned __int16 u_int16_t;
typedef unsigned __int32 u_int32_t; typedef unsigned __int32 u_int32_t;
typedef __int16 int16_t; typedef __int16 int16_t;
typedef __int32 int32_t; typedef __int32 int32_t;
#endif #endif
typedef unsigned char u_char; typedef unsigned char u_char;
#else #else
#define SOCKET int #define SOCKET int
#define SOCKET_ERROR -1 #define SOCKET_ERROR -1
#define INVALID_SOCKET -1 #define INVALID_SOCKET -1
#define CLOSESOCKET close #define CLOSESOCKET close
#define SOCKET_ERRNO() errno #define SOCKET_ERRNO() errno
#define IOCTLSOCKET ioctl #define IOCTLSOCKET ioctl
#define SOCKET_ERR_WOULDBLOCK EINPROGRESS #define SOCKET_ERR_NOTCONN ENOTCONN
#define SOCKET_ERR_NOTCONN ENOTCONN #define SOCKET_ERR_NOTSOCK ENOTSOCK
#define SOCKET_ERR_NOTSOCK ENOTSOCK #define SOCKET_SEND_FLAGS MSG_NOSIGNAL
#define SOCKET_SEND_FLAGS MSG_NOSIGNAL
#define IS_SOCKET_ERR_WOULDBLOCK(_e) ((_e) == EINPROGRESS || (_e) == EAGAIN)
#endif #endif