1
0
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-18 11:19:10 +00:00

Merge pnUtRef with hsRefCnt, and remove the former

This commit is contained in:
2014-04-06 00:04:22 -07:00
parent e929708a3b
commit d713a13dbe
49 changed files with 515 additions and 665 deletions

View File

@ -831,13 +831,13 @@ bool plClothingOutfit::IReadFromVault()
delete sdlDataRec;
}
}
nodes[i]->DecRef();
nodes[i]->UnRef();
}
fSynchClients = true; // set true if the next synch should be bcast
ForceUpdate(true);
rvn->DecRef();
rvn->UnRef();
return true;
}
@ -874,7 +874,7 @@ void plClothingOutfit::WriteToVault()
SDRs.Add(appearanceStateDesc->GetStateDataRecord(0));
WriteToVault(SDRs);
rvn->DecRef();
rvn->UnRef();
}
void plClothingOutfit::WriteToVault(const ARRAY(plStateDataRecord*) & SDRs)
@ -926,28 +926,28 @@ void plClothingOutfit::WriteToVault(const ARRAY(plStateDataRecord*) & SDRs)
if (nodes.Count()) {
node = nodes[0];
nodes.DeleteUnordered(0);
node->IncRef(); // REF: Work
node->DecRef(); // REF: Find
node->Ref(); // REF: Work
node->UnRef(); // REF: Find
}
else {
RelVaultNode * templateNode = new RelVaultNode;
templateNode->SetNodeType(plVault::kNodeType_SDL);
templates.Add(templateNode);
node = templateNode;
node->IncRef(); // REF: Create
node->IncRef(); // REF: Work
node->Ref(); // REF: Create
node->Ref(); // REF: Work
}
VaultSDLNode sdl(node);
sdl.SetStateDataRecord((*arr)[i], 0);
node->DecRef(); // REF: Work
node->UnRef(); // REF: Work
}
}
// Delete any leftover nodes
for (unsigned i = 0; i < nodes.Count(); ++i) {
VaultDeleteNode(nodes[i]->GetNodeId());
nodes[i]->DecRef(); // REF: Array
nodes[i]->UnRef(); // REF: Array
}
// Create actual new nodes from their templates
@ -956,13 +956,13 @@ void plClothingOutfit::WriteToVault(const ARRAY(plStateDataRecord*) & SDRs)
if (RelVaultNode * actual = VaultCreateNodeAndWaitIncRef(templates[i], &result)) {
actuals.Add(actual);
}
templates[i]->DecRef(); // REF: Create
templates[i]->UnRef(); // REF: Create
}
// Add new nodes to outfit folder
for (unsigned i = 0; i < actuals.Count(); ++i) {
VaultAddChildNodeAndWait(rvn->GetNodeId(), actuals[i]->GetNodeId(), NetCommGetPlayer()->playerInt);
actuals[i]->DecRef(); // REF: Create
actuals[i]->UnRef(); // REF: Create
}
// Cleanup morph SDRs
@ -970,7 +970,7 @@ void plClothingOutfit::WriteToVault(const ARRAY(plStateDataRecord*) & SDRs)
delete morphs[i];
}
rvn->DecRef();
rvn->UnRef();
}
// XXX HACK. DON'T USE (this function exists for the temp console command Clothing.SwapClothTexHACK)
@ -1489,7 +1489,7 @@ bool plClothingOutfit::WriteToFile(const plFileName &filename)
hsUNIXStream S;
if (!S.Open(filename, "wb")) {
rvn->DecRef();
rvn->UnRef();
return false;
}
@ -1503,9 +1503,9 @@ bool plClothingOutfit::WriteToFile(const plFileName &filename)
S.WriteLE32(sdl.GetSDLDataLength());
if (sdl.GetSDLDataLength())
S.Write(sdl.GetSDLDataLength(), sdl.GetSDLData());
nodes[i]->DecRef();
nodes[i]->UnRef();
}
rvn->DecRef();
rvn->UnRef();
S.Close();
return true;
@ -1652,7 +1652,7 @@ void plClothingMgr::AddItemsToCloset(hsTArray<plClosetItem> &items)
plClothingSDLModifier::PutSingleItemIntoSDR(&items[i], &rec);
RelVaultNode * templateNode = new RelVaultNode;
templateNode->IncRef();
templateNode->Ref();
templateNode->SetNodeType(plVault::kNodeType_SDL);
VaultSDLNode sdl(templateNode);
@ -1669,12 +1669,12 @@ void plClothingMgr::AddItemsToCloset(hsTArray<plClosetItem> &items)
actual->GetNodeId(),
NetCommGetPlayer()->playerInt
);
actual->DecRef(); // REF: Create
actual->UnRef(); // REF: Create
}
templates[i]->DecRef(); // REF: Create
templates[i]->UnRef(); // REF: Create
}
rvn->DecRef();
rvn->UnRef();
}
void plClothingMgr::GetClosetItems(hsTArray<plClosetItem> &out)
@ -1702,7 +1702,7 @@ void plClothingMgr::GetClosetItems(hsTArray<plClosetItem> &out)
}
}
rvn->DecRef();
rvn->UnRef();
}
void plClothingMgr::GetAllWithSameMesh(plClothingItem *item, hsTArray<plClothingItem*> &out)

