mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-17 02:51:27 +00:00
Merge pnUtRef with hsRefCnt, and remove the former
This commit is contained in:
@ -57,7 +57,7 @@ namespace Ngl { namespace Auth {
|
||||
*
|
||||
***/
|
||||
|
||||
struct CliAuConn : AtomicRef {
|
||||
struct CliAuConn : hsAtomicRefCnt {
|
||||
CliAuConn ();
|
||||
~CliAuConn ();
|
||||
|
||||
@ -1280,7 +1280,7 @@ static unsigned GetNonZeroTimeMs () {
|
||||
//============================================================================
|
||||
static CliAuConn * GetConnIncRef_CS (const char tag[]) {
|
||||
if (CliAuConn * conn = s_active) {
|
||||
conn->IncRef(tag);
|
||||
conn->Ref(tag);
|
||||
return conn;
|
||||
}
|
||||
return nil;
|
||||
@ -1312,7 +1312,7 @@ static void UnlinkAndAbandonConn_CS (CliAuConn * conn) {
|
||||
AsyncSocketDisconnect(conn->sock, true);
|
||||
}
|
||||
else {
|
||||
conn->DecRef("Lifetime");
|
||||
conn->UnRef("Lifetime");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1369,7 +1369,7 @@ static void CheckedReconnect (CliAuConn * conn, ENetError error) {
|
||||
// Cancel all transactions in progress on this connection.
|
||||
NetTransCancelByConnId(conn->seq, kNetErrTimeout);
|
||||
// conn is dead.
|
||||
conn->DecRef("Lifetime");
|
||||
conn->UnRef("Lifetime");
|
||||
ReportNetError(kNetProtocolCli2Auth, error);
|
||||
}
|
||||
else {
|
||||
@ -1405,7 +1405,7 @@ static void NotifyConnSocketConnectFailed (CliAuConn * conn) {
|
||||
|
||||
CheckedReconnect(conn, kNetErrConnectFailed);
|
||||
|
||||
conn->DecRef("Connecting");
|
||||
conn->UnRef("Connecting");
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
@ -1426,7 +1426,7 @@ static void NotifyConnSocketDisconnect (CliAuConn * conn) {
|
||||
|
||||
CheckedReconnect(conn, kNetErrDisconnected);
|
||||
|
||||
conn->DecRef("Connected");
|
||||
conn->UnRef("Connected");
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
@ -1540,7 +1540,7 @@ static void Connect (
|
||||
conn->lastHeardTimeMs = GetNonZeroTimeMs(); // used in connect timeout, and ping timeout
|
||||
strncpy(conn->name, name, arrsize(conn->name));
|
||||
|
||||
conn->IncRef("Lifetime");
|
||||
conn->Ref("Lifetime");
|
||||
conn->AutoReconnect();
|
||||
}
|
||||
|
||||
@ -1571,7 +1571,7 @@ static void AsyncLookupCallback (
|
||||
//===========================================================================
|
||||
static unsigned CliAuConnTimerDestroyed (void * param) {
|
||||
CliAuConn * conn = (CliAuConn *) param;
|
||||
conn->DecRef("TimerDestroyed");
|
||||
conn->UnRef("TimerDestroyed");
|
||||
return kAsyncTimeInfinite;
|
||||
}
|
||||
|
||||
@ -1617,7 +1617,7 @@ void CliAuConn::TimerReconnect () {
|
||||
s_critsect.Leave();
|
||||
}
|
||||
else {
|
||||
IncRef("Connecting");
|
||||
Ref("Connecting");
|
||||
|
||||
// Remember the time we started the reconnect attempt, guarding against
|
||||
// TimeGetMs() returning zero (unlikely), as a value of zero indicates
|
||||
@ -1656,7 +1656,7 @@ void CliAuConn::StartAutoReconnect () {
|
||||
void CliAuConn::AutoReconnect () {
|
||||
|
||||
ASSERT(!reconnectTimer);
|
||||
IncRef("ReconnectTimer");
|
||||
Ref("ReconnectTimer");
|
||||
critsect.Enter();
|
||||
{
|
||||
AsyncTimerCreate(
|
||||
@ -1690,7 +1690,7 @@ bool CliAuConn::AutoReconnectEnabled () {
|
||||
//============================================================================
|
||||
void CliAuConn::AutoPing () {
|
||||
ASSERT(!pingTimer);
|
||||
IncRef("PingTimer");
|
||||
Ref("PingTimer");
|
||||
critsect.Enter();
|
||||
{
|
||||
AsyncTimerCreate(
|
||||
@ -3941,7 +3941,7 @@ void VaultFetchNodeTrans::Post () {
|
||||
m_node
|
||||
);
|
||||
if (m_node)
|
||||
m_node->DecRef("Recv");
|
||||
m_node->UnRef("Recv");
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
@ -3954,7 +3954,7 @@ bool VaultFetchNodeTrans::Recv (
|
||||
if (IS_NET_SUCCESS(reply.result)) {
|
||||
m_node = new NetVaultNode;
|
||||
m_node->Read_LCS(reply.nodeBuffer, reply.nodeBytes, 0);
|
||||
m_node->IncRef("Recv");
|
||||
m_node->Ref("Recv");
|
||||
}
|
||||
|
||||
m_result = reply.result;
|
||||
@ -3980,12 +3980,12 @@ VaultFindNodeTrans::VaultFindNodeTrans (
|
||||
, m_param(param)
|
||||
, m_node(templateNode)
|
||||
{
|
||||
m_node->IncRef();
|
||||
m_node->Ref();
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
VaultFindNodeTrans::~VaultFindNodeTrans () {
|
||||
m_node->DecRef();
|
||||
m_node->UnRef();
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
@ -4056,7 +4056,7 @@ VaultCreateNodeTrans::VaultCreateNodeTrans (
|
||||
, m_param(param)
|
||||
, m_nodeId(0)
|
||||
{
|
||||
m_templateNode->IncRef();
|
||||
m_templateNode->Ref();
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
@ -4086,7 +4086,7 @@ void VaultCreateNodeTrans::Post () {
|
||||
m_param,
|
||||
m_nodeId
|
||||
);
|
||||
m_templateNode->DecRef();
|
||||
m_templateNode->UnRef();
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
@ -5024,7 +5024,7 @@ bool NetAuthTrans::AcquireConn () {
|
||||
//============================================================================
|
||||
void NetAuthTrans::ReleaseConn () {
|
||||
if (m_conn) {
|
||||
m_conn->DecRef("AcquireConn");
|
||||
m_conn->UnRef("AcquireConn");
|
||||
m_conn = nil;
|
||||
}
|
||||
}
|
||||
@ -5399,7 +5399,7 @@ void NetCliAuthSetCCRLevel (
|
||||
};
|
||||
|
||||
conn->Send(msg, arrsize(msg));
|
||||
conn->DecRef("SetCCRLevel");
|
||||
conn->UnRef("SetCCRLevel");
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
@ -5433,7 +5433,7 @@ void NetCliAuthSetAgePublic (
|
||||
|
||||
conn->Send(msg, arrsize(msg));
|
||||
|
||||
conn->DecRef("SetAgePublic");
|
||||
conn->UnRef("SetAgePublic");
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
@ -5733,7 +5733,7 @@ void NetCliAuthVaultSetSeen (
|
||||
|
||||
conn->Send(msg, arrsize(msg));
|
||||
|
||||
conn->DecRef("SetSeen");
|
||||
conn->UnRef("SetSeen");
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
@ -5753,7 +5753,7 @@ void NetCliAuthVaultSendNode (
|
||||
|
||||
conn->Send(msg, arrsize(msg));
|
||||
|
||||
conn->DecRef("SendNode");
|
||||
conn->UnRef("SendNode");
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
@ -5817,7 +5817,7 @@ void NetCliAuthPropagateBuffer (
|
||||
|
||||
conn->Send(msg, arrsize(msg));
|
||||
|
||||
conn->DecRef("PropBuffer");
|
||||
conn->UnRef("PropBuffer");
|
||||
|
||||
}
|
||||
|
||||
@ -5834,7 +5834,7 @@ void NetCliAuthLogPythonTraceback (const wchar_t traceback[]) {
|
||||
|
||||
conn->Send(msg, arrsize(msg));
|
||||
|
||||
conn->DecRef("LogTraceback");
|
||||
conn->UnRef("LogTraceback");
|
||||
}
|
||||
|
||||
|
||||
@ -5851,7 +5851,7 @@ void NetCliAuthLogStackDump (const wchar_t stackdump[]) {
|
||||
|
||||
conn->Send(msg, arrsize(msg));
|
||||
|
||||
conn->DecRef("LogStackDump");
|
||||
conn->UnRef("LogStackDump");
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
@ -5869,7 +5869,7 @@ void NetCliAuthLogClientDebuggerConnect () {
|
||||
|
||||
conn->Send(msg, arrsize(msg));
|
||||
|
||||
conn->DecRef();
|
||||
conn->UnRef();
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
@ -5908,7 +5908,7 @@ void NetCliAuthKickPlayer (
|
||||
};
|
||||
|
||||
conn->Send(msg, arrsize(msg));
|
||||
conn->DecRef("KickPlayer");
|
||||
conn->UnRef("KickPlayer");
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
|
@ -60,7 +60,7 @@ namespace Ngl { namespace File {
|
||||
*
|
||||
***/
|
||||
|
||||
struct CliFileConn : AtomicRef {
|
||||
struct CliFileConn : hsAtomicRefCnt {
|
||||
LINK(CliFileConn) link;
|
||||
hsReaderWriterLock sockLock; // to protect the socket pointer so we don't nuke it while using it
|
||||
AsyncSocket sock;
|
||||
@ -251,7 +251,7 @@ static unsigned GetNonZeroTimeMs () {
|
||||
//============================================================================
|
||||
static CliFileConn * GetConnIncRef_CS (const char tag[]) {
|
||||
if (CliFileConn * conn = s_active) {
|
||||
conn->IncRef(tag);
|
||||
conn->Ref(tag);
|
||||
return conn;
|
||||
}
|
||||
return nil;
|
||||
@ -291,7 +291,7 @@ static void UnlinkAndAbandonConn_CS (CliFileConn * conn) {
|
||||
conn->sockLock.UnlockForReading();
|
||||
}
|
||||
if (needsDecref) {
|
||||
conn->DecRef("Lifetime");
|
||||
conn->UnRef("Lifetime");
|
||||
}
|
||||
}
|
||||
|
||||
@ -346,9 +346,9 @@ static void NotifyConnSocketConnectFailed (CliFileConn * conn) {
|
||||
if (s_running && conn->AutoReconnectEnabled())
|
||||
conn->StartAutoReconnect();
|
||||
else
|
||||
conn->DecRef("Lifetime"); // if we are not reconnecting, this socket is done, so remove the lifetime ref
|
||||
conn->UnRef("Lifetime"); // if we are not reconnecting, this socket is done, so remove the lifetime ref
|
||||
}
|
||||
conn->DecRef("Connecting");
|
||||
conn->UnRef("Connecting");
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
@ -424,10 +424,10 @@ static void NotifyConnSocketDisconnect (CliFileConn * conn) {
|
||||
if (conn->AutoReconnectEnabled())
|
||||
conn->StartAutoReconnect();
|
||||
else
|
||||
conn->DecRef("Lifetime"); // if we are not reconnecting, this socket is done, so remove the lifetime ref
|
||||
conn->UnRef("Lifetime"); // if we are not reconnecting, this socket is done, so remove the lifetime ref
|
||||
}
|
||||
|
||||
conn->DecRef("Connected");
|
||||
conn->UnRef("Connected");
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
@ -552,7 +552,7 @@ static void Connect (
|
||||
conn->seq = ConnNextSequence();
|
||||
conn->lastHeardTimeMs = GetNonZeroTimeMs(); // used in connect timeout, and ping timeout
|
||||
|
||||
conn->IncRef("Lifetime");
|
||||
conn->Ref("Lifetime");
|
||||
conn->AutoReconnect();
|
||||
}
|
||||
|
||||
@ -609,7 +609,7 @@ void CliFileConn::TimerReconnect () {
|
||||
s_critsect.Leave();
|
||||
}
|
||||
else {
|
||||
IncRef("Connecting");
|
||||
Ref("Connecting");
|
||||
|
||||
// Remember the time we started the reconnect attempt, guarding against
|
||||
// TimeGetMs() returning zero (unlikely), as a value of zero indicates
|
||||
@ -654,7 +654,7 @@ void CliFileConn::AutoReconnect () {
|
||||
timerCritsect.Enter();
|
||||
{
|
||||
ASSERT(!reconnectTimer);
|
||||
IncRef("ReconnectTimer");
|
||||
Ref("ReconnectTimer");
|
||||
AsyncTimerCreate(
|
||||
&reconnectTimer,
|
||||
CliFileConnTimerReconnectProc,
|
||||
@ -668,7 +668,7 @@ void CliFileConn::AutoReconnect () {
|
||||
//===========================================================================
|
||||
static unsigned CliFileConnTimerDestroyed (void * param) {
|
||||
CliFileConn * sock = (CliFileConn *) param;
|
||||
sock->DecRef("TimerDestroyed");
|
||||
sock->UnRef("TimerDestroyed");
|
||||
return kAsyncTimeInfinite;
|
||||
}
|
||||
|
||||
@ -693,7 +693,7 @@ static unsigned CliFileConnPingTimerProc (void * param) {
|
||||
//============================================================================
|
||||
void CliFileConn::AutoPing () {
|
||||
ASSERT(!pingTimer);
|
||||
IncRef("PingTimer");
|
||||
Ref("PingTimer");
|
||||
timerCritsect.Enter();
|
||||
{
|
||||
sockLock.LockForReading();
|
||||
@ -1270,7 +1270,7 @@ bool NetFileTrans::AcquireConn () {
|
||||
//============================================================================
|
||||
void NetFileTrans::ReleaseConn () {
|
||||
if (m_conn) {
|
||||
m_conn->DecRef("AcquireConn");
|
||||
m_conn->UnRef("AcquireConn");
|
||||
m_conn = nil;
|
||||
}
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ namespace Ngl { namespace Game {
|
||||
*
|
||||
***/
|
||||
|
||||
struct CliGmConn : AtomicRef {
|
||||
struct CliGmConn : hsAtomicRefCnt {
|
||||
LINK(CliGmConn) link;
|
||||
|
||||
CCritSect critsect;
|
||||
@ -176,7 +176,7 @@ static unsigned GetNonZeroTimeMs () {
|
||||
static CliGmConn * GetConnIncRef_CS (const char tag[]) {
|
||||
if (CliGmConn * conn = s_active)
|
||||
if (conn->cli) {
|
||||
conn->IncRef(tag);
|
||||
conn->Ref(tag);
|
||||
return conn;
|
||||
}
|
||||
return nil;
|
||||
@ -205,7 +205,7 @@ static void UnlinkAndAbandonConn_CS (CliGmConn * conn) {
|
||||
AsyncSocketDisconnect(conn->sock, true);
|
||||
}
|
||||
else {
|
||||
conn->DecRef("Lifetime");
|
||||
conn->UnRef("Lifetime");
|
||||
}
|
||||
}
|
||||
|
||||
@ -260,8 +260,8 @@ static void NotifyConnSocketConnectFailed (CliGmConn * conn) {
|
||||
s_critsect.Leave();
|
||||
|
||||
NetTransCancelByConnId(conn->seq, kNetErrTimeout);
|
||||
conn->DecRef("Connecting");
|
||||
conn->DecRef("Lifetime");
|
||||
conn->UnRef("Connecting");
|
||||
conn->UnRef("Lifetime");
|
||||
|
||||
if (notify)
|
||||
ReportNetError(kNetProtocolCli2Game, kNetErrConnectFailed);
|
||||
@ -288,8 +288,8 @@ static void NotifyConnSocketDisconnect (CliGmConn * conn) {
|
||||
|
||||
// Cancel all transactions in process on this connection.
|
||||
NetTransCancelByConnId(conn->seq, kNetErrTimeout);
|
||||
conn->DecRef("Connected");
|
||||
conn->DecRef("Lifetime");
|
||||
conn->UnRef("Connected");
|
||||
conn->UnRef("Lifetime");
|
||||
|
||||
if (notify)
|
||||
ReportNetError(kNetProtocolCli2Game, kNetErrDisconnected);
|
||||
@ -361,8 +361,8 @@ static void Connect (
|
||||
conn->seq = ConnNextSequence();
|
||||
conn->lastHeardTimeMs = GetNonZeroTimeMs();
|
||||
|
||||
conn->IncRef("Lifetime");
|
||||
conn->IncRef("Connecting");
|
||||
conn->Ref("Lifetime");
|
||||
conn->Ref("Connecting");
|
||||
|
||||
s_critsect.Enter();
|
||||
{
|
||||
@ -403,7 +403,7 @@ static void Connect (
|
||||
//===========================================================================
|
||||
static unsigned CliGmConnTimerDestroyed (void * param) {
|
||||
CliGmConn * conn = (CliGmConn *) param;
|
||||
conn->DecRef("TimerDestroyed");
|
||||
conn->UnRef("TimerDestroyed");
|
||||
return kAsyncTimeInfinite;
|
||||
}
|
||||
|
||||
@ -431,7 +431,7 @@ CliGmConn::~CliGmConn () {
|
||||
//============================================================================
|
||||
void CliGmConn::AutoPing () {
|
||||
ASSERT(!pingTimer);
|
||||
IncRef("PingTimer");
|
||||
Ref("PingTimer");
|
||||
critsect.Enter();
|
||||
{
|
||||
AsyncTimerCreate(
|
||||
@ -693,7 +693,7 @@ bool NetGameTrans::AcquireConn () {
|
||||
//============================================================================
|
||||
void NetGameTrans::ReleaseConn () {
|
||||
if (m_conn) {
|
||||
m_conn->DecRef("AcquireConn");
|
||||
m_conn->UnRef("AcquireConn");
|
||||
m_conn = nil;
|
||||
}
|
||||
}
|
||||
@ -860,7 +860,7 @@ void NetCliGamePropagateBuffer (
|
||||
|
||||
conn->Send(msg, arrsize(msg));
|
||||
|
||||
conn->DecRef("PropBuffer");
|
||||
conn->UnRef("PropBuffer");
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
@ -882,5 +882,5 @@ void NetCliGameSendGameMgrMsg (GameMsgHeader * msgHdr) {
|
||||
|
||||
conn->Send(msg, arrsize(msg));
|
||||
|
||||
conn->DecRef("GameMgrMsg");
|
||||
conn->UnRef("GameMgrMsg");
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ namespace Ngl { namespace GateKeeper {
|
||||
*
|
||||
***/
|
||||
|
||||
struct CliGkConn : AtomicRef {
|
||||
struct CliGkConn : hsAtomicRefCnt {
|
||||
CliGkConn ();
|
||||
~CliGkConn ();
|
||||
|
||||
@ -208,7 +208,7 @@ static unsigned GetNonZeroTimeMs () {
|
||||
//============================================================================
|
||||
static CliGkConn * GetConnIncRef_CS (const char tag[]) {
|
||||
if (CliGkConn * conn = s_active) {
|
||||
conn->IncRef(tag);
|
||||
conn->Ref(tag);
|
||||
return conn;
|
||||
}
|
||||
return nil;
|
||||
@ -240,7 +240,7 @@ static void UnlinkAndAbandonConn_CS (CliGkConn * conn) {
|
||||
AsyncSocketDisconnect(conn->sock, true);
|
||||
}
|
||||
else {
|
||||
conn->DecRef("Lifetime");
|
||||
conn->UnRef("Lifetime");
|
||||
}
|
||||
}
|
||||
|
||||
@ -303,7 +303,7 @@ static void CheckedReconnect (CliGkConn * conn, ENetError error) {
|
||||
// Cancel all transactions in progress on this connection.
|
||||
NetTransCancelByConnId(conn->seq, kNetErrTimeout);
|
||||
// conn is dead.
|
||||
conn->DecRef("Lifetime");
|
||||
conn->UnRef("Lifetime");
|
||||
ReportNetError(kNetProtocolCli2GateKeeper, error);
|
||||
}
|
||||
else {
|
||||
@ -339,7 +339,7 @@ static void NotifyConnSocketConnectFailed (CliGkConn * conn) {
|
||||
|
||||
CheckedReconnect(conn, kNetErrConnectFailed);
|
||||
|
||||
conn->DecRef("Connecting");
|
||||
conn->UnRef("Connecting");
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
@ -359,8 +359,8 @@ static void NotifyConnSocketDisconnect (CliGkConn * conn) {
|
||||
|
||||
// Cancel all transactions in process on this connection.
|
||||
NetTransCancelByConnId(conn->seq, kNetErrTimeout);
|
||||
conn->DecRef("Connected");
|
||||
conn->DecRef("Lifetime");
|
||||
conn->UnRef("Connected");
|
||||
conn->UnRef("Lifetime");
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
@ -474,7 +474,7 @@ static void Connect (
|
||||
conn->lastHeardTimeMs = GetNonZeroTimeMs(); // used in connect timeout, and ping timeout
|
||||
strncpy(conn->name, name, arrsize(conn->name));
|
||||
|
||||
conn->IncRef("Lifetime");
|
||||
conn->Ref("Lifetime");
|
||||
conn->AutoReconnect();
|
||||
}
|
||||
|
||||
@ -507,7 +507,7 @@ static void AsyncLookupCallback (
|
||||
//===========================================================================
|
||||
static unsigned CliGkConnTimerDestroyed (void * param) {
|
||||
CliGkConn * conn = (CliGkConn *) param;
|
||||
conn->DecRef("TimerDestroyed");
|
||||
conn->UnRef("TimerDestroyed");
|
||||
return kAsyncTimeInfinite;
|
||||
}
|
||||
|
||||
@ -553,7 +553,7 @@ void CliGkConn::TimerReconnect () {
|
||||
s_critsect.Leave();
|
||||
}
|
||||
else {
|
||||
IncRef("Connecting");
|
||||
Ref("Connecting");
|
||||
|
||||
// Remember the time we started the reconnect attempt, guarding against
|
||||
// TimeGetMs() returning zero (unlikely), as a value of zero indicates
|
||||
@ -592,7 +592,7 @@ void CliGkConn::StartAutoReconnect () {
|
||||
void CliGkConn::AutoReconnect () {
|
||||
|
||||
ASSERT(!reconnectTimer);
|
||||
IncRef("ReconnectTimer");
|
||||
Ref("ReconnectTimer");
|
||||
critsect.Enter();
|
||||
{
|
||||
AsyncTimerCreate(
|
||||
@ -626,7 +626,7 @@ bool CliGkConn::AutoReconnectEnabled () {
|
||||
//============================================================================
|
||||
void CliGkConn::AutoPing () {
|
||||
ASSERT(!pingTimer);
|
||||
IncRef("PingTimer");
|
||||
Ref("PingTimer");
|
||||
critsect.Enter();
|
||||
{
|
||||
AsyncTimerCreate(
|
||||
@ -970,7 +970,7 @@ bool NetGateKeeperTrans::AcquireConn () {
|
||||
//============================================================================
|
||||
void NetGateKeeperTrans::ReleaseConn () {
|
||||
if (m_conn) {
|
||||
m_conn->DecRef("AcquireConn");
|
||||
m_conn->UnRef("AcquireConn");
|
||||
m_conn = nil;
|
||||
}
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ static NetTrans * FindTransIncRef_CS (unsigned transId, const char tag[]) {
|
||||
// There shouldn't be more than a few transactions; just do a linear scan
|
||||
for (NetTrans * trans = s_transactions.Head(); trans; trans = s_transactions.Next(trans))
|
||||
if (trans->m_transId == transId) {
|
||||
trans->IncRef(tag);
|
||||
trans->Ref(tag);
|
||||
return trans;
|
||||
}
|
||||
|
||||
@ -197,7 +197,7 @@ unsigned NetTransGetTimeoutMs () {
|
||||
|
||||
//============================================================================
|
||||
void NetTransSend (NetTrans * trans) {
|
||||
trans->IncRef("Lifetime");
|
||||
trans->Ref("Lifetime");
|
||||
s_critsect.Enter();
|
||||
{
|
||||
static unsigned s_transId;
|
||||
@ -225,7 +225,7 @@ bool NetTransRecv (unsigned transId, const uint8_t msg[], unsigned bytes) {
|
||||
if (!result)
|
||||
NetTransCancel(transId, kNetErrInternalError);
|
||||
|
||||
trans->DecRef("Recv");
|
||||
trans->UnRef("Recv");
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -345,13 +345,13 @@ void NetTransUpdate () {
|
||||
while (NetTrans * trans = completed.Head()) {
|
||||
completed.Unlink(trans);
|
||||
trans->Post();
|
||||
trans->DecRef("Lifetime");
|
||||
trans->UnRef("Lifetime");
|
||||
}
|
||||
// Post completed parent transactions
|
||||
while (NetTrans * trans = parentCompleted.Head()) {
|
||||
parentCompleted.Unlink(trans);
|
||||
trans->Post();
|
||||
trans->DecRef("Lifetime");
|
||||
trans->UnRef("Lifetime");
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user