#include "points.h"
#include "feedback.h"
#include "mainframe.h"
-
-
-#ifdef WIN32
-//#include <winsock2.h>
-#endif
-
-#if defined (__linux__) || defined (__APPLE__)
-#include <sys/time.h>
-#define SOCKET_ERROR -1
-#endif
-
-#ifdef __APPLE__
-#include <unistd.h>
-#endif
-
+#include "sockets.h"
void message_flush(message_info_t* self)
{
}
-#include "l_net/l_net.h"
#include <glib/gtimer.h>
#include <glib/garray.h>
#include "xmlstuff.h"
{
g_pWatchBSP = new CWatchBSP();
- g_WatchBSP_Enabled = !string_empty(g_pGameDescription->getKeyValue("no_bsp_monitor"));
+ g_WatchBSP_Enabled = !string_equal(g_pGameDescription->getKeyValue("no_bsp_monitor"), "1");
GlobalPreferenceSystem().registerPreference("WatchBSP", BoolImportStringCaller(g_WatchBSP_Enabled), BoolExportStringCaller(g_WatchBSP_Enabled));
GlobalPreferenceSystem().registerPreference("RunQuake2Run", BoolImportStringCaller(g_WatchBSP_RunQuake), BoolExportStringCaller(g_WatchBSP_RunQuake));
#if defined(WIN32)
#define ENGINE_ATTRIBUTE "engine_win32"
#define MP_ENGINE_ATTRIBUTE "mp_engine_win32"
-#elif defined(__linux__)
+#elif defined(__linux__) || defined (__FreeBSD__)
#define ENGINE_ATTRIBUTE "engine_linux"
#define MP_ENGINE_ATTRIBUTE "mp_engine_linux"
#elif defined(__APPLE__)
#define ENGINE_ATTRIBUTE "engine_macos"
#define MP_ENGINE_ATTRIBUTE "mp_engine_macos"
#else
-#error "unknown platform"
+#error "unsupported platform"
#endif
class RunEngineConfiguration
}
-#ifdef WIN32
-#include <windows.h>
-#endif
-
void CWatchBSP::RoutineProcessing()
{
- // used for select()
-#ifdef WIN32
- TIMEVAL tout = { 0, 0 };
-#endif
-#if defined (__linux__) || defined (__APPLE__)
- timeval tout;
- tout.tv_sec = 0;
- tout.tv_usec = 0;
-#endif
-
switch (m_eState)
{
case EBeginStep:
}
break;
case EWatching:
+ {
#ifdef _DEBUG
// some debug checks
if (!m_pInSocket)
return;
}
#endif
- // select() will identify if the socket needs an update
- // if the socket is identified that means there's either a message or the connection has been closed/reset/terminated
- fd_set readfds;
- int ret;
- FD_ZERO(&readfds);
- FD_SET(((unsigned int)m_pInSocket->socket), &readfds);
- // from select man page:
- // n is the highest-numbered descriptor in any of the three sets, plus 1
- // (no use on windows)
- ret = select( m_pInSocket->socket + 1, &readfds, NULL, NULL, &tout );
- if (ret == SOCKET_ERROR)
- {
- globalOutputStream() << "WARNING: SOCKET_ERROR in CWatchBSP::RoutineProcessing\n";
- globalOutputStream() << "Terminating the connection.\n";
- EndMonitoringLoop();
- return;
- }
-#ifdef _DEBUG
+
+ int ret = Net_Wait(m_pInSocket, 0, 0);
if (ret == -1)
{
- // we are non-blocking?? we should never get timeout errors
- globalOutputStream() << "WARNING: unexpected timeout expired in CWatchBSP::Processing\n";
+ globalOutputStream() << "WARNING: SOCKET_ERROR in CWatchBSP::RoutineProcessing\n";
globalOutputStream() << "Terminating the connection.\n";
EndMonitoringLoop();
return;
}
-#endif
+
if (ret == 1)
{
// the socket has been identified, there's something (message or disconnection)
}
}
}
+ }
break;
default:
break;