Changes for MacOS. Can be compiled, but there are still some issues.

This commit is contained in:
lotodore
2007-11-24 14:04:18 +00:00
parent f935b41ed8
commit 1b53a64fbb
8 changed files with 66 additions and 18 deletions
+3 -1
View File
@@ -2,7 +2,9 @@
/* include/config.h.in. Generated from configure.in by autoheader. */
/* Define to 1 if you have the `gethostbyname_r' function. */
#define HAVE_GETHOSTBYNAME_R 1
#ifndef __APPLE__
#define HAVE_GETHOSTBYNAME_R 1
#endif
/* Define to 1 if you have the `inet_ntoa' function. */
#define HAVE_INET_NTOA 1
+6 -1
View File
@@ -82,10 +82,15 @@ ClientStateInit::Process(ClientThread &client)
if (IOCTLSOCKET(context.GetSocket(), FIONBIO, &mode) == SOCKET_ERROR)
throw ClientException(__FILE__, __LINE__, ERR_SOCK_CREATION_FAILED, SOCKET_ERRNO());
// The following call is optional - the return value is not checked.
// The following calls are optional - the return value is not checked.
int nodelay = 1;
setsockopt(context.GetSocket(), SOL_SOCKET, TCP_NODELAY, (char *)&nodelay, sizeof(nodelay));
#ifdef SO_NOSIGPIPE
int nosigpipe = 1;
setsockopt(context.GetSocket(), SOL_SOCKET, SO_NOSIGPIPE, (char *)&nosigpipe, sizeof(nosigpipe));
#endif
client.SetState(ClientStateStartResolve::Instance());
return MSG_SOCK_INIT_DONE;
+6 -1
View File
@@ -182,11 +182,16 @@ ServerAcceptThread::AcceptLoop()
{
throw ServerException(__FILE__, __LINE__, ERR_SOCK_CREATION_FAILED, SOCKET_ERRNO());
}
// Optional call - don't check return value.
// Optional calls - don't check return value.
// Enable keepalive - won't be of much use but better than nothing.
int keepalive = 1;
setsockopt(tmpData->GetSocket(), SOL_SOCKET, SO_KEEPALIVE, (char *)&keepalive, sizeof(keepalive));
#ifdef SO_NOSIGPIPE
int nosigpipe = 1;
setsockopt(tmpData->GetSocket(), SOL_SOCKET, SO_NOSIGPIPE, (char *)&nosigpipe, sizeof(nosigpipe));
#endif
GetLobbyThread().AddConnection(tmpData);
}
}
+5 -1
View File
@@ -62,7 +62,11 @@ typedef unsigned char u_char;
#define IOCTLSOCKET ioctl
#define SOCKET_ERR_NOTCONN ENOTCONN
#define SOCKET_ERR_NOTSOCK ENOTSOCK
#define SOCKET_SEND_FLAGS MSG_NOSIGNAL
#ifdef __APPLE__
#define SOCKET_SEND_FLAGS 0
#else
#define SOCKET_SEND_FLAGS MSG_NOSIGNAL
#endif
#define IS_SOCKET_ERR_WOULDBLOCK(_e) ((_e) == EINPROGRESS || (_e) == EAGAIN)