Modernization + AZStd::function compare fix. (#3680)
* Modernization + small fix. Modernize ( `bool`/`override`/other) code in AzCore, AzFramework, AzQtComponents, AzToolsFramework, etc. Replaced a `bind` or two, use `using` in a few places as well. Fix nullptr comparison of AZStd::function. Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Apply review-based changes Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com>
This commit is contained in:
@@ -591,13 +591,13 @@ namespace GridMate
|
||||
|
||||
ThreadMessage(MainThreadMsg mtm)
|
||||
: m_code(mtm)
|
||||
, m_connection(NULL)
|
||||
, m_threadConnection(NULL)
|
||||
, m_connection(nullptr)
|
||||
, m_threadConnection(nullptr)
|
||||
{}
|
||||
ThreadMessage(CarrierThreadMsg ctm)
|
||||
: m_code(ctm)
|
||||
, m_connection(NULL)
|
||||
, m_threadConnection(NULL)
|
||||
, m_connection(nullptr)
|
||||
, m_threadConnection(nullptr)
|
||||
{}
|
||||
|
||||
int m_code;
|
||||
@@ -787,7 +787,7 @@ namespace GridMate
|
||||
AZ_FORCE_INLINE ThreadMessage* PopCarrierThreadMessage()
|
||||
{
|
||||
AZStd::lock_guard<AZStd::mutex> l(m_carrierMsgQueueLock);
|
||||
ThreadMessage* res = NULL;
|
||||
ThreadMessage* res = nullptr;
|
||||
if (!m_carrierMsgQueue.empty())
|
||||
{
|
||||
res = m_carrierMsgQueue.front();
|
||||
@@ -799,7 +799,7 @@ namespace GridMate
|
||||
AZ_FORCE_INLINE ThreadMessage* PopMainThreadMessage()
|
||||
{
|
||||
AZStd::lock_guard<AZStd::mutex> l(m_mainMsgQueueLock);
|
||||
ThreadMessage* res = NULL;
|
||||
ThreadMessage* res = nullptr;
|
||||
if (!m_mainMsgQueue.empty())
|
||||
{
|
||||
res = m_mainMsgQueue.front();
|
||||
@@ -1120,7 +1120,7 @@ using namespace GridMate;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
Connection::Connection(CarrierThread* threadOwner, const AZStd::string& address)
|
||||
: m_threadOwner(threadOwner)
|
||||
, m_threadConn(NULL)
|
||||
, m_threadConn(nullptr)
|
||||
, m_fullAddress(address)
|
||||
, m_state(Carrier::CST_CONNECTING)
|
||||
{
|
||||
@@ -1139,7 +1139,7 @@ Connection::Connection(CarrierThread* threadOwner, const AZStd::string& address)
|
||||
|
||||
Connection::~Connection()
|
||||
{
|
||||
AZ_Error("GridMate", m_threadConn.load(AZStd::memory_order_acquire) == NULL, "We must detach the thread connection first!");
|
||||
AZ_Error("GridMate", m_threadConn.load(AZStd::memory_order_acquire) == nullptr, "We must detach the thread connection first!");
|
||||
// Make sure render thread doesn't reference is at this point... it's too late
|
||||
for (unsigned int i = 0; i < AZ_ARRAY_SIZE(m_toSend); ++i)
|
||||
{
|
||||
@@ -1172,7 +1172,7 @@ Connection::~Connection()
|
||||
|
||||
ThreadConnection::ThreadConnection(CarrierThread* threadOwner)
|
||||
: m_threadOwner(threadOwner)
|
||||
, m_mainConnection(NULL)
|
||||
, m_mainConnection(nullptr)
|
||||
, m_dataGramSeqNum(1) // IMPORTANT to start with 1 if we have not received any datagrams we will confirm a datagram with value of 0.
|
||||
, m_lastAckedDatagram(0)
|
||||
, m_lastReceivedDatagramTime(AZStd::chrono::system_clock::now())
|
||||
@@ -1196,7 +1196,7 @@ ThreadConnection::ThreadConnection(CarrierThread* threadOwner)
|
||||
|
||||
ThreadConnection::~ThreadConnection()
|
||||
{
|
||||
AZ_Error("GridMate", m_mainConnection == NULL || m_mainConnection->m_threadConn.load() == NULL, "We should have unbound the thread connection by now!");
|
||||
AZ_Error("GridMate", m_mainConnection == nullptr || m_mainConnection->m_threadConn.load() == nullptr, "We should have unbound the thread connection by now!");
|
||||
|
||||
for (unsigned char iChannel = 0; iChannel < k_maxNumberOfChannels; ++iChannel)
|
||||
{
|
||||
@@ -1215,8 +1215,8 @@ ThreadConnection::~ThreadConnection()
|
||||
m_threadOwner->FreeDatagram(dgram);
|
||||
}
|
||||
|
||||
m_target->m_threadConnection = NULL;
|
||||
m_target = NULL;
|
||||
m_target->m_threadConnection = nullptr;
|
||||
m_target = nullptr;
|
||||
m_threadOwner->RemoveConnectionToSend(this);
|
||||
|
||||
AZ_Error("GridMate", !IsLinked(), "Connection still linked!");
|
||||
@@ -1245,7 +1245,7 @@ CarrierThread::CarrierThread(const CarrierDesc& desc, AZStd::shared_ptr<Compress
|
||||
m_ownDriver = false;
|
||||
m_driver = desc.m_driver;
|
||||
|
||||
if (m_driver == 0)
|
||||
if (m_driver == nullptr)
|
||||
{
|
||||
m_ownDriver = true;
|
||||
m_driver = aznew SocketDriver(desc.m_driverIsFullPackets, desc.m_driverIsCrossPlatform);
|
||||
@@ -1258,7 +1258,7 @@ CarrierThread::CarrierThread(const CarrierDesc& desc, AZStd::shared_ptr<Compress
|
||||
m_ownTrafficControl = false;
|
||||
m_trafficControl = desc.m_trafficControl;
|
||||
|
||||
if (m_trafficControl == 0)
|
||||
if (m_trafficControl == nullptr)
|
||||
{
|
||||
m_ownTrafficControl = true;
|
||||
m_trafficControl = aznew DefaultTrafficControl(m_driver->GetMaxSendSize(),
|
||||
@@ -1667,7 +1667,7 @@ CarrierThread::UpdateReceive()
|
||||
ReadBuffer readBuffer(kCarrierEndian, data, recvDataGramSize);
|
||||
ThreadConnection* conn = nullptr;
|
||||
|
||||
if (fromAddress->m_threadConnection != NULL)
|
||||
if (fromAddress->m_threadConnection != nullptr)
|
||||
{
|
||||
conn = fromAddress->m_threadConnection;
|
||||
receivedConnections.insert(conn);
|
||||
@@ -2214,7 +2214,7 @@ CarrierThread::UpdateStats()
|
||||
for (ThreadConnectionList::iterator iConn = m_threadConnections.begin(); iConn != m_threadConnections.end(); ++iConn)
|
||||
{
|
||||
ThreadConnection* conn = *iConn;
|
||||
if (conn->m_mainConnection == NULL)
|
||||
if (conn->m_mainConnection == nullptr)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -2267,40 +2267,40 @@ CarrierThread::ThreadPump()
|
||||
// Process messages for us
|
||||
{
|
||||
ThreadMessage* msg;
|
||||
while ((msg = PopCarrierThreadMessage()) != NULL)
|
||||
while ((msg = PopCarrierThreadMessage()) != nullptr)
|
||||
{
|
||||
switch (msg->m_code)
|
||||
{
|
||||
case CTM_CONNECT:
|
||||
{
|
||||
AZ_Assert(msg->m_connection != NULL, "You must provide a valid connection pointer!");
|
||||
AZ_Assert(msg->m_connection != nullptr, "You must provide a valid connection pointer!");
|
||||
// if this connect was initiated from a remote machine msg->threadConnection will be != NULL
|
||||
ThreadConnection* conn = msg->m_threadConnection;
|
||||
if (!conn)
|
||||
{
|
||||
// The main thread is initiating this connection
|
||||
AZStd::intrusive_ptr<DriverAddress> driverAddress = m_driver->CreateDriverAddress(msg->m_connection->m_fullAddress);
|
||||
if (driverAddress->m_threadConnection != NULL)
|
||||
if (driverAddress->m_threadConnection != nullptr)
|
||||
{
|
||||
AZ_TracePrintf("GridMate", "Thread connection to %s already exists!\n", driverAddress->ToString().c_str());
|
||||
// we already have such thread connection
|
||||
conn = driverAddress->m_threadConnection;
|
||||
// make sure the existing connection is not bound
|
||||
AZ_Assert(conn->m_mainConnection == NULL, "This thread connection should be unbound!");
|
||||
AZ_Assert(conn->m_mainConnection == nullptr, "This thread connection should be unbound!");
|
||||
}
|
||||
else
|
||||
{
|
||||
conn = MakeNewConnection(driverAddress);
|
||||
}
|
||||
}
|
||||
AZ_Assert(conn->m_mainConnection == NULL || conn->m_mainConnection == msg->m_connection, "This thread connection should be unbound or bound to the imcomming main connection!");
|
||||
AZ_Assert(conn->m_mainConnection == nullptr || conn->m_mainConnection == msg->m_connection, "This thread connection should be unbound or bound to the imcomming main connection!");
|
||||
conn->m_mainConnection = msg->m_connection;
|
||||
AZ_Assert(conn->m_mainConnection->m_threadConn.load() == NULL || conn->m_mainConnection->m_threadConn.load() == conn, "This main connection should be unbound or bound to us!");
|
||||
AZ_Assert(conn->m_mainConnection->m_threadConn.load() == nullptr || conn->m_mainConnection->m_threadConn.load() == conn, "This main connection should be unbound or bound to us!");
|
||||
conn->m_mainConnection->m_threadConn = conn;
|
||||
} break;
|
||||
case CTM_DISCONNECT:
|
||||
{
|
||||
AZ_Assert(msg->m_connection != NULL, "You must provide a valid connection pointer!");
|
||||
AZ_Assert(msg->m_connection != nullptr, "You must provide a valid connection pointer!");
|
||||
ThreadConnection* tc = msg->m_connection->m_threadConn;
|
||||
if (tc && !tc->m_isDisconnecting)
|
||||
{
|
||||
@@ -2312,7 +2312,7 @@ CarrierThread::ThreadPump()
|
||||
} break;
|
||||
case CTM_DELETE_CONNECTION:
|
||||
{
|
||||
ThreadConnection* tc = NULL;
|
||||
ThreadConnection* tc = nullptr;
|
||||
tc = msg->m_threadConnection;
|
||||
if (tc)
|
||||
{
|
||||
@@ -2339,7 +2339,7 @@ CarrierThread::ThreadPump()
|
||||
ThreadMessage* mtm = aznew ThreadMessage(MTM_DELETE_CONNECTION);
|
||||
mtm->m_connection = msg->m_connection;
|
||||
RemoveConnectionToSend(mtm->m_threadConnection);
|
||||
mtm->m_threadConnection = NULL;
|
||||
mtm->m_threadConnection = nullptr;
|
||||
mtm->m_disconnectReason = msg->m_disconnectReason;
|
||||
PushMainThreadMessage(mtm);
|
||||
}
|
||||
@@ -2413,10 +2413,10 @@ CarrierThread::ThreadPump()
|
||||
if (tc->m_mainConnection)
|
||||
{
|
||||
RemoveConnectionToSend(tc);
|
||||
tc->m_mainConnection->m_threadConn = NULL;
|
||||
tc->m_mainConnection->m_threadConn = nullptr;
|
||||
ThreadMessage* mtm = aznew ThreadMessage(MTM_DELETE_CONNECTION);
|
||||
mtm->m_connection = tc->m_mainConnection;
|
||||
mtm->m_threadConnection = NULL;
|
||||
mtm->m_threadConnection = nullptr;
|
||||
mtm->m_disconnectReason = CarrierDisconnectReason::DISCONNECT_SHUTTING_DOWN;
|
||||
PushMainThreadMessage(mtm);
|
||||
}
|
||||
@@ -2582,7 +2582,7 @@ void CarrierThread::WriteAckData(ThreadConnection* connection, WriteBuffer& writ
|
||||
// Generate ACK bits
|
||||
SequenceNumber lastToAck; // last received datagram
|
||||
SequenceNumber firstToAck; // first received datagram (still in the list)
|
||||
unsigned char* ackHistoryBits = NULL;
|
||||
unsigned char* ackHistoryBits = nullptr;
|
||||
unsigned char ackNumHistoryBytes = 0;
|
||||
unsigned char ackHistoryBitsStorage[DataGramHistoryList::m_datagramHistoryMaxNumberOfBytes];
|
||||
|
||||
@@ -2736,7 +2736,7 @@ CarrierThread::ReadAckData(ThreadConnection* connection, ReadBuffer& readBuffer)
|
||||
return;
|
||||
}
|
||||
|
||||
if (connection != NULL && isAckData)
|
||||
if (connection != nullptr && isAckData)
|
||||
{
|
||||
if (firstToAck != lastToAck)
|
||||
{
|
||||
@@ -3707,12 +3707,12 @@ CarrierImpl::~CarrierImpl()
|
||||
}
|
||||
|
||||
delete m_thread;
|
||||
m_thread = NULL;
|
||||
m_thread = nullptr;
|
||||
|
||||
if (m_ownHandshake)
|
||||
{
|
||||
delete m_handshake;
|
||||
m_handshake = NULL;
|
||||
m_handshake = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4235,13 +4235,13 @@ CarrierImpl::ProcessMainThreadMessages()
|
||||
// Process messages from the carrier thread
|
||||
{
|
||||
ThreadMessage* msg;
|
||||
while ((msg = m_thread->PopMainThreadMessage()) != NULL)
|
||||
while ((msg = m_thread->PopMainThreadMessage()) != nullptr)
|
||||
{
|
||||
switch (msg->m_code)
|
||||
{
|
||||
case MTM_NEW_CONNECTION:
|
||||
{
|
||||
Connection* conn = NULL;
|
||||
Connection* conn = nullptr;
|
||||
// check if we don't have it in the list.
|
||||
for(auto& c : m_connections)
|
||||
{
|
||||
@@ -4255,8 +4255,8 @@ CarrierImpl::ProcessMainThreadMessages()
|
||||
{
|
||||
// we already have such connection
|
||||
ThreadConnection* threadConn = conn->m_threadConn.load(AZStd::memory_order_acquire);
|
||||
AZ_Assert(threadConn == NULL || threadConn == msg->m_threadConnection, "This main connection 0x%08x (%s) already have bound thread connection 0x%08x->0x%08x!", conn, conn->m_fullAddress.c_str(), threadConn, threadConn->m_mainConnection);
|
||||
if (threadConn == NULL)
|
||||
AZ_Assert(threadConn == nullptr || threadConn == msg->m_threadConnection, "This main connection 0x%08x (%s) already have bound thread connection 0x%08x->0x%08x!", conn, conn->m_fullAddress.c_str(), threadConn, threadConn->m_mainConnection);
|
||||
if (threadConn == nullptr)
|
||||
{
|
||||
// request a bind we have not already
|
||||
ThreadMessage* ctm = aznew ThreadMessage(CTM_CONNECT);
|
||||
@@ -4283,23 +4283,23 @@ CarrierImpl::ProcessMainThreadMessages()
|
||||
// we will not even make a connection
|
||||
ThreadMessage* ctm = aznew ThreadMessage(CTM_DELETE_CONNECTION);
|
||||
ctm->m_threadConnection = msg->m_threadConnection;
|
||||
ctm->m_connection = NULL;
|
||||
ctm->m_connection = nullptr;
|
||||
ctm->m_disconnectReason = CarrierDisconnectReason::DISCONNECT_HANDSHAKE_REJECTED;
|
||||
m_thread->PushCarrierThreadMessage(ctm);
|
||||
}
|
||||
} break;
|
||||
case MTM_DISCONNECT:
|
||||
{
|
||||
AZ_Assert(msg->m_connection != NULL, "You must provide a valid connection pointer!");
|
||||
AZ_Assert(msg->m_connection != nullptr, "You must provide a valid connection pointer!");
|
||||
DisconnectRequest(msg->m_connection, msg->m_disconnectReason);
|
||||
} break;
|
||||
case MTM_DISCONNECT_TIMEOUT:
|
||||
{
|
||||
AZ_Assert(msg->m_connection != NULL, "You must provide a valid connection pointer!");
|
||||
AZ_Assert(msg->m_connection != nullptr, "You must provide a valid connection pointer!");
|
||||
if (msg->m_connection->m_state == Carrier::CST_DISCONNECTING)
|
||||
{
|
||||
// unbind from the thread connection and inform carrier thread to delete it.
|
||||
ThreadConnection* threadConn = msg->m_connection->m_threadConn.exchange(NULL);
|
||||
ThreadConnection* threadConn = msg->m_connection->m_threadConn.exchange(nullptr);
|
||||
msg->m_connection->m_state = Carrier::CST_DISCONNECTED;
|
||||
ThreadMessage* ctm = aznew ThreadMessage(CTM_DELETE_CONNECTION);
|
||||
ctm->m_connection = msg->m_connection;
|
||||
@@ -4311,7 +4311,7 @@ CarrierImpl::ProcessMainThreadMessages()
|
||||
} break;
|
||||
case MTM_DELETE_CONNECTION:
|
||||
{
|
||||
AZ_Assert(msg->m_connection != NULL, "You must provide a valid connection pointer!");
|
||||
AZ_Assert(msg->m_connection != nullptr, "You must provide a valid connection pointer!");
|
||||
DeleteConnection(msg->m_connection, msg->m_disconnectReason);
|
||||
} break;
|
||||
case MTM_ON_ERROR:
|
||||
@@ -4534,7 +4534,7 @@ CarrierImpl::ProcessSystemMessages()
|
||||
// Delete connection
|
||||
conn->m_state = Carrier::CST_DISCONNECTED;
|
||||
// unbind from the thread connection and inform carrier thread to delete it.
|
||||
ThreadConnection* threadConn = conn->m_threadConn.exchange(NULL);
|
||||
ThreadConnection* threadConn = conn->m_threadConn.exchange(nullptr);
|
||||
ThreadMessage* ctm = aznew ThreadMessage(CTM_DELETE_CONNECTION);
|
||||
ctm->m_connection = conn;
|
||||
ctm->m_threadConnection = threadConn;
|
||||
@@ -4829,7 +4829,7 @@ CarrierImpl::GetTime()
|
||||
void
|
||||
CarrierImpl::DebugDeleteConnection(ConnectionID id)
|
||||
{
|
||||
if (id == InvalidConnectionID && m_thread != NULL)
|
||||
if (id == InvalidConnectionID && m_thread != nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -4844,7 +4844,7 @@ CarrierImpl::DebugDeleteConnection(ConnectionID id)
|
||||
// Delete connection
|
||||
conn->m_state = Carrier::CST_DISCONNECTED;
|
||||
// unbind from the thread connection and inform carrier thread to delete it.
|
||||
ThreadConnection* threadConn = conn->m_threadConn.exchange(NULL);
|
||||
ThreadConnection* threadConn = conn->m_threadConn.exchange(nullptr);
|
||||
ThreadMessage* ctm = aznew ThreadMessage(CTM_DELETE_CONNECTION);
|
||||
ctm->m_connection = conn;
|
||||
ctm->m_threadConnection = threadConn;
|
||||
@@ -4914,7 +4914,7 @@ DefaultCarrier::Create(const CarrierDesc& desc, IGridMate* gridMate)
|
||||
AZStd::string
|
||||
CarrierEventsBase::ReasonToString(CarrierDisconnectReason reason)
|
||||
{
|
||||
const char* reasonStr = 0;
|
||||
const char* reasonStr = nullptr;
|
||||
switch (reason)
|
||||
{
|
||||
case CarrierDisconnectReason::DISCONNECT_USER_REQUESTED:
|
||||
|
||||
@@ -58,8 +58,8 @@ DefaultTrafficControl::~DefaultTrafficControl()
|
||||
void
|
||||
DefaultTrafficControl::OnConnect(TrafficControlConnectionId id, const AZStd::intrusive_ptr<DriverAddress>& address)
|
||||
{
|
||||
AZ_Assert(id->m_trafficData == NULL, "We have already assigned traffic data to this connection!");
|
||||
if (id->m_trafficData != NULL)
|
||||
AZ_Assert(id->m_trafficData == nullptr, "We have already assigned traffic data to this connection!");
|
||||
if (id->m_trafficData != nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -100,7 +100,7 @@ void
|
||||
DefaultTrafficControl::OnDisconnect(TrafficControlConnectionId id)
|
||||
{
|
||||
ConnectionData* cd = reinterpret_cast<ConnectionData*>(id->m_trafficData);
|
||||
id->m_trafficData = NULL;
|
||||
id->m_trafficData = nullptr;
|
||||
bool isFound = false;
|
||||
for (ConnectionListType::iterator i = m_connections.begin(); i != m_connections.end(); ++i)
|
||||
{
|
||||
|
||||
@@ -1081,7 +1081,7 @@ namespace GridMate
|
||||
};
|
||||
sockaddr* sockAddr = reinterpret_cast<sockaddr*>(&sockAddrIn6);
|
||||
socklen_t sockAddrLen = sizeof(sockAddrIn6);
|
||||
from = NULL;
|
||||
from = nullptr;
|
||||
|
||||
unsigned int recvd = m_platformDriver->Receive(data, maxDataSize, sockAddr, sockAddrLen, resultCode);
|
||||
|
||||
@@ -1207,7 +1207,7 @@ namespace GridMate
|
||||
unsigned int port;
|
||||
if (!AddressToIPPort(address, ip, port))
|
||||
{
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
SocketDriverAddress drvAddr(this, ip, port);
|
||||
@@ -1313,7 +1313,7 @@ namespace GridMate
|
||||
fd_set fdwrite;
|
||||
FD_ZERO(&fdwrite);
|
||||
FD_SET(m_socket, &fdwrite);
|
||||
select(FD_SETSIZE, 0, &fdwrite, 0, 0);
|
||||
select(FD_SETSIZE, nullptr, &fdwrite, nullptr, nullptr);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1376,7 +1376,7 @@ namespace GridMate
|
||||
FD_SET(m_socket, &fdread);
|
||||
timeval t = Platform::GetTimeValue(timeOut);
|
||||
|
||||
int result = select(FD_SETSIZE, &fdread, 0, 0, &t);
|
||||
int result = select(FD_SETSIZE, &fdread, nullptr, nullptr, &t);
|
||||
if (result > 0)
|
||||
{
|
||||
m_parent.m_isStoppedWaitForData = true;
|
||||
|
||||
@@ -343,7 +343,7 @@ namespace GridMate
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (0);
|
||||
while (false);
|
||||
|
||||
// did everything successfully create and/or allocate?
|
||||
if (m_ssl && m_bioIn && m_bioOut && m_scratch)
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace GridMate
|
||||
AZ_CLASS_ALLOCATOR(GridMateImpl, GridMateAllocator, 0);
|
||||
|
||||
GridMateImpl(const GridMateDesc& desc);
|
||||
virtual ~GridMateImpl();
|
||||
~GridMateImpl() override;
|
||||
|
||||
void Update() override;
|
||||
|
||||
|
||||
@@ -777,7 +777,7 @@ namespace GridMate
|
||||
CtorContextBase::s_pCur->m_members.push_back(this);
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
CtorContextBase* CtorContextBase::s_pCur = NULL;
|
||||
CtorContextBase* CtorContextBase::s_pCur = nullptr;
|
||||
//-----------------------------------------------------------------------------
|
||||
CtorContextBase::CtorContextBase()
|
||||
{
|
||||
|
||||
@@ -460,7 +460,7 @@ namespace GridMate
|
||||
{
|
||||
return iter->second;
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
RepIdSeed ReplicaManager::ReserveIdBlock(PeerId requestor)
|
||||
@@ -995,7 +995,7 @@ namespace GridMate
|
||||
AZ_Assert(iObj->second, "Detected NULL replica pointer in replica map! (id=0x%x)", replicaId);
|
||||
return iObj->second;
|
||||
}
|
||||
return ReplicaPtr(NULL);
|
||||
return ReplicaPtr(nullptr);
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void ReplicaManager::_Unmarshal(ReadBuffer& rb, ReplicaPeer* pFrom)
|
||||
|
||||
@@ -52,13 +52,13 @@ namespace GridMate
|
||||
|
||||
MemberIDCompact GetID() const { return m_id; }
|
||||
|
||||
virtual AZStd::string ToString() const
|
||||
AZStd::string ToString() const override
|
||||
{
|
||||
return AZStd::string::format("%x", m_id);
|
||||
}
|
||||
virtual AZStd::string ToAddress() const { return m_address; }
|
||||
virtual MemberIDCompact Compact() const { return m_id; }
|
||||
virtual bool IsValid() const { return m_id != 0; }
|
||||
AZStd::string ToAddress() const override { return m_address; }
|
||||
MemberIDCompact Compact() const override { return m_id; }
|
||||
bool IsValid() const override { return m_id != 0; }
|
||||
|
||||
private:
|
||||
MemberIDCompact m_id;
|
||||
@@ -285,9 +285,9 @@ namespace GridMate
|
||||
static const char* GetChunkName() { return "GridMateLANMember"; }
|
||||
|
||||
/// return an abstracted member id. (member ID is world unique but unrelated to player ID it's related to the session).
|
||||
virtual const MemberID& GetId() const { return m_memberId; }
|
||||
const MemberID& GetId() const override { return m_memberId; }
|
||||
/// returns a base player id, it's implementation is platform dependent. (NOT supported)
|
||||
virtual const PlayerId* GetPlayerId() const { return nullptr; }
|
||||
const PlayerId* GetPlayerId() const override { return nullptr; }
|
||||
|
||||
/// Remote member ctor.
|
||||
LANMember(ConnectionID connId, const LANMemberID& id, LANSession* session);
|
||||
@@ -321,16 +321,16 @@ namespace GridMate
|
||||
friend class LANSessionService;
|
||||
public:
|
||||
GM_CLASS_ALLOCATOR(LANSearch);
|
||||
virtual ~LANSearch();
|
||||
~LANSearch() override;
|
||||
|
||||
/// Return true if the search has finished, otherwise false.
|
||||
virtual unsigned int GetNumResults() const { return static_cast<unsigned int>(m_results.size()); }
|
||||
virtual const SearchInfo* GetResult(unsigned int index) const { return &m_results[index]; }
|
||||
virtual void AbortSearch();
|
||||
unsigned int GetNumResults() const override { return static_cast<unsigned int>(m_results.size()); }
|
||||
const SearchInfo* GetResult(unsigned int index) const override { return &m_results[index]; }
|
||||
void AbortSearch() override;
|
||||
|
||||
private:
|
||||
LANSearch(const LANSearchParams& searchParams, SessionService* service);
|
||||
virtual void Update();
|
||||
void Update() override;
|
||||
void SearchDone();
|
||||
|
||||
Driver* m_driver;
|
||||
|
||||
@@ -63,40 +63,40 @@ namespace GridMate
|
||||
typedef unordered_set<AZStd::string> AddressSetType;
|
||||
|
||||
GridSessionHandshake(unsigned int handshakeTimeoutMS, const VersionType& version);
|
||||
virtual ~GridSessionHandshake() {}
|
||||
~GridSessionHandshake() override {}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Handshake
|
||||
|
||||
/// Called from the system to write initial handshake data.
|
||||
virtual void OnInitiate(ConnectionID id, WriteBuffer& wb);
|
||||
void OnInitiate(ConnectionID id, WriteBuffer& wb) override;
|
||||
/**
|
||||
* Called when a system receives a handshake initiation from another system.
|
||||
* You can write a reply in the WriteBuffer.
|
||||
* return true if you accept this connection and false if you reject it.
|
||||
*/
|
||||
virtual HandshakeErrorCode OnReceiveRequest(ConnectionID id, ReadBuffer& rb, WriteBuffer& wb);
|
||||
HandshakeErrorCode OnReceiveRequest(ConnectionID id, ReadBuffer& rb, WriteBuffer& wb) override;
|
||||
/**
|
||||
* If we already have a valid connection and we receive another connection request, the system will
|
||||
* call this function to verify the state of the connection.
|
||||
*/
|
||||
virtual bool OnConfirmRequest(ConnectionID id, ReadBuffer& rb);
|
||||
bool OnConfirmRequest(ConnectionID id, ReadBuffer& rb) override;
|
||||
/**
|
||||
* Called when we receive Ack from the other system on our initial data \ref OnInitiate.
|
||||
* return true to accept the ack or false to reject the handshake.
|
||||
*/
|
||||
virtual bool OnReceiveAck(ConnectionID id, ReadBuffer& rb) { (void)id; (void)rb; return true; } // we don't do any further filtering
|
||||
bool OnReceiveAck(ConnectionID id, ReadBuffer& rb) override { (void)id; (void)rb; return true; } // we don't do any further filtering
|
||||
/**
|
||||
* Called when we receive Ack from the other system while we were connected. This callback is called
|
||||
* so we can just confirm that our connection is valid!
|
||||
*/
|
||||
virtual bool OnConfirmAck(ConnectionID id, ReadBuffer& rb) { (void)id; (void)rb; return true; } // we don't do any further filtering
|
||||
bool OnConfirmAck(ConnectionID id, ReadBuffer& rb) override { (void)id; (void)rb; return true; } // we don't do any further filtering
|
||||
/// Return true if you want to reject early reject a connection.
|
||||
virtual bool OnNewConnection(const AZStd::string& address);
|
||||
bool OnNewConnection(const AZStd::string& address) override;
|
||||
/// Called when we close a connection.
|
||||
virtual void OnDisconnect(ConnectionID id);
|
||||
void OnDisconnect(ConnectionID id) override;
|
||||
/// Return timeout in milliseconds of the handshake procedure.
|
||||
virtual unsigned int GetHandshakeTimeOutMS() const { return m_handshakeTimeOutMS; }
|
||||
unsigned int GetHandshakeTimeOutMS() const override { return m_handshakeTimeOutMS; }
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void BanAddress(AZStd::string address);
|
||||
|
||||
@@ -90,7 +90,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
~CarrierCallbacksHandler()
|
||||
~CarrierCallbacksHandler() override
|
||||
{
|
||||
CarrierEventBus::Handler::BusDisconnect();
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
~CarrierStreamCallbacksHandler()
|
||||
~CarrierStreamCallbacksHandler() override
|
||||
{
|
||||
if (m_active)
|
||||
{
|
||||
|
||||
@@ -282,7 +282,7 @@ namespace ReplicaBehavior {
|
||||
GM_CLASS_ALLOCATOR(EntityLikeScriptReplicaChunk);
|
||||
|
||||
EntityLikeScriptReplicaChunk();
|
||||
~EntityLikeScriptReplicaChunk() = default;
|
||||
~EntityLikeScriptReplicaChunk() override = default;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//! GridMate::ReplicaChunk overrides.
|
||||
@@ -296,7 +296,7 @@ namespace ReplicaBehavior {
|
||||
|
||||
int GetMaxServerProperties() const { return k_maxScriptableDataSets; }
|
||||
|
||||
AZ::u32 CalculateDirtyDataSetMask(MarshalContext& marshalContext);
|
||||
AZ::u32 CalculateDirtyDataSetMask(MarshalContext& marshalContext) override;
|
||||
|
||||
EntityLikeScriptDataSet m_scriptDataSets[k_maxScriptableDataSets];
|
||||
AZ::u32 m_enabledDataSetMask;
|
||||
@@ -815,7 +815,7 @@ namespace ReplicaBehavior {
|
||||
m_replicaId = m_sessions[sHost].GetReplicaMgr().AddPrimary(replica);
|
||||
}
|
||||
|
||||
~Integ_ReplicaDefaultDataSetDriller()
|
||||
~Integ_ReplicaDefaultDataSetDriller() override
|
||||
{
|
||||
m_driller.BusDisconnect();
|
||||
}
|
||||
@@ -928,7 +928,7 @@ namespace ReplicaBehavior {
|
||||
m_replicaU8Id = m_sessions[sHost].GetReplicaMgr().AddPrimary(replica2);
|
||||
}
|
||||
|
||||
~Integ_Replica_ComparePackingBoolsVsU8()
|
||||
~Integ_Replica_ComparePackingBoolsVsU8() override
|
||||
{
|
||||
m_driller.BusDisconnect();
|
||||
}
|
||||
@@ -1057,7 +1057,7 @@ namespace ReplicaBehavior {
|
||||
m_replicaId = m_sessions[sHost].GetReplicaMgr().AddPrimary(replica);
|
||||
}
|
||||
|
||||
~Integ_CheckDataSetStreamIsntWrittenMoreThanNecessary()
|
||||
~Integ_CheckDataSetStreamIsntWrittenMoreThanNecessary() override
|
||||
{
|
||||
m_driller.BusDisconnect();
|
||||
}
|
||||
@@ -1154,7 +1154,7 @@ namespace ReplicaBehavior {
|
||||
m_replicaId = m_sessions[sHost].GetReplicaMgr().AddPrimary(replica);
|
||||
}
|
||||
|
||||
~Integ_CheckDataSetStreamIsntWrittenMoreThanNecessaryOnceDirty()
|
||||
~Integ_CheckDataSetStreamIsntWrittenMoreThanNecessaryOnceDirty() override
|
||||
{
|
||||
m_driller.BusDisconnect();
|
||||
}
|
||||
@@ -1248,7 +1248,7 @@ namespace ReplicaBehavior {
|
||||
m_replicaId = m_sessions[sHost].GetReplicaMgr().AddPrimary(replica);
|
||||
}
|
||||
|
||||
~Integ_CheckReplicaIsntSentWithNoChanges()
|
||||
~Integ_CheckReplicaIsntSentWithNoChanges() override
|
||||
{
|
||||
m_driller.BusDisconnect();
|
||||
}
|
||||
@@ -1359,7 +1359,7 @@ namespace ReplicaBehavior {
|
||||
m_replicaId = m_sessions[sHost].GetReplicaMgr().AddPrimary(replica);
|
||||
}
|
||||
|
||||
~Integ_CheckEntityScriptReplicaIsntSentWithNoChanges()
|
||||
~Integ_CheckEntityScriptReplicaIsntSentWithNoChanges() override
|
||||
{
|
||||
m_driller.BusDisconnect();
|
||||
}
|
||||
|
||||
@@ -601,7 +601,7 @@ class MPSession
|
||||
{
|
||||
public:
|
||||
|
||||
~MPSession()
|
||||
~MPSession() override
|
||||
{
|
||||
CarrierEventBus::Handler::BusDisconnect();
|
||||
}
|
||||
@@ -2007,7 +2007,7 @@ public:
|
||||
m_replicaId = m_sessions[sHost].GetReplicaMgr().AddPrimary(replica);
|
||||
}
|
||||
|
||||
~Integ_ReplicaDriller()
|
||||
~Integ_ReplicaDriller() override
|
||||
{
|
||||
m_driller.BusDisconnect();
|
||||
}
|
||||
@@ -2893,7 +2893,7 @@ public:
|
||||
m_replicaId = m_sessions[sHost].GetReplicaMgr().AddPrimary(replica);
|
||||
}
|
||||
|
||||
~ReplicaACKfeedbackTestFixture()
|
||||
~ReplicaACKfeedbackTestFixture() override
|
||||
{
|
||||
m_driller.BusDisconnect();
|
||||
}
|
||||
|
||||
@@ -254,7 +254,7 @@ public:
|
||||
s_nInstances++;
|
||||
}
|
||||
|
||||
~OfflineChunk()
|
||||
~OfflineChunk() override
|
||||
{
|
||||
s_nInstances--;
|
||||
}
|
||||
@@ -273,7 +273,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
bool IsReplicaMigratable() { return true; }
|
||||
bool IsReplicaMigratable() override { return true; }
|
||||
|
||||
DataSet<int> m_data1;
|
||||
DataSet<int>::BindInterface<OfflineChunk, & OfflineChunk::DataSetChangeCB> m_data2;
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace UnitTest
|
||||
AZ_TEST_ASSERT(GridMate::LANSessionServiceBus::FindFirstHandler(m_clientGridMate) != nullptr);
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
}
|
||||
virtual ~Integ_LANSessionMatchmakingParamsTest()
|
||||
~Integ_LANSessionMatchmakingParamsTest() override
|
||||
{
|
||||
SessionEventBus::MultiHandler::BusDisconnect(m_gridMate);
|
||||
SessionEventBus::MultiHandler::BusDisconnect(m_clientGridMate);
|
||||
@@ -290,7 +290,7 @@ namespace UnitTest
|
||||
AZ_TEST_ASSERT(LANSessionServiceBus::FindFirstHandler(m_peers[i].m_gridMate) != nullptr);
|
||||
}
|
||||
}
|
||||
virtual ~Integ_LANSessionTest()
|
||||
~Integ_LANSessionTest() override
|
||||
{
|
||||
StopGridMateService<LANSessionService>(m_peers[0].m_gridMate);
|
||||
|
||||
@@ -645,7 +645,7 @@ namespace UnitTest
|
||||
}
|
||||
}
|
||||
|
||||
virtual ~Integ_LANMultipleSessionTest()
|
||||
~Integ_LANMultipleSessionTest() override
|
||||
{
|
||||
GridMate::StopGridMateService<GridMate::LANSessionService>(m_gridMates[0]);
|
||||
|
||||
@@ -884,7 +884,7 @@ namespace UnitTest
|
||||
}
|
||||
}
|
||||
|
||||
virtual ~Integ_LANLatencySessionTest()
|
||||
~Integ_LANLatencySessionTest() override
|
||||
{
|
||||
StopGridMateService<LANSessionService>(m_gridMates[0]);
|
||||
|
||||
@@ -1283,7 +1283,7 @@ namespace UnitTest
|
||||
//StartDrilling("lanmigration");
|
||||
}
|
||||
|
||||
virtual ~Integ_LANSessionMigarationTestTest()
|
||||
~Integ_LANSessionMigarationTestTest() override
|
||||
{
|
||||
StopGridMateService<LANSessionService>(m_gridMates[0]);
|
||||
|
||||
@@ -1597,7 +1597,7 @@ namespace UnitTest
|
||||
|
||||
//StartDrilling("lanmigration2");
|
||||
}
|
||||
virtual ~Integ_LANSessionMigarationTestTest2()
|
||||
~Integ_LANSessionMigarationTestTest2() override
|
||||
{
|
||||
StopGridMateService<LANSessionService>(m_gridMates[0]);
|
||||
|
||||
|
||||
@@ -14,12 +14,12 @@ struct GridMateTestEnvironment
|
||||
: public AZ::Test::ITestEnvironment
|
||||
, public AZ::Debug::TraceMessageBus::Handler
|
||||
{
|
||||
void SetupEnvironment() override final
|
||||
void SetupEnvironment() final
|
||||
{
|
||||
AZ::AllocatorInstance<AZ::OSAllocator>::Create();
|
||||
BusConnect();
|
||||
}
|
||||
void TeardownEnvironment() override final
|
||||
void TeardownEnvironment() final
|
||||
{
|
||||
BusDisconnect();
|
||||
AZ::AllocatorInstance<AZ::OSAllocator>::Destroy();
|
||||
|
||||
Reference in New Issue
Block a user