|
|
@ -94,7 +94,6 @@ static void CDECL LogDumpProc ( |
|
|
|
|
|
|
|
|
|
|
|
pyVaultNode::pyVaultNodeOperationCallback::pyVaultNodeOperationCallback(PyObject * cbObject) |
|
|
|
pyVaultNode::pyVaultNodeOperationCallback::pyVaultNodeOperationCallback(PyObject * cbObject) |
|
|
|
: fCbObject( cbObject ) |
|
|
|
: fCbObject( cbObject ) |
|
|
|
, fNode(nil) |
|
|
|
|
|
|
|
, fPyNodeRef(nil) |
|
|
|
, fPyNodeRef(nil) |
|
|
|
, fContext(0) |
|
|
|
, fContext(0) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -158,21 +157,16 @@ void pyVaultNode::pyVaultNodeOperationCallback::VaultOperationComplete( uint32_t |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void pyVaultNode::pyVaultNodeOperationCallback::SetNode (RelVaultNode * rvn) { |
|
|
|
void pyVaultNode::pyVaultNodeOperationCallback::SetNode (RelVaultNode * rvn) { |
|
|
|
if (rvn) |
|
|
|
fNode = rvn; |
|
|
|
rvn->Ref(); |
|
|
|
|
|
|
|
SWAP(rvn, fNode); |
|
|
|
|
|
|
|
if (rvn) |
|
|
|
|
|
|
|
rvn->UnRef(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
RelVaultNode * pyVaultNode::pyVaultNodeOperationCallback::GetNode () { |
|
|
|
hsRef<RelVaultNode> pyVaultNode::pyVaultNodeOperationCallback::GetNode() const { |
|
|
|
return fNode; |
|
|
|
return fNode; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// only for python glue, do NOT call
|
|
|
|
// only for python glue, do NOT call
|
|
|
|
pyVaultNode::pyVaultNode() |
|
|
|
pyVaultNode::pyVaultNode() |
|
|
|
: fNode(nil) |
|
|
|
: fCreateAgeName(nil) |
|
|
|
, fCreateAgeName(nil) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -181,19 +175,15 @@ pyVaultNode::pyVaultNode( RelVaultNode* nfsNode ) |
|
|
|
: fNode(nfsNode) |
|
|
|
: fNode(nfsNode) |
|
|
|
, fCreateAgeName(nil) |
|
|
|
, fCreateAgeName(nil) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (fNode) |
|
|
|
|
|
|
|
fNode->Ref("pyVaultNode"); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
pyVaultNode::~pyVaultNode() |
|
|
|
pyVaultNode::~pyVaultNode() |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (fNode) |
|
|
|
|
|
|
|
fNode->UnRef("pyVaultNode"); |
|
|
|
|
|
|
|
free(fCreateAgeName); |
|
|
|
free(fCreateAgeName); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RelVaultNode* pyVaultNode::GetNode() const |
|
|
|
hsRef<RelVaultNode> pyVaultNode::GetNode() const |
|
|
|
{ |
|
|
|
{ |
|
|
|
return fNode; |
|
|
|
return fNode; |
|
|
|
} |
|
|
|
} |
|
|
@ -202,8 +192,8 @@ RelVaultNode* pyVaultNode::GetNode() const |
|
|
|
// override the equals to operator
|
|
|
|
// override the equals to operator
|
|
|
|
bool pyVaultNode::operator==(const pyVaultNode &vaultNode) const |
|
|
|
bool pyVaultNode::operator==(const pyVaultNode &vaultNode) const |
|
|
|
{ |
|
|
|
{ |
|
|
|
RelVaultNode* ours = GetNode(); |
|
|
|
hsRef<RelVaultNode> ours = GetNode(); |
|
|
|
RelVaultNode* theirs = vaultNode.GetNode(); |
|
|
|
hsRef<RelVaultNode> theirs = vaultNode.GetNode(); |
|
|
|
if (ours == nil && theirs == nil) |
|
|
|
if (ours == nil && theirs == nil) |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
if (ours == nil || theirs == nil) |
|
|
|
if (ours == nil || theirs == nil) |
|
|
@ -418,15 +408,11 @@ PyObject* pyVaultNode::AddNode(pyVaultNode* pynode, PyObject* cbObject, uint32_t |
|
|
|
&result |
|
|
|
&result |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
if (newNode) { |
|
|
|
if (newNode) |
|
|
|
newNode->Ref(); |
|
|
|
|
|
|
|
pynode->fNode->UnRef(); |
|
|
|
|
|
|
|
pynode->fNode = newNode; |
|
|
|
pynode->fNode = newNode; |
|
|
|
} |
|
|
|
else |
|
|
|
else { |
|
|
|
|
|
|
|
hsResult = hsFail; |
|
|
|
hsResult = hsFail; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PyObject* nodeRef = cb->fPyNodeRef = pyVaultNodeRef::New(fNode, pynode->fNode); |
|
|
|
PyObject* nodeRef = cb->fPyNodeRef = pyVaultNodeRef::New(fNode, pynode->fNode); |
|
|
|
Py_INCREF(nodeRef); // The callback steals the ref, according to Eric...
|
|
|
|
Py_INCREF(nodeRef); // The callback steals the ref, according to Eric...
|
|
|
@ -530,12 +516,9 @@ void pyVaultNode::Save(PyObject* cbObject, uint32_t cbContext) |
|
|
|
// otherwise just ignore the save request since vault nodes are now auto-saved.
|
|
|
|
// otherwise just ignore the save request since vault nodes are now auto-saved.
|
|
|
|
if (!fNode->GetNodeId() && fNode->GetNodeType()) { |
|
|
|
if (!fNode->GetNodeId() && fNode->GetNodeType()) { |
|
|
|
ENetError result; |
|
|
|
ENetError result; |
|
|
|
if (hsRef<RelVaultNode> node = VaultCreateNodeAndWait(fNode, &result)) { |
|
|
|
if (hsRef<RelVaultNode> node = VaultCreateNodeAndWait(fNode, &result)) |
|
|
|
node->Ref(); |
|
|
|
|
|
|
|
fNode->UnRef(); |
|
|
|
|
|
|
|
fNode = node; |
|
|
|
fNode = node; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
pyVaultNodeOperationCallback * cb = new pyVaultNodeOperationCallback( cbObject ); |
|
|
|
pyVaultNodeOperationCallback * cb = new pyVaultNodeOperationCallback( cbObject ); |
|
|
|
cb->SetNode(fNode); |
|
|
|
cb->SetNode(fNode); |
|
|
|
cb->VaultOperationStarted( cbContext ); |
|
|
|
cb->VaultOperationStarted( cbContext ); |
|
|
@ -555,12 +538,9 @@ void pyVaultNode::ForceSave() |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (!fNode->GetNodeId() && fNode->GetNodeType()) { |
|
|
|
if (!fNode->GetNodeId() && fNode->GetNodeType()) { |
|
|
|
ENetError result; |
|
|
|
ENetError result; |
|
|
|
if (hsRef<RelVaultNode> node = VaultCreateNodeAndWait(fNode, &result)) { |
|
|
|
if (hsRef<RelVaultNode> node = VaultCreateNodeAndWait(fNode, &result)) |
|
|
|
node->Ref(); |
|
|
|
|
|
|
|
fNode->UnRef(); |
|
|
|
|
|
|
|
fNode = node; |
|
|
|
fNode = node; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
else |
|
|
|
VaultForceSaveNodeAndWait(fNode); |
|
|
|
VaultForceSaveNodeAndWait(fNode); |
|
|
|
} |
|
|
|
} |
|
|
@ -575,12 +555,9 @@ void pyVaultNode::SendTo(uint32_t destClientNodeID, PyObject* cbObject, uint32_t |
|
|
|
// If the node doesn't have an id, then use it as a template to create the node in the vault,
|
|
|
|
// If the node doesn't have an id, then use it as a template to create the node in the vault,
|
|
|
|
if (!fNode->GetNodeId() && fNode->GetNodeType()) { |
|
|
|
if (!fNode->GetNodeId() && fNode->GetNodeType()) { |
|
|
|
ENetError result; |
|
|
|
ENetError result; |
|
|
|
if (hsRef<RelVaultNode> node = VaultCreateNodeAndWait(fNode, &result)) { |
|
|
|
if (hsRef<RelVaultNode> node = VaultCreateNodeAndWait(fNode, &result)) |
|
|
|
node->Ref(); |
|
|
|
|
|
|
|
fNode->UnRef(); |
|
|
|
|
|
|
|
fNode = node; |
|
|
|
fNode = node; |
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Hack the callbacks until vault notification is in place
|
|
|
|
// Hack the callbacks until vault notification is in place
|
|
|
|
cb->VaultOperationStarted( cbContext ); |
|
|
|
cb->VaultOperationStarted( cbContext ); |
|
|
|