diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2013-04-01 23:51:33 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2013-04-01 23:51:33 +0900 |
| commit | 26972b85359a4ab1f00545c9082a6c1b7d5a2593 (patch) | |
| tree | 37c4d9c264e6281424137af235d0cef74b448bdb /src/AbstractCommand.h | |
| parent | cf23e3e11dfc7abfd4b95c5ce200404113cbe8e8 (diff) | |
Rewrite backup connection handling
Now dedicated ConnectCommand handles connection establishment. It
checks whether connection is established or not. It also handles
backup connection. The next Command creation is abstracted using
ControlChain struct template.
Diffstat (limited to 'src/AbstractCommand.h')
| -rw-r--r-- | src/AbstractCommand.h | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/AbstractCommand.h b/src/AbstractCommand.h index d0749aa7..ac97b819 100644 --- a/src/AbstractCommand.h +++ b/src/AbstractCommand.h @@ -89,7 +89,7 @@ private: int32_t calculateMinSplitSize() const; void useFasterRequest(const SharedHandle<Request>& fasterRequest); -protected: +public: RequestGroup* getRequestGroup() const { return requestGroup_; @@ -151,9 +151,6 @@ protected: (std::vector<std::string>& addrs, const std::string& hostname, uint16_t port); void tryReserved(); - virtual bool prepareForRetry(time_t wait); - virtual void onAbort(); - virtual bool executeInternal() = 0; void setReadCheckSocket(const SharedHandle<SocketCore>& socket); void setWriteCheckSocket(const SharedHandle<SocketCore>& socket); @@ -171,6 +168,10 @@ protected: */ void setWriteCheckSocketIf(const SharedHandle<SocketCore>& socket, bool pred); + // Swaps socket_ with socket. This disables current read and write + // check. + void swapSocket(SharedHandle<SocketCore>& socket); + time_t getTimeout() const { return timeout_; @@ -221,12 +222,17 @@ protected: void checkSocketRecvBuffer(); +protected: + virtual bool prepareForRetry(time_t wait); + virtual void onAbort(); + virtual bool executeInternal() = 0; // Returns true if the derived class wants to execute // executeInternal() unconditionally virtual bool noCheck() { return false; } + public: AbstractCommand (cuid_t cuid, const SharedHandle<Request>& req, |
