From deef322b074355d604d8be9df3d57b5383da97bc Mon Sep 17 00:00:00 2001 From: Mike Ellery Date: Tue, 27 Feb 2018 13:23:20 -0800 Subject: [PATCH] Remove outputDebugString, replace getComputerName --- Builds/VisualStudio2015/RippleD.vcxproj | 11 ----- .../VisualStudio2015/RippleD.vcxproj.filters | 12 ------ src/ripple/app/misc/NetworkOPs.cpp | 6 ++- src/ripple/beast/core/CurrentThreadName.cpp | 5 +-- src/ripple/beast/core/SystemStats.h | 39 ----------------- src/ripple/beast/core/bsd_SystemStats.cpp | 40 ------------------ src/ripple/beast/core/core.unity.cpp | 21 ---------- src/ripple/beast/core/linux_SystemStats.cpp | 42 ------------------- src/ripple/beast/core/mac_SystemStats.mm | 40 +----------------- src/ripple/beast/core/win32_SystemStats.cpp | 42 ------------------- .../beast/insight/impl/StatsDCollector.cpp | 10 +---- src/ripple/beast/utility/src/beast_Debug.cpp | 1 - 12 files changed, 9 insertions(+), 260 deletions(-) delete mode 100644 src/ripple/beast/core/SystemStats.h delete mode 100644 src/ripple/beast/core/bsd_SystemStats.cpp delete mode 100644 src/ripple/beast/core/linux_SystemStats.cpp delete mode 100644 src/ripple/beast/core/win32_SystemStats.cpp diff --git a/Builds/VisualStudio2015/RippleD.vcxproj b/Builds/VisualStudio2015/RippleD.vcxproj index ca1e12db90..5a494f4047 100644 --- a/Builds/VisualStudio2015/RippleD.vcxproj +++ b/Builds/VisualStudio2015/RippleD.vcxproj @@ -1597,9 +1597,6 @@ - - True - @@ -1618,9 +1615,6 @@ - - True - @@ -1646,16 +1640,11 @@ - - True - - True - diff --git a/Builds/VisualStudio2015/RippleD.vcxproj.filters b/Builds/VisualStudio2015/RippleD.vcxproj.filters index 097a5e739d..02ec7491a8 100644 --- a/Builds/VisualStudio2015/RippleD.vcxproj.filters +++ b/Builds/VisualStudio2015/RippleD.vcxproj.filters @@ -2211,9 +2211,6 @@ ripple\beast\core - - ripple\beast\core - ripple\beast\core @@ -2238,9 +2235,6 @@ ripple\beast\core - - ripple\beast\core - ripple\beast\core @@ -2277,18 +2271,12 @@ ripple\beast\core - - ripple\beast\core - ripple\beast\core ripple\beast\core - - ripple\beast\core - ripple\beast\crypto\detail diff --git a/src/ripple/app/misc/NetworkOPs.cpp b/src/ripple/app/misc/NetworkOPs.cpp index 07a5d5c5fb..8fcd01169d 100644 --- a/src/ripple/app/misc/NetworkOPs.cpp +++ b/src/ripple/app/misc/NetworkOPs.cpp @@ -53,11 +53,11 @@ #include #include #include -#include #include #include #include #include +#include namespace ripple { @@ -627,8 +627,10 @@ NetworkOPsImp::StateAccounting::states_ = {{ std::string NetworkOPsImp::getHostId (bool forAdmin) { + static std::string const hostname = boost::asio::ip::host_name(); + if (forAdmin) - return beast::getComputerName (); + return hostname; // For non-admin uses hash the node public key into a // single RFC1751 word: diff --git a/src/ripple/beast/core/CurrentThreadName.cpp b/src/ripple/beast/core/CurrentThreadName.cpp index 6962892d9e..f3c855dda0 100644 --- a/src/ripple/beast/core/CurrentThreadName.cpp +++ b/src/ripple/beast/core/CurrentThreadName.cpp @@ -22,6 +22,7 @@ //============================================================================== #include +#include #include namespace beast { @@ -101,10 +102,8 @@ void setCurrentThreadNameImpl (std::string const& name) #include #include #import -namespace beast{ #include -} - +#include #else #include diff --git a/src/ripple/beast/core/SystemStats.h b/src/ripple/beast/core/SystemStats.h deleted file mode 100644 index 7d6e5a16d9..0000000000 --- a/src/ripple/beast/core/SystemStats.h +++ /dev/null @@ -1,39 +0,0 @@ -//------------------------------------------------------------------------------ -/* - This file is part of Beast: https://github.com/vinniefalco/Beast - Copyright 2013, Vinnie Falco - - Portions of this file are from JUCE. - Copyright (c) 2013 - Raw Material Software Ltd. - Please visit http://www.juce.com - - 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 BEAST_MODULE_CORE_SYSTEM_SYSTEMSTATS_H_INCLUDED -#define BEAST_MODULE_CORE_SYSTEM_SYSTEMSTATS_H_INCLUDED - -#include -#include - -namespace beast -{ - -//============================================================================== -/** Returns the host-name of the computer. */ -std::string getComputerName(); - -} // beast - -#endif // BEAST_SYSTEMSTATS_H_INCLUDED diff --git a/src/ripple/beast/core/bsd_SystemStats.cpp b/src/ripple/beast/core/bsd_SystemStats.cpp deleted file mode 100644 index 99ced4c636..0000000000 --- a/src/ripple/beast/core/bsd_SystemStats.cpp +++ /dev/null @@ -1,40 +0,0 @@ -//------------------------------------------------------------------------------ -/* - This file is part of Beast: https://github.com/vinniefalco/Beast - Copyright 2013, Vinnie Falco - - Portions of this file are from JUCE. - Copyright (c) 2013 - Raw Material Software Ltd. - Please visit http://www.juce.com - - 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. -*/ - -//============================================================================== - -void outputDebugString (std::string const& text) -{ - std::cerr << text << std::endl; -} - -//============================================================================== -std::string getComputerName() -{ - char name [256] = { 0 }; - if (gethostname (name, sizeof (name) - 1) == 0) - return name; - - return std::string{}; -} - -} // beast diff --git a/src/ripple/beast/core/core.unity.cpp b/src/ripple/beast/core/core.unity.cpp index 6002302b81..d2d1deb3b8 100644 --- a/src/ripple/beast/core/core.unity.cpp +++ b/src/ripple/beast/core/core.unity.cpp @@ -53,7 +53,6 @@ #include -#include #include #if BEAST_MSVC @@ -166,28 +165,8 @@ #include #endif -#if BEAST_ANDROID -#include "native/android_JNIHelpers.h" -#endif - #if BEAST_MAC || BEAST_IOS #include - -#elif BEAST_WINDOWS -#include - -#elif BEAST_LINUX -#include - -#elif BEAST_BSD -#include - -#elif BEAST_ANDROID -#include "native/android_Files.cpp" -#include "native/android_Misc.cpp" -#include "native/android_SystemStats.cpp" -#include "native/android_Threads.cpp" - #endif #include diff --git a/src/ripple/beast/core/linux_SystemStats.cpp b/src/ripple/beast/core/linux_SystemStats.cpp deleted file mode 100644 index 4814169c66..0000000000 --- a/src/ripple/beast/core/linux_SystemStats.cpp +++ /dev/null @@ -1,42 +0,0 @@ -//------------------------------------------------------------------------------ -/* - This file is part of Beast: https://github.com/vinniefalco/Beast - Copyright 2013, Vinnie Falco - - Portions of this file are from JUCE. - Copyright (c) 2013 - Raw Material Software Ltd. - Please visit http://www.juce.com - - 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. -*/ -//============================================================================== - -namespace beast -{ - -void outputDebugString (std::string const& text) -{ - std::cerr << text << std::endl; -} - -//============================================================================== -std::string getComputerName() -{ - char name [256] = { 0 }; - if (gethostname (name, sizeof (name) - 1) == 0) - return name; - - return std::string{}; -} - -} // beast diff --git a/src/ripple/beast/core/mac_SystemStats.mm b/src/ripple/beast/core/mac_SystemStats.mm index 07dbd7d4e7..e25fb9a007 100644 --- a/src/ripple/beast/core/mac_SystemStats.mm +++ b/src/ripple/beast/core/mac_SystemStats.mm @@ -20,6 +20,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ //============================================================================== +#include namespace beast { @@ -34,43 +35,4 @@ ScopedAutoReleasePool::~ScopedAutoReleasePool() [((NSAutoreleasePool*) pool) release]; } -//============================================================================== -void outputDebugString (std::string const& text) -{ - // Would prefer to use std::cerr here, but avoiding it for - // the moment, due to clang JIT linkage problems. - fputs (text.c_str (), stderr); - fputs ("\n", stderr); - fflush (stderr); -} - -//============================================================================== - -#if BEAST_MAC -struct RLimitInitialiser -{ - RLimitInitialiser() - { - rlimit lim; - getrlimit (RLIMIT_NOFILE, &lim); - lim.rlim_cur = lim.rlim_max = RLIM_INFINITY; - setrlimit (RLIMIT_NOFILE, &lim); - } -}; - -static RLimitInitialiser rLimitInitialiser; -#endif - -//============================================================================== -std::string getComputerName() -{ - // FIXME: Remove ".local" from the name - char name [256] = { 0 }; - - if (gethostname (name, sizeof (name) - 1) == 0) - return name; - - return std::string{}; -} - } // beast diff --git a/src/ripple/beast/core/win32_SystemStats.cpp b/src/ripple/beast/core/win32_SystemStats.cpp deleted file mode 100644 index 1edd41bb80..0000000000 --- a/src/ripple/beast/core/win32_SystemStats.cpp +++ /dev/null @@ -1,42 +0,0 @@ -//------------------------------------------------------------------------------ -/* - This file is part of Beast: https://github.com/vinniefalco/Beast - Copyright 2013, Vinnie Falco - - Portions of this file are from JUCE. - Copyright (c) 2013 - Raw Material Software Ltd. - Please visit http://www.juce.com - - 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. -*/ -//============================================================================== - -namespace beast -{ - -void outputDebugString (std::string const& text) -{ - OutputDebugStringA ((text + "\n").c_str ()); -} - -//============================================================================== -std::string getComputerName() -{ - char text [MAX_COMPUTERNAME_LENGTH + 2] = { 0 }; - DWORD len = MAX_COMPUTERNAME_LENGTH + 1; - if (!GetComputerNameA (text, &len)) - text[0] = 0; - return text; -} - -} // beast diff --git a/src/ripple/beast/insight/impl/StatsDCollector.cpp b/src/ripple/beast/insight/impl/StatsDCollector.cpp index bcad0d99c6..4a1ac17b04 100644 --- a/src/ripple/beast/insight/impl/StatsDCollector.cpp +++ b/src/ripple/beast/insight/impl/StatsDCollector.cpp @@ -341,15 +341,13 @@ public: { (void)buffers; #if BEAST_STATSDCOLLECTOR_TRACING_ENABLED - std::stringstream ss; for (auto const& buffer : buffers) { std::string const s (boost::asio::buffer_cast (buffer), boost::asio::buffer_size (buffer)); - ss << s; + std::cerr << s; } - //m_journal.trace << std::endl << ss.str (); - outputDebugString (ss.str ()); + std::cerr << '\n'; #endif } @@ -377,9 +375,7 @@ public: assert (! s.empty ()); if (! buffers.empty () && (size + length) > max_packet_size) { -#if BEAST_STATSDCOLLECTOR_TRACING_ENABLED log (buffers); -#endif m_socket.async_send (buffers, std::bind ( &StatsDCollectorImp::on_send, this, keepAlive, std::placeholders::_1, @@ -394,9 +390,7 @@ public: if (! buffers.empty ()) { -#if BEAST_STATSDCOLLECTOR_TRACING_ENABLED log (buffers); -#endif m_socket.async_send (buffers, std::bind ( &StatsDCollectorImp::on_send, this, keepAlive, std::placeholders::_1, diff --git a/src/ripple/beast/utility/src/beast_Debug.cpp b/src/ripple/beast/utility/src/beast_Debug.cpp index 95b69255a8..8be4b2b21e 100644 --- a/src/ripple/beast/utility/src/beast_Debug.cpp +++ b/src/ripple/beast/utility/src/beast_Debug.cpp @@ -18,7 +18,6 @@ //============================================================================== #include -#include namespace beast {