diff options
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/core/core.cpp | 47 | ||||
-rw-r--r-- | src/network/core/os_abstraction.h | 41 | ||||
-rw-r--r-- | src/network/core/tcp.cpp | 4 | ||||
-rw-r--r-- | src/network/core/tcp_http.cpp | 4 | ||||
-rw-r--r-- | src/network/core/tcp_listen.h | 4 |
5 files changed, 3 insertions, 97 deletions
diff --git a/src/network/core/core.cpp b/src/network/core/core.cpp index c8db860dd..e5f1df721 100644 --- a/src/network/core/core.cpp +++ b/src/network/core/core.cpp @@ -21,48 +21,12 @@ #include "../../safeguards.h" -#ifdef __MORPHOS__ -/* the library base is required here */ -struct Library *SocketBase = NULL; -#endif - /** * Initializes the network core (as that is needed for some platforms * @return true if the core has been initialized, false otherwise */ bool NetworkCoreInitialize() { -#if defined(__MORPHOS__) || defined(__AMIGA__) - /* - * IMPORTANT NOTE: SocketBase needs to be initialized before we use _any_ - * network related function, else: crash. - */ - DEBUG(net, 3, "[core] loading bsd socket library"); - SocketBase = OpenLibrary("bsdsocket.library", 4); - if (SocketBase == NULL) { - DEBUG(net, 0, "[core] can't open bsdsocket.library version 4, network unavailable"); - return false; - } - -#if defined(__AMIGA__) - /* for usleep() implementation (only required for legacy AmigaOS builds) */ - TimerPort = CreateMsgPort(); - if (TimerPort != NULL) { - TimerRequest = (struct timerequest*)CreateIORequest(TimerPort, sizeof(struct timerequest); - if (TimerRequest != NULL) { - if (OpenDevice("timer.device", UNIT_MICROHZ, (struct IORequest*)TimerRequest, 0) == 0) { - TimerBase = TimerRequest->tr_node.io_Device; - if (TimerBase == NULL) { - /* free resources... */ - DEBUG(net, 0, "[core] can't initialize timer, network unavailable"); - return false; - } - } - } - } -#endif /* __AMIGA__ */ -#endif /* __MORPHOS__ / __AMIGA__ */ - /* Let's load the network in windows */ #ifdef _WIN32 { @@ -83,17 +47,6 @@ bool NetworkCoreInitialize() */ void NetworkCoreShutdown() { -#if defined(__MORPHOS__) || defined(__AMIGA__) - /* free allocated resources */ -#if defined(__AMIGA__) - if (TimerBase != NULL) CloseDevice((struct IORequest*)TimerRequest); // XXX This smells wrong - if (TimerRequest != NULL) DeleteIORequest(TimerRequest); - if (TimerPort != NULL) DeleteMsgPort(TimerPort); -#endif - - if (SocketBase != NULL) CloseLibrary(SocketBase); -#endif - #if defined(_WIN32) WSACleanup(); #endif diff --git a/src/network/core/os_abstraction.h b/src/network/core/os_abstraction.h index 32c6cffff..187e2584c 100644 --- a/src/network/core/os_abstraction.h +++ b/src/network/core/os_abstraction.h @@ -48,13 +48,11 @@ typedef unsigned long in_addr_t; # endif # define SOCKET int # define INVALID_SOCKET -1 -# if !defined(__MORPHOS__) && !defined(__AMIGA__) -# define ioctlsocket ioctl +# define ioctlsocket ioctl # if !defined(BEOS_NET_SERVER) # define closesocket close # endif -# define GET_LAST_ERROR() (errno) -# endif +# define GET_LAST_ERROR() (errno) /* Need this for FIONREAD on solaris */ # define BSD_COMP @@ -74,7 +72,7 @@ typedef unsigned long in_addr_t; # include <arpa/inet.h> # include <net/if.h> /* According to glibc/NEWS, <ifaddrs.h> appeared in glibc-2.3. */ -# if !defined(__sgi__) && !defined(SUNOS) && !defined(__MORPHOS__) && !defined(__BEOS__) && !defined(__HAIKU__) && !defined(__INNOTEK_LIBC__) \ +# if !defined(__sgi__) && !defined(SUNOS) && !defined(__BEOS__) && !defined(__HAIKU__) && !defined(__INNOTEK_LIBC__) \ && !(defined(__GLIBC__) && (__GLIBC__ <= 2) && (__GLIBC_MINOR__ <= 2)) && !defined(__dietlibc__) && !defined(HPUX) /* If for any reason ifaddrs.h does not exist on your system, comment out * the following two lines and an alternative way will be used to fetch @@ -164,39 +162,6 @@ typedef unsigned long in_addr_t; #endif /* OS/2 */ -/* MorphOS and Amiga stuff */ -#if defined(__MORPHOS__) || defined(__AMIGA__) -# include <exec/types.h> -# include <proto/exec.h> /* required for Open/CloseLibrary() */ - /* MorphOS defines his network functions with UBYTE arrays while we - * use char arrays. This gives tons of unneeded warnings */ -# define UBYTE char -# if defined(__MORPHOS__) -# include <sys/filio.h> /* FIO* defines */ -# include <sys/sockio.h> /* SIO* defines */ -# include <netinet/in.h> -# else /* __AMIGA__ */ -# include <proto/socket.h> -# endif - -/* Make the names compatible */ -# define closesocket(s) CloseSocket(s) -# define GET_LAST_ERROR() Errno() -# define ioctlsocket(s, request, status) IoctlSocket((LONG)s, (ULONG)request, (char*)status) -# define ioctl ioctlsocket - - typedef unsigned int in_addr_t; - typedef long socklen_t; - extern struct Library *SocketBase; - -# ifdef __AMIGA__ - /* for usleep() implementation */ - extern struct Device *TimerBase; - extern struct MsgPort *TimerPort; - extern struct timerequest *TimerRequest; -# endif -#endif /* __MORPHOS__ || __AMIGA__ */ - /** * Try to set the socket into non-blocking mode. * @param d The socket to set the non-blocking more for. diff --git a/src/network/core/tcp.cpp b/src/network/core/tcp.cpp index 790941fc0..a2f789c09 100644 --- a/src/network/core/tcp.cpp +++ b/src/network/core/tcp.cpp @@ -238,11 +238,7 @@ bool NetworkTCPSocketHandler::CanSendReceive() FD_SET(this->sock, &write_fd); tv.tv_sec = tv.tv_usec = 0; // don't block at all. -#if !defined(__MORPHOS__) && !defined(__AMIGA__) if (select(FD_SETSIZE, &read_fd, &write_fd, NULL, &tv) < 0) return false; -#else - if (WaitSelect(FD_SETSIZE, &read_fd, &write_fd, NULL, &tv, NULL) < 0) return false; -#endif this->writable = !!FD_ISSET(this->sock, &write_fd); return FD_ISSET(this->sock, &read_fd) != 0; diff --git a/src/network/core/tcp_http.cpp b/src/network/core/tcp_http.cpp index aec198bf5..4cd92e5fe 100644 --- a/src/network/core/tcp_http.cpp +++ b/src/network/core/tcp_http.cpp @@ -310,11 +310,7 @@ int NetworkHTTPSocketHandler::Receive() } tv.tv_sec = tv.tv_usec = 0; // don't block at all. -#if !defined(__MORPHOS__) && !defined(__AMIGA__) int n = select(FD_SETSIZE, &read_fd, NULL, NULL, &tv); -#else - int n = WaitSelect(FD_SETSIZE, &read_fd, NULL, NULL, &tv, NULL); -#endif if (n == -1) return; for (NetworkHTTPSocketHandler **iter = _http_connections.Begin(); iter < _http_connections.End(); /* nothing */) { diff --git a/src/network/core/tcp_listen.h b/src/network/core/tcp_listen.h index e6b589332..8cd8257b2 100644 --- a/src/network/core/tcp_listen.h +++ b/src/network/core/tcp_listen.h @@ -118,11 +118,7 @@ public: } tv.tv_sec = tv.tv_usec = 0; // don't block at all. -#if !defined(__MORPHOS__) && !defined(__AMIGA__) if (select(FD_SETSIZE, &read_fd, &write_fd, NULL, &tv) < 0) return false; -#else - if (WaitSelect(FD_SETSIZE, &read_fd, &write_fd, NULL, &tv, NULL) < 0) return false; -#endif /* accept clients.. */ for (SocketList::iterator s = sockets.Begin(); s != sockets.End(); s++) { |