Fixed timeout calculation for sleep. Added missing call to socket_startup/socket_cleanup.
This commit is contained in:
+9
-9
@@ -20,15 +20,15 @@
|
|||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
|
|
||||||
// This is ugly, but I can't help it.
|
// This is ugly, but I can't help it.
|
||||||
#define ADD_MSEC_TO_XTIME(__xt, __msec) \
|
inline void ADD_MSEC_TO_XTIME(boost::xtime &xt, unsigned msec)
|
||||||
{ \
|
{
|
||||||
__xt.sec += __msec / 1000; \
|
xt.sec += msec / 1000;
|
||||||
__xt.nsec += (__msec % 1000) * 1000; \
|
xt.nsec += (msec % 1000) * 1000000;
|
||||||
if (__xt.nsec > NANOSECONDS_PER_SECOND) \
|
if (xt.nsec > NANOSECONDS_PER_SECOND)
|
||||||
{ \
|
{
|
||||||
__xt.sec++; \
|
xt.sec++;
|
||||||
__xt.nsec -= NANOSECONDS_PER_SECOND; \
|
xt.nsec -= NANOSECONDS_PER_SECOND;
|
||||||
} \
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+6
-1
@@ -26,6 +26,7 @@
|
|||||||
|
|
||||||
#include "session.h"
|
#include "session.h"
|
||||||
#include "guiwrapper.h"
|
#include "guiwrapper.h"
|
||||||
|
#include <net/socket_startup.h>
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
@@ -36,6 +37,7 @@ class GuiWrapper;
|
|||||||
|
|
||||||
int main( int argc, char **argv )
|
int main( int argc, char **argv )
|
||||||
{
|
{
|
||||||
|
socket_startup();
|
||||||
|
|
||||||
srand( time(0) );
|
srand( time(0) );
|
||||||
|
|
||||||
@@ -50,5 +52,8 @@ int main( int argc, char **argv )
|
|||||||
Session theFirst(myGuiInterface);
|
Session theFirst(myGuiInterface);
|
||||||
myGuiInterface->setSession(&theFirst);
|
myGuiInterface->setSession(&theFirst);
|
||||||
|
|
||||||
return a.exec();
|
int retVal = a.exec();
|
||||||
|
|
||||||
|
socket_cleanup();
|
||||||
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user