Removed some std::ostringstream.

To be continued.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5108 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2012-04-18 00:00:59 +00:00
parent b2ea453804
commit 9aee68a2a9
8 changed files with 140 additions and 233 deletions

View file

@ -27,9 +27,9 @@
#include "retroshare/rsconfig.h"
#include "util/rsrandom.h"
#include "util/rsstring.h"
#include <iostream>
#include <sstream>
/**
*
@ -241,22 +241,22 @@ void PeerConnectStateBox::stateMsg(std::ostream &out, std::string msg, uint32_t
std::string PeerConnectStateBox::connectState() const
{
std::string str = StateAsString(mState);
std::ostringstream out;
time_t now = time(NULL);
out << str << "(" << mNoAttempts << "/" << mNoFailedAttempts << ") for " << now - mStateTS << " secs";
std::string out;
rs_sprintf(out, "%s(%lu/%lu) for %ld secs", str.c_str(), mNoAttempts, mNoFailedAttempts, now - mStateTS);
if ( (mState == CSB_CONNECTED) || (mState == CSB_DIRECT_ATTEMPT) ||
(mState == CSB_PROXY_ATTEMPT) || (mState == CSB_RELAY_ATTEMPT) ||
(mState == CSB_FAILED_WAIT) )
{
out << " Last Attempt: " << mAttemptLength;
rs_sprintf_append(out, " Last Attempt: %ld", mAttemptLength);
}
else
{
out << " LA: " << mAttemptLength;
out << " NextAttempt: " << mNextAttemptTS - now;
rs_sprintf_append(out, " LA: %ld", mAttemptLength);
rs_sprintf_append(out, " NextAttempt: %ld", mNextAttemptTS - now);
}
return out.str();
return out;
}

View file

@ -149,49 +149,47 @@ int p3BitDht::getNetFailedPeer(std::string peerId, PeerStatus &status)
std::string p3BitDht::getUdpAddressString()
{
std::ostringstream out;
std::string out;
struct sockaddr_in extAddr;
uint8_t extStable;
if (mDhtStunner->externalAddr(extAddr, extStable))
{
out << " DhtExtAddr: " << rs_inet_ntoa(extAddr.sin_addr);
out << ":" << ntohs(extAddr.sin_port);
rs_sprintf_append(out, " DhtExtAddr: %s:%u", rs_inet_ntoa(extAddr.sin_addr).c_str(), ntohs(extAddr.sin_port));
if (extStable)
{
out << " (Stable) ";
out += " (Stable) ";
}
else
{
out << " (Unstable) ";
out += " (Unstable) ";
}
}
else
{
out << " DhtExtAddr: Unknown ";
out += " DhtExtAddr: Unknown ";
}
if (mProxyStunner->externalAddr(extAddr, extStable))
{
out << " ProxyExtAddr: " << rs_inet_ntoa(extAddr.sin_addr);
out << ":" << ntohs(extAddr.sin_port);
rs_sprintf_append(out, " ProxyExtAddr: %s:%u", rs_inet_ntoa(extAddr.sin_addr).c_str(), ntohs(extAddr.sin_port));
if (extStable)
{
out << " (Stable) ";
out += " (Stable) ";
}
else
{
out << " (Unstable) ";
out += " (Unstable) ";
}
}
else
{
out << " ProxyExtAddr: Unknown ";
out += " ProxyExtAddr: Unknown ";
}
return out.str();
return out;
}
void p3BitDht::updateDataRates()