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);
} }
+3 -2
View File
@@ -31,7 +31,7 @@
#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
@@ -60,11 +60,12 @@ typedef unsigned char u_char;
#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
#define IS_VALID_SOCKET(_s) ((_s) != INVALID_SOCKET) #define IS_VALID_SOCKET(_s) ((_s) != INVALID_SOCKET)