aboutsummaryrefslogtreecommitdiff
path: root/src/util.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/util.cpp')
-rw-r--r--src/util.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/util.cpp b/src/util.cpp
index a7ec740de8..8192a7c71c 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -280,10 +280,13 @@ int LogPrintStr(const std::string &str)
{
int ret = 0; // Returns total number of characters written
static bool fStartedNewLine = true;
+
+ string strTimestamped = LogTimestampStr(str, &fStartedNewLine);
+
if (fPrintToConsole)
{
// print to console
- ret = fwrite(str.data(), 1, str.size(), stdout);
+ ret = fwrite(strTimestamped.data(), 1, strTimestamped.size(), stdout);
fflush(stdout);
}
else if (fPrintToDebugLog)
@@ -291,8 +294,6 @@ int LogPrintStr(const std::string &str)
boost::call_once(&DebugPrintInit, debugPrintInitFlag);
boost::mutex::scoped_lock scoped_lock(*mutexDebugLog);
- string strTimestamped = LogTimestampStr(str, &fStartedNewLine);
-
// buffer if we haven't opened the log yet
if (fileout == NULL) {
assert(vMsgsBeforeOpenLog);
@@ -794,6 +795,18 @@ void SetupEnvironment()
boost::filesystem::path::imbue(loc);
}
+bool SetupNetworking()
+{
+#ifdef WIN32
+ // Initialize Windows Sockets
+ WSADATA wsadata;
+ int ret = WSAStartup(MAKEWORD(2,2), &wsadata);
+ if (ret != NO_ERROR || LOBYTE(wsadata.wVersion ) != 2 || HIBYTE(wsadata.wVersion) != 2)
+ return false;
+#endif
+ return true;
+}
+
void SetThreadPriority(int nPriority)
{
#ifdef WIN32