diff options
| author | Patrick Strateman <[email protected]> | 2015-08-25 15:33:29 -0700 |
|---|---|---|
| committer | Patrick Strateman <[email protected]> | 2015-08-25 15:33:29 -0700 |
| commit | 69ee1aab00b9189865dfca6fb5c33c61a3c3ea67 (patch) | |
| tree | bb01c3191c1b86126dc2e11cb45a23a54ae13914 /src/net.cpp | |
| parent | Return false early if vEvictionCandidates is empty (diff) | |
| download | discoin-69ee1aab00b9189865dfca6fb5c33c61a3c3ea67.tar.xz discoin-69ee1aab00b9189865dfca6fb5c33c61a3c3ea67.zip | |
CNodeRef copy constructor and assignment operator
Diffstat (limited to 'src/net.cpp')
| -rw-r--r-- | src/net.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/net.cpp b/src/net.cpp index 4f4c7b81c..cb5a24f0a 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -782,6 +782,22 @@ public: CNode& operator *() const {return *_pnode;}; CNode* operator ->() const {return _pnode;}; + + CNodeRef& operator =(const CNodeRef& other) + { + if (this != &other) { + _pnode->Release(); + _pnode = other._pnode; + _pnode->AddRef(); + } + return *this; + } + + CNodeRef(const CNodeRef& other): + _pnode(other._pnode) + { + _pnode->AddRef(); + } private: CNode *_pnode; }; |