Merge #12680: Add missing virtual destructor in PeerLogicValidation

2b3ea39 Polish interfaces around PeerLogicValidation (Vasil Dimov)

Pull request description:

  Silence the following compiler warning:

  /usr/include/c++/v1/memory:2285:5: error: delete called on non-final 'PeerLogicValidation' that has
        virtual functions but non-virtual destructor [-Werror,-Wdelete-non-virtual-dtor]
      delete __ptr;
      ^
  /usr/include/c++/v1/memory:2598:7: note: in instantiation of member function
        'std::__1::default_delete<PeerLogicValidation>::operator()' requested here
        __ptr_.second()(__tmp);
        ^
  init.cpp:201:15: note: in instantiation of member function 'std::__1::unique_ptr<PeerLogicValidation,
        std::__1::default_delete<PeerLogicValidation> >::reset' requested here
      peerLogic.reset();
                ^

Tree-SHA512: 0e5ead0da2da76a5276cd45e28ddfa4b92cc7225fa154a2662aad88e7210acd17b81431c98e90a2c7be08d39f8689f1d9982cdb18297d4bb0b6195ae40c7ec17
This commit is contained in:
Wladimir J. van der Laan 2018-03-14 10:16:41 +01:00
commit c6fc665629
No known key found for this signature in database
GPG Key ID: 1E4AED62986CD25D
3 changed files with 13 additions and 1 deletions

View File

@ -469,6 +469,13 @@ public:
virtual bool SendMessages(CNode* pnode, std::atomic<bool>& interrupt) = 0; virtual bool SendMessages(CNode* pnode, std::atomic<bool>& interrupt) = 0;
virtual void InitializeNode(CNode* pnode) = 0; virtual void InitializeNode(CNode* pnode) = 0;
virtual void FinalizeNode(NodeId id, bool& update_connection_time) = 0; virtual void FinalizeNode(NodeId id, bool& update_connection_time) = 0;
protected:
/**
* Protected destructor so that instances can only be deleted by derived classes.
* If that restriction is no longer desired, this should be made public and virtual.
*/
~NetEventsInterface() = default;
}; };
enum enum

View File

@ -35,7 +35,7 @@ static constexpr int64_t EXTRA_PEER_CHECK_INTERVAL = 45;
/** Minimum time an outbound-peer-eviction candidate must be connected for, in order to evict, in seconds */ /** Minimum time an outbound-peer-eviction candidate must be connected for, in order to evict, in seconds */
static constexpr int64_t MINIMUM_CONNECT_TIME = 30; static constexpr int64_t MINIMUM_CONNECT_TIME = 30;
class PeerLogicValidation : public CValidationInterface, public NetEventsInterface { class PeerLogicValidation final : public CValidationInterface, public NetEventsInterface {
private: private:
CConnman* const connman; CConnman* const connman;

View File

@ -55,6 +55,11 @@ void SyncWithValidationInterfaceQueue();
class CValidationInterface { class CValidationInterface {
protected: protected:
/**
* Protected destructor so that instances can only be deleted by derived classes.
* If that restriction is no longer desired, this should be made public and virtual.
*/
~CValidationInterface() = default;
/** /**
* Notifies listeners of updated block chain tip * Notifies listeners of updated block chain tip
* *