Remove outputDebugString, replace getComputerName

This commit is contained in:
Mike Ellery
2018-02-27 13:23:20 -08:00
committed by seelabs
parent 9456b83576
commit deef322b07
12 changed files with 9 additions and 260 deletions

View File

@@ -1597,9 +1597,6 @@
</ClInclude>
<ClInclude Include="..\..\src\ripple\beast\core\BasicNativeHeaders.h">
</ClInclude>
<ClCompile Include="..\..\src\ripple\beast\core\bsd_SystemStats.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
<ClInclude Include="..\..\src\ripple\beast\core\ByteOrder.h">
</ClInclude>
<ClInclude Include="..\..\src\ripple\beast\core\CompilerConfig.h">
@@ -1618,9 +1615,6 @@
</ClInclude>
<ClInclude Include="..\..\src\ripple\beast\core\LexicalCast.h">
</ClInclude>
<ClCompile Include="..\..\src\ripple\beast\core\linux_SystemStats.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
<ClInclude Include="..\..\src\ripple\beast\core\List.h">
</ClInclude>
<ClInclude Include="..\..\src\ripple\beast\core\LockFreeStack.h">
@@ -1646,16 +1640,11 @@
</ClInclude>
<ClInclude Include="..\..\src\ripple\beast\core\StandardIncludes.h">
</ClInclude>
<ClInclude Include="..\..\src\ripple\beast\core\SystemStats.h">
</ClInclude>
<ClCompile Include="..\..\src\ripple\beast\core\WaitableEvent.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
<ClInclude Include="..\..\src\ripple\beast\core\WaitableEvent.h">
</ClInclude>
<ClCompile Include="..\..\src\ripple\beast\core\win32_SystemStats.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
<ClInclude Include="..\..\src\ripple\beast\crypto\detail\mac_facade.h">
</ClInclude>
<ClInclude Include="..\..\src\ripple\beast\crypto\detail\ripemd_context.h">

View File

@@ -2211,9 +2211,6 @@
<ClInclude Include="..\..\src\ripple\beast\core\BasicNativeHeaders.h">
<Filter>ripple\beast\core</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ripple\beast\core\bsd_SystemStats.cpp">
<Filter>ripple\beast\core</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ripple\beast\core\ByteOrder.h">
<Filter>ripple\beast\core</Filter>
</ClInclude>
@@ -2238,9 +2235,6 @@
<ClInclude Include="..\..\src\ripple\beast\core\LexicalCast.h">
<Filter>ripple\beast\core</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ripple\beast\core\linux_SystemStats.cpp">
<Filter>ripple\beast\core</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ripple\beast\core\List.h">
<Filter>ripple\beast\core</Filter>
</ClInclude>
@@ -2277,18 +2271,12 @@
<ClInclude Include="..\..\src\ripple\beast\core\StandardIncludes.h">
<Filter>ripple\beast\core</Filter>
</ClInclude>
<ClInclude Include="..\..\src\ripple\beast\core\SystemStats.h">
<Filter>ripple\beast\core</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ripple\beast\core\WaitableEvent.cpp">
<Filter>ripple\beast\core</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ripple\beast\core\WaitableEvent.h">
<Filter>ripple\beast\core</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ripple\beast\core\win32_SystemStats.cpp">
<Filter>ripple\beast\core</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ripple\beast\crypto\detail\mac_facade.h">
<Filter>ripple\beast\crypto\detail</Filter>
</ClInclude>

View File

@@ -53,11 +53,11 @@
#include <ripple/resource/ResourceManager.h>
#include <ripple/beast/rfc2616.h>
#include <ripple/beast/core/LexicalCast.h>
#include <ripple/beast/core/SystemStats.h>
#include <ripple/beast/utility/rngfill.h>
#include <ripple/basics/make_lock.h>
#include <beast/core/detail/base64.hpp>
#include <boost/asio/steady_timer.hpp>
#include <boost/asio/ip/host_name.hpp>
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:

View File

@@ -22,6 +22,7 @@
//==============================================================================
#include <ripple/beast/core/CurrentThreadName.h>
#include <ripple/beast/core/Config.h>
#include <boost/thread/tss.hpp>
namespace beast {
@@ -101,10 +102,8 @@ void setCurrentThreadNameImpl (std::string const& name)
#include <Foundation/NSThread.h>
#include <Foundation/NSString.h>
#import <objc/message.h>
namespace beast{
#include <ripple/beast/core/osx_ObjCHelpers.h>
}
#include <ripple/beast/core/Memory.h>
#else
#include <sys/prctl.h>

View File

@@ -1,39 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
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 <string>
#include <vector>
namespace beast
{
//==============================================================================
/** Returns the host-name of the computer. */
std::string getComputerName();
} // beast
#endif // BEAST_SYSTEMSTATS_H_INCLUDED

View File

@@ -1,40 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
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

View File

@@ -53,7 +53,6 @@
#include <ripple/beast/core/LexicalCast.h>
#include <ripple/beast/core/SystemStats.h>
#include <ripple/beast/core/SemanticVersion.h>
#if BEAST_MSVC
@@ -166,28 +165,8 @@
#include <ripple/beast/core/osx_ObjCHelpers.h>
#endif
#if BEAST_ANDROID
#include "native/android_JNIHelpers.h"
#endif
#if BEAST_MAC || BEAST_IOS
#include <ripple/beast/core/mac_SystemStats.mm>
#elif BEAST_WINDOWS
#include <ripple/beast/core/win32_SystemStats.cpp>
#elif BEAST_LINUX
#include <ripple/beast/core/linux_SystemStats.cpp>
#elif BEAST_BSD
#include <ripple/beast/core/bsd_SystemStats.cpp>
#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 <ripple/beast/core/CurrentThreadName.cpp>

View File

@@ -1,42 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
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

View File

@@ -20,6 +20,7 @@
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
//==============================================================================
#include <ripple/beast/core/Memory.h>
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

View File

@@ -1,42 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
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

View File

@@ -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 <char const*> (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,

View File

@@ -18,7 +18,6 @@
//==============================================================================
#include <ripple/beast/utility/Debug.h>
#include <ripple/beast/core/SystemStats.h>
namespace beast {