Update GameAgent for Linuxport.

This commit is contained in:
Alexander Pavlov 2016-04-07 06:31:08 +03:00 committed by Ryan C. Gordon
parent d6800ca42a
commit 6b9ebc3ccb
2 changed files with 40 additions and 3 deletions

View File

@ -34,6 +34,7 @@ typedef int socklen_t;
#else #else
#include <fcntl.h> #include <fcntl.h>
#include <netdb.h> #include <netdb.h>
#include <pthread.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <arpa/inet.h> #include <arpa/inet.h>
@ -1029,7 +1030,28 @@ extern void GameAgent_EnumUpdate(void)
} }
} else { } else {
#ifndef PLATFORM_WIN32 #ifndef PLATFORM_WIN32
STUBBED("write me"); //STUBBED("write me");
/* MSLegacy LinuxPort */
if(_bActivated) {
pthread_t _hThread;
int _iThreadId;
_iThreadId = pthread_create(&_hThread, NULL, _MS_Thread, NULL);
if (_iThreadId == 0) {
pthread_detach(_hThread);
}
_bActivated = FALSE;
}
if(_bActivatedLocal) {
pthread_t _hThread;
int _iThreadId;
_iThreadId = pthread_create(&_hThread, NULL, _LocalNet_Thread, NULL);
if (_iThreadId == 0) {
pthread_detach(_hThread);
}
_bActivatedLocal = FALSE;
}
#else #else
/* MSLegacy */ /* MSLegacy */
if(_bActivated) { if(_bActivated) {
@ -1068,6 +1090,10 @@ extern void GameAgent_EnumCancel(void)
#ifdef PLATFORM_WIN32 #ifdef PLATFORM_WIN32
DWORD WINAPI _MS_Thread(LPVOID lpParam) { DWORD WINAPI _MS_Thread(LPVOID lpParam) {
#else
void* _MS_Thread(void *arg) {
#endif
SOCKET _sockudp = NULL; SOCKET _sockudp = NULL;
struct _sIPPort { struct _sIPPort {
UBYTE bFirst; UBYTE bFirst;
@ -1266,7 +1292,12 @@ DWORD WINAPI _MS_Thread(LPVOID lpParam) {
return 0; return 0;
} }
#ifdef PLATFORM_WIN32
DWORD WINAPI _LocalNet_Thread(LPVOID lpParam) { DWORD WINAPI _LocalNet_Thread(LPVOID lpParam) {
#else
void* _LocalNet_Thread(void *arg) {
#endif
SOCKET _sockudp = NULL; SOCKET _sockudp = NULL;
struct _sIPPort { struct _sIPPort {
UBYTE bFirst; UBYTE bFirst;
@ -1477,5 +1508,5 @@ DWORD WINAPI _LocalNet_Thread(LPVOID lpParam) {
WSACleanup(); WSACleanup();
return 0; return 0;
} }
#endif

View File

@ -38,10 +38,16 @@ extern void GameAgent_EnumTrigger(BOOL bInternet);
extern void GameAgent_EnumUpdate(void); extern void GameAgent_EnumUpdate(void);
/// Cancel the GameAgent serverlist enumeration. /// Cancel the GameAgent serverlist enumeration.
extern void GameAgent_EnumCancel(void); extern void GameAgent_EnumCancel(void);
///
#ifdef PLATFORM_WIN32
DWORD WINAPI _MS_Thread(LPVOID lpParam); DWORD WINAPI _MS_Thread(LPVOID lpParam);
/// ///
DWORD WINAPI _LocalNet_Thread(LPVOID lpParam); DWORD WINAPI _LocalNet_Thread(LPVOID lpParam);
#else
void* _MS_Thread(void *arg);
///
void* _LocalNet_Thread(void *arg);
#endif
/// Server request structure. Primarily used for getting server pings. /// Server request structure. Primarily used for getting server pings.
class CServerRequest { class CServerRequest {