/* */ #ifndef _D_BT_RUNTIME_H_ #define _D_BT_RUNTIME_H_ #include "common.h" #include "SharedHandle.h" #define MIN_PEERS 40 class BtRuntime { private: int64_t uploadLengthAtStartup; int32_t port; bool halt; int32_t connections; bool _ready; public: BtRuntime(): uploadLengthAtStartup(0), port(0), halt(false), connections(0), _ready(false) {} ~BtRuntime() {} int64_t getUploadLengthAtStartup() const { return uploadLengthAtStartup; } void setUploadLengthAtStartup(int64_t length) { this->uploadLengthAtStartup = length; } void setListenPort(int32_t port) { this->port = port; } int32_t getListenPort() const { return port; } bool isHalt() const { return halt; } void setHalt(bool halt) { this->halt = halt; } int32_t getConnections() const { return connections; } void increaseConnections() { connections++; } void decreaseConnections() { connections--; } bool lessThanMinPeer() const { return connections < MIN_PEERS; } bool lessThanEqMinPeer() const { return connections <= MIN_PEERS; } bool ready() { return _ready; } void setReady(bool go) { _ready = go; } }; typedef SharedHandle BtRuntimeHandle; #endif // _D_BT_RUNTIME_H_