merged into master

This commit is contained in:
Thomas "elfprince13" Dickerson 2017-01-06 18:27:56 -05:00
commit 878fbdb609
4 changed files with 30 additions and 29 deletions

View file

@ -491,10 +491,11 @@ template<class T> T ReservedSocketList<T>::resolve(NetSocket socketToResolve)
EntryType &entry = mSocketList[socketToResolve.getHandle()]; EntryType &entry = mSocketList[socketToResolve.getHandle()];
return entry.used ? entry.value : -1; return entry.used ? entry.value : -1;
} }
ConnectionNotifyEvent* Net::smConnectionNotify = NULL;
ConnectionAcceptedEvent* Net::smConnectionAccept = NULL; static ConnectionNotifyEvent* smConnectionNotify = NULL;
ConnectionReceiveEvent* Net::smConnectionReceive = NULL; static ConnectionAcceptedEvent* smConnectionAccept = NULL;
PacketReceiveEvent* Net::smPacketReceive = NULL; static ConnectionReceiveEvent* smConnectionReceive = NULL;
static PacketReceiveEvent* smPacketReceive = NULL;
ConnectionNotifyEvent& Net::getConnectionNotifyEvent() ConnectionNotifyEvent& Net::getConnectionNotifyEvent()
{ {

View file

@ -48,7 +48,7 @@ Profiler *gProfiler = NULL;
//#define TORQUE_PROFILER_DEBUG //#define TORQUE_PROFILER_DEBUG
// Machinery to record the stack of node names, as a debugging aid to find // Machinery to record the stack of node names, as a debugging aid to find
// mismatched PROFILE_START and PROFILE_END blocks. We profile from the // mismatched PROFILE_START and PROFILE_END blocks. We profile from the
// beginning to catch profile block errors that occur when torque is starting up. // beginning to catch profile block errors that occur when torque is starting up.
#ifdef TORQUE_PROFILER_DEBUG #ifdef TORQUE_PROFILER_DEBUG
Vector<StringTableEntry> gProfilerNodeStack; Vector<StringTableEntry> gProfilerNodeStack;
@ -191,7 +191,7 @@ Profiler::Profiler()
mCurrentProfilerData->mInvokeCount = 0; mCurrentProfilerData->mInvokeCount = 0;
mCurrentProfilerData->mTotalTime = 0; mCurrentProfilerData->mTotalTime = 0;
mCurrentProfilerData->mSubTime = 0; mCurrentProfilerData->mSubTime = 0;
#ifdef TORQUE_ENABLE_PROFILE_PATH #ifdef TORQUE_ENABLE_PROFILE_PATH
mCurrentProfilerData->mPath = ""; mCurrentProfilerData->mPath = "";
#endif #endif
mRootProfilerData = mCurrentProfilerData; mRootProfilerData = mCurrentProfilerData;
@ -201,7 +201,7 @@ Profiler::Profiler()
mProfileList = NULL; mProfileList = NULL;
mEnabled = TORQUE_PROFILE_AT_ENGINE_START; mEnabled = TORQUE_PROFILE_AT_ENGINE_START;
mNextEnable = TORQUE_PROFILE_AT_ENGINE_START; mNextEnable = TORQUE_PROFILE_AT_ENGINE_START;
mStackDepth = 0; mStackDepth = 0;
gProfiler = this; gProfiler = this;
@ -289,7 +289,7 @@ void Profiler::validate()
if(!wk) if(!wk)
Platform::debugBreak(); Platform::debugBreak();
for(wk = dp->mParent->mChildHash[walk->mNameHash & (ProfilerData::HashTableSize - 1)] ; for(wk = dp->mParent->mChildHash[walk->mNameHash & (ProfilerData::HashTableSize - 1)] ;
wk; wk = wk->mNextHash) wk; wk = wk->mNextHash)
if(wk == dp) if(wk == dp)
break; break;
if(!wk) if(!wk)
@ -352,7 +352,7 @@ void Profiler::hashPush(ProfilerRootData *root)
mStackDepth++; mStackDepth++;
PROFILER_DEBUG_PUSH_NODE(root->mName); PROFILER_DEBUG_PUSH_NODE(root->mName);
AssertFatal(mStackDepth <= mMaxStackDepth, AssertFatal(mStackDepth <= mMaxStackDepth,
"Stack overflow in profiler. You may have mismatched PROFILE_START and PROFILE_ENDs"); "Stack overflow in profiler. You may have mismatched PROFILE_START and PROFILE_ENDs");
if(!mEnabled) if(!mEnabled)
return; return;
@ -364,7 +364,7 @@ void Profiler::hashPush(ProfilerRootData *root)
} }
if(mCurrentProfilerData->mLastSeenProfiler && if(mCurrentProfilerData->mLastSeenProfiler &&
mCurrentProfilerData->mLastSeenProfiler->mRoot == root) mCurrentProfilerData->mLastSeenProfiler->mRoot == root)
nextProfiler = mCurrentProfilerData->mLastSeenProfiler; nextProfiler = mCurrentProfilerData->mLastSeenProfiler;
if(!nextProfiler) if(!nextProfiler)
@ -715,9 +715,9 @@ void Profiler::enableMarker(const char *marker, bool enable)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
DefineEngineFunction( profilerMarkerEnable, void, ( const char* markerName, bool enable ), ( true ), DefineEngineFunction( profilerMarkerEnable, void, ( const char* markerName, bool enable ), ( true ),
"@brief Enable or disable a specific profile.\n\n" "@brief Enable or disable a specific profile.\n\n"
"@param enable Optional paramater to enable or disable the profile.\n" "@param enable Optional paramater to enable or disable the profile.\n"
"@param markerName Name of a specific marker to enable or disable.\n" "@param markerName Name of a specific marker to enable or disable.\n"
"@note Calling this function will first call profilerReset(), clearing all data from profiler. " "@note Calling this function will first call profilerReset(), clearing all data from profiler. "
"All profile markers are enabled by default.\n\n" "All profile markers are enabled by default.\n\n"
@ -767,7 +767,7 @@ DefineEngineFunction( profilerDumpToFile, void, ( const char* fileName ),,
} }
DefineEngineFunction( profilerReset, void, (),, DefineEngineFunction( profilerReset, void, (),,
"@brief Resets the profiler, clearing it of all its data.\n\n" "@brief Resets the profiler, clearing it of all its data.\n\n"
"If the profiler is currently running, it will first be disabled. " "If the profiler is currently running, it will first be disabled. "
"All markers will retain their current enabled/disabled status.\n\n" "All markers will retain their current enabled/disabled status.\n\n"
"@ingroup Debugging" ) "@ingroup Debugging" )

View file

@ -76,8 +76,8 @@ TEST(Net, TCPRequest)
handler.mDataReceived = 0; handler.mDataReceived = 0;
// Hook into the signals. // Hook into the signals.
Net::smConnectionNotify ->notify(&handler, &TcpHandle::notify); Net::smConnectionNotify .notify(&handler, &TcpHandle::notify);
Net::smConnectionReceive->notify(&handler, &TcpHandle::receive); Net::smConnectionReceive.notify(&handler, &TcpHandle::receive);
// Open a TCP connection to garagegames.com // Open a TCP connection to garagegames.com
handler.mSocket = Net::openConnectTo("72.246.107.193:80"); handler.mSocket = Net::openConnectTo("72.246.107.193:80");
@ -85,8 +85,8 @@ TEST(Net, TCPRequest)
while(Process::processEvents() && (Platform::getRealMilliseconds() < limit) ) {} while(Process::processEvents() && (Platform::getRealMilliseconds() < limit) ) {}
// Unhook from the signals. // Unhook from the signals.
Net::smConnectionNotify ->remove(&handler, &TcpHandle::notify); Net::smConnectionNotify .remove(&handler, &TcpHandle::notify);
Net::smConnectionReceive->remove(&handler, &TcpHandle::receive); Net::smConnectionReceive.remove(&handler, &TcpHandle::receive);
EXPECT_GT(handler.mDataReceived, 0) EXPECT_GT(handler.mDataReceived, 0)
<< "Didn't get any data back!"; << "Didn't get any data back!";
@ -139,8 +139,8 @@ struct JournalHandle
mDataReceived = 0; mDataReceived = 0;
// Hook into the signals. // Hook into the signals.
Net::smConnectionNotify ->notify(this, &JournalHandle::notify); Net::smConnectionNotify .notify(this, &JournalHandle::notify);
Net::smConnectionReceive->notify(this, &JournalHandle::receive); Net::smConnectionReceive.notify(this, &JournalHandle::receive);
// Open a TCP connection to garagegames.com // Open a TCP connection to garagegames.com
mSocket = Net::openConnectTo("72.246.107.193:80"); mSocket = Net::openConnectTo("72.246.107.193:80");
@ -149,8 +149,8 @@ struct JournalHandle
while(Process::processEvents()) {} while(Process::processEvents()) {}
// Unhook from the signals. // Unhook from the signals.
Net::smConnectionNotify ->remove(this, &JournalHandle::notify); Net::smConnectionNotify .remove(this, &JournalHandle::notify);
Net::smConnectionReceive->remove(this, &JournalHandle::receive); Net::smConnectionReceive.remove(this, &JournalHandle::receive);
EXPECT_GT(mDataReceived, 0) EXPECT_GT(mDataReceived, 0)
<< "Didn't get any data back!"; << "Didn't get any data back!";

View file

@ -740,9 +740,9 @@ bool Platform::isSubDirectory(const char *pathParent, const char *pathSub)
inline bool isGoodDirectory(dirent* entry) inline bool isGoodDirectory(dirent* entry)
{ {
return (entry->d_type == DT_DIR // is a dir return (entry->d_type == DT_DIR // is a dir
&& dStrcmp(entry->d_name,".") != 0 // not here && dStrcmp(entry->d_name,".") != 0 // not here
&& dStrcmp(entry->d_name,"..") != 0 // not parent && dStrcmp(entry->d_name,"..") != 0 // not parent
&& !Platform::isExcludedDirectory(entry->d_name)); // not excluded && !Platform::isExcludedDirectory(entry->d_name)); // not excluded
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -874,7 +874,7 @@ static bool recurseDumpDirectories(const char *basePath, const char *subPath, Ve
if ( isDir ) if ( isDir )
{ {
if (dStrcmp(d->d_name, ".") == 0 || if (dStrcmp(d->d_name, ".") == 0 ||
dStrcmp(d->d_name, "..") == 0) dStrcmp(d->d_name, "..") == 0)
continue; continue;
if (Platform::isExcludedDirectory(d->d_name)) if (Platform::isExcludedDirectory(d->d_name))
continue; continue;
@ -887,8 +887,8 @@ static bool recurseDumpDirectories(const char *basePath, const char *subPath, Ve
dSprintf(child, 1024, "%s/%s", subPath, d->d_name); dSprintf(child, 1024, "%s/%s", subPath, d->d_name);
if (currentDepth < recurseDepth || recurseDepth == -1 ) if (currentDepth < recurseDepth || recurseDepth == -1 )
recurseDumpDirectories(basePath, child, directoryVector, recurseDumpDirectories(basePath, child, directoryVector,
currentDepth + 1, recurseDepth, currentDepth + 1, recurseDepth,
noBasePath); noBasePath);
} }
else else
{ {
@ -899,8 +899,8 @@ static bool recurseDumpDirectories(const char *basePath, const char *subPath, Ve
dSprintf(child, 1024, "/%s", d->d_name); dSprintf(child, 1024, "/%s", d->d_name);
if (currentDepth < recurseDepth || recurseDepth == -1) if (currentDepth < recurseDepth || recurseDepth == -1)
recurseDumpDirectories(basePath, child, directoryVector, recurseDumpDirectories(basePath, child, directoryVector,
currentDepth + 1, recurseDepth, currentDepth + 1, recurseDepth,
noBasePath); noBasePath);
} }
} }
} }