From 09961845b46235ae7f630100297a626a8fdfc7b0 Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Sat, 5 Oct 2013 13:07:32 -0700 Subject: [PATCH] Remove obsolete AsyncService class --- Builds/VisualStudio2012/RippleD.vcxproj | 7 -- .../VisualStudio2012/RippleD.vcxproj.filters | 6 -- src/ripple_app/peers/PeerDoor.cpp | 2 +- src/ripple_app/peers/PeerDoor.h | 2 +- src/ripple_net/basics/AsyncService.cpp | 55 ---------------- src/ripple_net/basics/AsyncService.h | 66 ------------------- src/ripple_net/basics/SNTPClient.cpp | 2 +- src/ripple_net/basics/SNTPClient.h | 2 +- src/ripple_net/ripple_net.cpp | 1 - src/ripple_net/ripple_net.h | 1 - 10 files changed, 4 insertions(+), 140 deletions(-) delete mode 100644 src/ripple_net/basics/AsyncService.cpp delete mode 100644 src/ripple_net/basics/AsyncService.h diff --git a/Builds/VisualStudio2012/RippleD.vcxproj b/Builds/VisualStudio2012/RippleD.vcxproj index 783b1d0e9..3ca3b980a 100644 --- a/Builds/VisualStudio2012/RippleD.vcxproj +++ b/Builds/VisualStudio2012/RippleD.vcxproj @@ -1184,12 +1184,6 @@ - - true - true - true - true - true true @@ -1892,7 +1886,6 @@ - diff --git a/Builds/VisualStudio2012/RippleD.vcxproj.filters b/Builds/VisualStudio2012/RippleD.vcxproj.filters index 7dfd9629f..f96cb148e 100644 --- a/Builds/VisualStudio2012/RippleD.vcxproj.filters +++ b/Builds/VisualStudio2012/RippleD.vcxproj.filters @@ -909,9 +909,6 @@ [2] Old Ripple\ripple_app\main - - [2] Old Ripple\ripple_net\basics - [1] Ripple\sophia @@ -1890,9 +1887,6 @@ [2] Old Ripple\ripple_app\main - - [2] Old Ripple\ripple_net\basics - [1] Ripple\sophia diff --git a/src/ripple_app/peers/PeerDoor.cpp b/src/ripple_app/peers/PeerDoor.cpp index 85502ae8d..76886c0a1 100644 --- a/src/ripple_app/peers/PeerDoor.cpp +++ b/src/ripple_app/peers/PeerDoor.cpp @@ -132,7 +132,7 @@ private: //------------------------------------------------------------------------------ PeerDoor::PeerDoor (Stoppable& parent) - : AsyncService ("PeerDoor", parent) + : Stoppable ("PeerDoor", parent) { } diff --git a/src/ripple_app/peers/PeerDoor.h b/src/ripple_app/peers/PeerDoor.h index e537ad4b6..2629edad2 100644 --- a/src/ripple_app/peers/PeerDoor.h +++ b/src/ripple_app/peers/PeerDoor.h @@ -22,7 +22,7 @@ #define RIPPLE_PEERDOOR_H_INCLUDED /** Handles incoming connections from peers. */ -class PeerDoor : public AsyncService +class PeerDoor : public Stoppable { protected: explicit PeerDoor (Stoppable& parent); diff --git a/src/ripple_net/basics/AsyncService.cpp b/src/ripple_net/basics/AsyncService.cpp deleted file mode 100644 index 951eb484f..000000000 --- a/src/ripple_net/basics/AsyncService.cpp +++ /dev/null @@ -1,55 +0,0 @@ -//------------------------------------------------------------------------------ -/* - This file is part of rippled: https://github.com/ripple/rippled - Copyright (c) 2012, 2013 Ripple Labs Inc. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ -//============================================================================== - - -AsyncService::AsyncService (char const* name, Stoppable& parent) - : Stoppable (name, parent) -{ -} - -AsyncService::~AsyncService () -{ - // If this goes off it means the - // AsyncService API contract was violated. - // - bassert (m_pendingIo.get() == 0); -} - -void AsyncService::serviceCountIoPending () -{ - ++m_pendingIo; -} - -bool AsyncService::serviceCountIoComplete (boost::system::error_code const& ec) -{ - // If this goes off, the count is unbalanced. - bassert (m_pendingIo.get() > 0); - - --m_pendingIo; - - if (! ec || ec == boost::asio::error::operation_aborted) - return true; - - return false; -} - -void AsyncService::onServiceIoComplete () -{ - //stopped(); -} diff --git a/src/ripple_net/basics/AsyncService.h b/src/ripple_net/basics/AsyncService.h deleted file mode 100644 index fb483677f..000000000 --- a/src/ripple_net/basics/AsyncService.h +++ /dev/null @@ -1,66 +0,0 @@ -//------------------------------------------------------------------------------ -/* - This file is part of rippled: https://github.com/ripple/rippled - Copyright (c) 2012, 2013 Ripple Labs Inc. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ -//============================================================================== - - -#ifndef RIPPLE_NET_ASYNCSERVICE_H_INCLUDED -#define RIPPLE_NET_ASYNCSERVICE_H_INCLUDED - -/** Stoppable subclass that helps with managing asynchronous stopping. */ -class AsyncService : public Stoppable -{ -public: - /** Create the service with the specified name and parent. */ - AsyncService (char const* name, Stoppable& parent); - - ~AsyncService (); - - /** Increments the count of pending I/O for the service. - - This should be called every time an asynchronous initiating - function is called by the derived clas. - - Thread safety: - Safe to call from any thread at any time. - */ - void serviceCountIoPending (); - - /** Decrements the count of pending I/O for the service. - - This should be called at the very beginning of every completion - handler function in the derived class. - - Thread safety: - Safe to call from any thread at any time. - - @param The error_code of the completed asynchronous opereation. - @return `true` if the handler should return immediately. - */ - bool serviceCountIoComplete (boost::system::error_code const& ec); - - /** Called after a stop notification when all pending I/O is complete. - The default implementation calls stopped. - @see stopped - */ - virtual void onServiceIoComplete (); - -private: - Atomic m_pendingIo; -}; - -#endif diff --git a/src/ripple_net/basics/SNTPClient.cpp b/src/ripple_net/basics/SNTPClient.cpp index 07c81d993..afbcfdc80 100644 --- a/src/ripple_net/basics/SNTPClient.cpp +++ b/src/ripple_net/basics/SNTPClient.cpp @@ -360,7 +360,7 @@ private: //------------------------------------------------------------------------------ SNTPClient::SNTPClient (Stoppable& parent) - : AsyncService ("SNTPClient", parent) + : Stoppable ("SNTPClient", parent) { } diff --git a/src/ripple_net/basics/SNTPClient.h b/src/ripple_net/basics/SNTPClient.h index abb8e48a8..ce0d8e188 100644 --- a/src/ripple_net/basics/SNTPClient.h +++ b/src/ripple_net/basics/SNTPClient.h @@ -21,7 +21,7 @@ #ifndef RIPPLE_NET_BASICS_SNTPCLIENT_H_INCLUDED #define RIPPLE_NET_BASICS_SNTPCLIENT_H_INCLUDED -class SNTPClient : public AsyncService +class SNTPClient : public Stoppable { protected: explicit SNTPClient (Stoppable& parent); diff --git a/src/ripple_net/ripple_net.cpp b/src/ripple_net/ripple_net.cpp index 785b7da70..f6b41de19 100644 --- a/src/ripple_net/ripple_net.cpp +++ b/src/ripple_net/ripple_net.cpp @@ -46,7 +46,6 @@ namespace ripple { -#include "basics/AsyncService.cpp" #include "basics/HTTPRequest.cpp" #include "basics/HTTPClient.cpp" diff --git a/src/ripple_net/ripple_net.h b/src/ripple_net/ripple_net.h index e54fcdac0..e85a2eacd 100644 --- a/src/ripple_net/ripple_net.h +++ b/src/ripple_net/ripple_net.h @@ -33,7 +33,6 @@ namespace ripple { -#include "basics/AsyncService.h" #include "basics/RippleSSLContext.h" #include "basics/MultiSocket.h" #include "basics/HTTPRequest.h"