View File

@ -865,7 +865,7 @@ void plSceneInputInterface::ILinkOffereeToAge()
VaultRegisterOwnedAgeAndWait(&link);
}
}
linkNode->DecRef();
linkNode->UnRef();
}
if (!fSpawnPoint.IsEmpty()) {

View File

@ -535,14 +535,14 @@ bool plNetLinkingMgr::IProcessVaultNotifyMsg(plVaultNotifyMsg* msg)
{
VaultAgeInfoNode accInfo(rvnInfo);
accInfo.CopyTo(cur->GetAgeInfo());
rvnInfo->DecRef();
rvnInfo->UnRef();
}
IDoLink(fDeferredLink);
fDeferredLink = nil;
return true;
cVaultLink->DecRef();
cVaultLink->UnRef();
}
return false;
@ -786,7 +786,7 @@ void plNetLinkingMgr::IPostProcessLink( void )
accInfo.SetAgeInstName(ageInstName);
accInfo.SetAgeInstUuid(ageInstGuid);
accInfo.SetOnline(true);
rvnInfo->DecRef();
rvnInfo->UnRef();
}
switch (link->GetLinkingRules()) {
@ -811,9 +811,9 @@ void plNetLinkingMgr::IPostProcessLink( void )
);
if (fldr)
fldr->DecRef();
fldr->UnRef();
if (info)
info->DecRef();
info->UnRef();
}
}
break;
@ -838,9 +838,9 @@ void plNetLinkingMgr::IPostProcessLink( void )
);
if (fldr)
fldr->DecRef();
fldr->UnRef();
if (info)
info->DecRef();
info->UnRef();
}
}
break;
@ -878,7 +878,7 @@ uint8_t plNetLinkingMgr::IPreProcessLink(void)
accInfo.SetAgeInstName(nil);
accInfo.SetAgeInstUuid(kNilUuid);
accInfo.SetOnline(false);
rvnInfo->DecRef();
rvnInfo->UnRef();
}
#else
// Update our online status
@ -890,7 +890,7 @@ uint8_t plNetLinkingMgr::IPreProcessLink(void)
accInfo.SetAgeInstName(ageInstName);
accInfo.SetAgeInstUuid(ageInstGuid);
accInfo.SetOnline(true);
rvnInfo->DecRef();
rvnInfo->UnRef();
}
#endif
@ -1035,7 +1035,7 @@ uint8_t plNetLinkingMgr::IPreProcessLink(void)
break;
}
}
linkNode->DecRef();
linkNode->UnRef();
}
}

View File

@ -278,7 +278,7 @@ static void PlayerInitCallback (
if (RelVaultNode * rvn = VaultGetOwnedAgeLinkIncRef(&info)) {
VaultAgeLinkNode acc(rvn);
acc.AddSpawnPoint(plSpawnPointInfo(kCityFerryTerminalLinkTitle, kCityFerryTerminalLinkSpawnPtName));
rvn->DecRef();
rvn->UnRef();
}
VaultProcessPlayerInbox();
@ -1126,7 +1126,7 @@ void NetCommSetActivePlayer (//--> plNetCommActivePlayerMsg
pInfo.SetOnline(false);
NetCliAuthVaultNodeSave(rvn, nil, nil);
rvn->DecRef();
rvn->UnRef();
}
VaultCull(s_player->playerInt);
@ -1324,7 +1324,7 @@ void NetCommSetCCRLevel (
if (RelVaultNode * rvnInfo = VaultGetPlayerInfoNodeIncRef()) {
VaultPlayerInfoNode pInfo(rvnInfo);
pInfo.SetCCRLevel(ccrLevel);
rvnInfo->DecRef();
rvnInfo->UnRef();
}
NetCliAuthSetCCRLevel(ccrLevel);

View File

@ -287,7 +287,7 @@ enum ENetTransState {
kTransStateComplete,
};
struct NetTrans : AtomicRef {
struct NetTrans : hsAtomicRefCnt {
LINK(NetTrans) m_link;
ENetTransState m_state;
ENetError m_result;

View File

@ -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");
}
//============================================================================

View File

@ -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;
}
}

View File

@ -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");
}

View File

@ -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;
}
}

View File

@ -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");
}
}

View File

@ -48,7 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
//
// refcntable data
//
class plNetCommonMessageData : public hsSafeRefCnt
class plNetCommonMessageData : public hsAtomicRefCnt
{
private:
char *fData; // sent

File diff suppressed because it is too large Load Diff

View File

@ -439,10 +439,10 @@ bool VaultAgeLinkNode::CopyTo (plAgeLinkStruct * link) {
if (RelVaultNode * info = me->GetChildNodeIncRef(plVault::kNodeType_AgeInfo, 1)) {
VaultAgeInfoNode access(info);
access.CopyTo(link->GetAgeInfo());
me->DecRef();
me->UnRef();
return true;
}
me->DecRef();
me->UnRef();
}
link->Clear();
return false;