mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
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:
parent
b2ea453804
commit
9aee68a2a9
@ -27,9 +27,9 @@
|
|||||||
#include "retroshare/rsconfig.h"
|
#include "retroshare/rsconfig.h"
|
||||||
|
|
||||||
#include "util/rsrandom.h"
|
#include "util/rsrandom.h"
|
||||||
|
#include "util/rsstring.h"
|
||||||
|
|
||||||
#include <iostream>
|
#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 PeerConnectStateBox::connectState() const
|
||||||
{
|
{
|
||||||
std::string str = StateAsString(mState);
|
std::string str = StateAsString(mState);
|
||||||
std::ostringstream out;
|
|
||||||
time_t now = time(NULL);
|
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) ||
|
if ( (mState == CSB_CONNECTED) || (mState == CSB_DIRECT_ATTEMPT) ||
|
||||||
(mState == CSB_PROXY_ATTEMPT) || (mState == CSB_RELAY_ATTEMPT) ||
|
(mState == CSB_PROXY_ATTEMPT) || (mState == CSB_RELAY_ATTEMPT) ||
|
||||||
(mState == CSB_FAILED_WAIT) )
|
(mState == CSB_FAILED_WAIT) )
|
||||||
{
|
{
|
||||||
out << " Last Attempt: " << mAttemptLength;
|
rs_sprintf_append(out, " Last Attempt: %ld", mAttemptLength);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
out << " LA: " << mAttemptLength;
|
rs_sprintf_append(out, " LA: %ld", mAttemptLength);
|
||||||
out << " NextAttempt: " << mNextAttemptTS - now;
|
rs_sprintf_append(out, " NextAttempt: %ld", mNextAttemptTS - now);
|
||||||
}
|
}
|
||||||
|
|
||||||
return out.str();
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -149,49 +149,47 @@ int p3BitDht::getNetFailedPeer(std::string peerId, PeerStatus &status)
|
|||||||
|
|
||||||
std::string p3BitDht::getUdpAddressString()
|
std::string p3BitDht::getUdpAddressString()
|
||||||
{
|
{
|
||||||
std::ostringstream out;
|
std::string out;
|
||||||
|
|
||||||
struct sockaddr_in extAddr;
|
struct sockaddr_in extAddr;
|
||||||
uint8_t extStable;
|
uint8_t extStable;
|
||||||
|
|
||||||
if (mDhtStunner->externalAddr(extAddr, extStable))
|
if (mDhtStunner->externalAddr(extAddr, extStable))
|
||||||
{
|
{
|
||||||
out << " DhtExtAddr: " << rs_inet_ntoa(extAddr.sin_addr);
|
rs_sprintf_append(out, " DhtExtAddr: %s:%u", rs_inet_ntoa(extAddr.sin_addr).c_str(), ntohs(extAddr.sin_port));
|
||||||
out << ":" << ntohs(extAddr.sin_port);
|
|
||||||
|
|
||||||
if (extStable)
|
if (extStable)
|
||||||
{
|
{
|
||||||
out << " (Stable) ";
|
out += " (Stable) ";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
out << " (Unstable) ";
|
out += " (Unstable) ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
out << " DhtExtAddr: Unknown ";
|
out += " DhtExtAddr: Unknown ";
|
||||||
}
|
}
|
||||||
if (mProxyStunner->externalAddr(extAddr, extStable))
|
if (mProxyStunner->externalAddr(extAddr, extStable))
|
||||||
{
|
{
|
||||||
out << " ProxyExtAddr: " << rs_inet_ntoa(extAddr.sin_addr);
|
rs_sprintf_append(out, " ProxyExtAddr: %s:%u", rs_inet_ntoa(extAddr.sin_addr).c_str(), ntohs(extAddr.sin_port));
|
||||||
out << ":" << ntohs(extAddr.sin_port);
|
|
||||||
|
|
||||||
if (extStable)
|
if (extStable)
|
||||||
{
|
{
|
||||||
out << " (Stable) ";
|
out += " (Stable) ";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
out << " (Unstable) ";
|
out += " (Unstable) ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
out << " ProxyExtAddr: Unknown ";
|
out += " ProxyExtAddr: Unknown ";
|
||||||
}
|
}
|
||||||
|
|
||||||
return out.str();
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
void p3BitDht::updateDataRates()
|
void p3BitDht::updateDataRates()
|
||||||
|
@ -60,7 +60,7 @@
|
|||||||
#include "serialiser/rsconfigitems.h"
|
#include "serialiser/rsconfigitems.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h> /* for (u)sleep() */
|
#include <unistd.h> /* for (u)sleep() */
|
||||||
#include <sstream>
|
#include <sstream> // for std::istringstream
|
||||||
|
|
||||||
/******
|
/******
|
||||||
* #define CONTROL_DEBUG 1
|
* #define CONTROL_DEBUG 1
|
||||||
@ -1911,20 +1911,17 @@ bool ftController::saveList(bool &cleanup, std::list<RsItem *>& saveData)
|
|||||||
std::list<std::string>::iterator it;
|
std::list<std::string>::iterator it;
|
||||||
|
|
||||||
/* basic control parameters */
|
/* basic control parameters */
|
||||||
std::ostringstream strn ;
|
std::string s ;
|
||||||
strn << getMinPrioritizedTransfers() ;
|
rs_sprintf(s, "%lu", getMinPrioritizedTransfers()) ;
|
||||||
configMap[min_prioritized_downl_ss] = strn.str() ;
|
configMap[min_prioritized_downl_ss] = s ;
|
||||||
std::ostringstream strm ;
|
rs_sprintf(s, "%lu", getQueueSize()) ;
|
||||||
strm << getQueueSize() ;
|
configMap[active_downloads_size_ss] = s ;
|
||||||
configMap[active_downloads_size_ss] = strm.str() ;
|
|
||||||
configMap[download_dir_ss] = getDownloadDirectory();
|
configMap[download_dir_ss] = getDownloadDirectory();
|
||||||
configMap[partial_dir_ss] = getPartialsDirectory();
|
configMap[partial_dir_ss] = getPartialsDirectory();
|
||||||
configMap[default_chunk_strategy_ss] = (mDefaultChunkStrategy==FileChunksInfo::CHUNK_STRATEGY_STREAMING) ? "STREAMING" : "RANDOM";
|
configMap[default_chunk_strategy_ss] = (mDefaultChunkStrategy==FileChunksInfo::CHUNK_STRATEGY_STREAMING) ? "STREAMING" : "RANDOM";
|
||||||
|
|
||||||
std::ostringstream s ;
|
rs_sprintf(s, "%lu", RsDiscSpace::freeSpaceLimit());
|
||||||
s << RsDiscSpace::freeSpaceLimit();
|
configMap[free_space_limit_ss] = s ;
|
||||||
|
|
||||||
configMap[free_space_limit_ss] = s.str() ;
|
|
||||||
|
|
||||||
RsConfigKeyValueSet *rskv = new RsConfigKeyValueSet();
|
RsConfigKeyValueSet *rskv = new RsConfigKeyValueSet();
|
||||||
|
|
||||||
|
@ -252,20 +252,14 @@ bool ftServer::checkHash(const std::string& hash,std::string& error_string)
|
|||||||
|
|
||||||
if(hash.length() != HASH_LENGTH)
|
if(hash.length() != HASH_LENGTH)
|
||||||
{
|
{
|
||||||
std::ostringstream is ;
|
rs_sprintf(error_string, "Line too long : %u chars, %ld expected.", hash.length(), HASH_LENGTH) ;
|
||||||
is << "Line too long : " << hash.length() << " chars, " << HASH_LENGTH << " expected." ;
|
|
||||||
is.flush() ;
|
|
||||||
error_string = is.str() ;
|
|
||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(uint32_t i=0;i<hash.length();++i)
|
for(uint32_t i=0;i<hash.length();++i)
|
||||||
if(!((hash[i] > 47 && hash[i] < 58) || (hash[i] > 96 && hash[i] < 103)))
|
if(!((hash[i] > 47 && hash[i] < 58) || (hash[i] > 96 && hash[i] < 103)))
|
||||||
{
|
{
|
||||||
std::ostringstream is;
|
rs_sprintf(error_string, "unexpected char code=%d '%c'", (int)hash[i], hash[i]) ;
|
||||||
is << "unexpected char code=" << (int)hash[i] << " '" << hash[i] << "'" ;
|
|
||||||
is.flush() ;
|
|
||||||
error_string = is.str() ;
|
|
||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1042,7 +1036,6 @@ int ftServer::tick()
|
|||||||
std::cerr << "ftServer::tick() ERROR: mP3iface == NULL";
|
std::cerr << "ftServer::tick() ERROR: mP3iface == NULL";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::ostringstream out;
|
|
||||||
rslog(RSL_DEBUG_BASIC, ftserverzone,
|
rslog(RSL_DEBUG_BASIC, ftserverzone,
|
||||||
"filedexserver::tick() Invalid Interface()");
|
"filedexserver::tick() Invalid Interface()");
|
||||||
|
|
||||||
@ -1102,13 +1095,13 @@ bool ftServer::handleCacheData()
|
|||||||
|
|
||||||
#ifdef SERVER_DEBUG
|
#ifdef SERVER_DEBUG
|
||||||
std::cerr << "ftServer::handleCacheData() Recvd SearchResult (CacheResponse!)" << std::endl;
|
std::cerr << "ftServer::handleCacheData() Recvd SearchResult (CacheResponse!)" << std::endl;
|
||||||
std::ostringstream out;
|
std::string out;
|
||||||
if (i++ == i_init)
|
if (i++ == i_init)
|
||||||
{
|
{
|
||||||
out << "Recieved Search Results:" << std::endl;
|
out += "Recieved Search Results:\n";
|
||||||
}
|
}
|
||||||
ci -> print(out);
|
ci -> print_string(out);
|
||||||
rslog(RSL_DEBUG_BASIC, ftserverzone, out.str());
|
rslog(RSL_DEBUG_BASIC, ftserverzone, out);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* these go to the CacheStrapper! */
|
/* these go to the CacheStrapper! */
|
||||||
@ -1132,10 +1125,9 @@ bool ftServer::handleCacheData()
|
|||||||
{
|
{
|
||||||
#ifdef SERVER_DEBUG
|
#ifdef SERVER_DEBUG
|
||||||
/* just delete these */
|
/* just delete these */
|
||||||
std::ostringstream out;
|
std::string out = "Requested Search:\n";
|
||||||
out << "Requested Search:" << std::endl;
|
cr -> print_string(out);
|
||||||
cr -> print(out);
|
rslog(RSL_DEBUG_BASIC, ftserverzone, out);
|
||||||
rslog(RSL_DEBUG_BASIC, ftserverzone, out.str());
|
|
||||||
#endif
|
#endif
|
||||||
delete cr;
|
delete cr;
|
||||||
}
|
}
|
||||||
@ -1163,10 +1155,9 @@ bool ftServer::handleCacheData()
|
|||||||
ci -> cacheSubId = (it->second).cid.subid;
|
ci -> cacheSubId = (it->second).cid.subid;
|
||||||
|
|
||||||
#ifdef SERVER_DEBUG
|
#ifdef SERVER_DEBUG
|
||||||
std::ostringstream out2;
|
std::string out2 = "Outgoing CacheStrapper Update -> RsCacheItem:\n";
|
||||||
out2 << "Outgoing CacheStrapper Update -> RsCacheItem:" << std::endl;
|
ci -> print_string(out2);
|
||||||
ci -> print(out2);
|
std::cerr << out2 << std::endl;
|
||||||
std::cerr << out2.str() << std::endl;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//rslog(RSL_DEBUG_BASIC, ftserverzone, out2.str());
|
//rslog(RSL_DEBUG_BASIC, ftserverzone, out2.str());
|
||||||
@ -1199,13 +1190,13 @@ bool ftServer::handleFileData()
|
|||||||
{
|
{
|
||||||
#ifdef SERVER_DEBUG
|
#ifdef SERVER_DEBUG
|
||||||
std::cerr << "ftServer::handleFileData() Recvd ftFiler Request" << std::endl;
|
std::cerr << "ftServer::handleFileData() Recvd ftFiler Request" << std::endl;
|
||||||
std::ostringstream out;
|
std::string out;
|
||||||
if (i == i_init)
|
if (i == i_init)
|
||||||
{
|
{
|
||||||
out << "Incoming(Net) File Item:" << std::endl;
|
out += "Incoming(Net) File Item:\n";
|
||||||
}
|
}
|
||||||
fr -> print(out);
|
fr -> print_string(out);
|
||||||
rslog(RSL_DEBUG_BASIC, ftserverzone, out.str());
|
rslog(RSL_DEBUG_BASIC, ftserverzone, out);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
i++; /* count */
|
i++; /* count */
|
||||||
@ -1228,13 +1219,13 @@ FileInfo(ffr);
|
|||||||
std::cerr << " data: " << fd->fd.binData.bin_data;
|
std::cerr << " data: " << fd->fd.binData.bin_data;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
std::ostringstream out;
|
std::string out;
|
||||||
if (i == i_init)
|
if (i == i_init)
|
||||||
{
|
{
|
||||||
out << "Incoming(Net) File Data:" << std::endl;
|
out += "Incoming(Net) File Data:\n";
|
||||||
}
|
}
|
||||||
fd -> print(out);
|
fd -> print_string(out);
|
||||||
rslog(RSL_DEBUG_BASIC, ftserverzone, out.str());
|
rslog(RSL_DEBUG_BASIC, ftserverzone, out);
|
||||||
#endif
|
#endif
|
||||||
i++; /* count */
|
i++; /* count */
|
||||||
|
|
||||||
@ -1256,13 +1247,13 @@ FileInfo(ffr);
|
|||||||
{
|
{
|
||||||
#ifdef SERVER_DEBUG
|
#ifdef SERVER_DEBUG
|
||||||
std::cerr << "ftServer::handleFileData() Recvd ChunkMap request" << std::endl;
|
std::cerr << "ftServer::handleFileData() Recvd ChunkMap request" << std::endl;
|
||||||
std::ostringstream out;
|
std::string out;
|
||||||
if (i == i_init)
|
if (i == i_init)
|
||||||
{
|
{
|
||||||
out << "Incoming(Net) File Data:" << std::endl;
|
out += "Incoming(Net) File Data:\n";
|
||||||
}
|
}
|
||||||
fcmr -> print(out);
|
fcmr -> print_string(out);
|
||||||
rslog(RSL_DEBUG_BASIC, ftserverzone, out.str());
|
rslog(RSL_DEBUG_BASIC, ftserverzone, out);
|
||||||
#endif
|
#endif
|
||||||
i++; /* count */
|
i++; /* count */
|
||||||
|
|
||||||
@ -1277,13 +1268,13 @@ FileInfo(ffr);
|
|||||||
{
|
{
|
||||||
#ifdef SERVER_DEBUG
|
#ifdef SERVER_DEBUG
|
||||||
std::cerr << "ftServer::handleFileData() Recvd ChunkMap request" << std::endl;
|
std::cerr << "ftServer::handleFileData() Recvd ChunkMap request" << std::endl;
|
||||||
std::ostringstream out;
|
std::string out;
|
||||||
if (i == i_init)
|
if (i == i_init)
|
||||||
{
|
{
|
||||||
out << "Incoming(Net) File Data:" << std::endl;
|
out += "Incoming(Net) File Data:\n";
|
||||||
}
|
}
|
||||||
fcm -> print(out);
|
fcm -> print_string(out);
|
||||||
rslog(RSL_DEBUG_BASIC, ftserverzone, out.str());
|
rslog(RSL_DEBUG_BASIC, ftserverzone, out);
|
||||||
#endif
|
#endif
|
||||||
i++; /* count */
|
i++; /* count */
|
||||||
|
|
||||||
@ -1298,13 +1289,13 @@ FileInfo(ffr);
|
|||||||
{
|
{
|
||||||
#ifdef SERVER_DEBUG
|
#ifdef SERVER_DEBUG
|
||||||
std::cerr << "ftServer::handleFileData() Recvd ChunkMap request" << std::endl;
|
std::cerr << "ftServer::handleFileData() Recvd ChunkMap request" << std::endl;
|
||||||
std::ostringstream out;
|
std::string out;
|
||||||
if (i == i_init)
|
if (i == i_init)
|
||||||
{
|
{
|
||||||
out << "Incoming(Net) File Data:" << std::endl;
|
out += "Incoming(Net) File Data:\n";
|
||||||
}
|
}
|
||||||
fccrcmr -> print(out);
|
fccrcmr -> print_string(out);
|
||||||
rslog(RSL_DEBUG_BASIC, ftserverzone, out.str());
|
rslog(RSL_DEBUG_BASIC, ftserverzone, out);
|
||||||
#endif
|
#endif
|
||||||
i++; /* count */
|
i++; /* count */
|
||||||
|
|
||||||
@ -1319,13 +1310,13 @@ FileInfo(ffr);
|
|||||||
{
|
{
|
||||||
#ifdef SERVER_DEBUG
|
#ifdef SERVER_DEBUG
|
||||||
std::cerr << "ftServer::handleFileData() Recvd ChunkMap request" << std::endl;
|
std::cerr << "ftServer::handleFileData() Recvd ChunkMap request" << std::endl;
|
||||||
std::ostringstream out;
|
std::string out;
|
||||||
if (i == i_init)
|
if (i == i_init)
|
||||||
{
|
{
|
||||||
out << "Incoming(Net) File Data:" << std::endl;
|
out += "Incoming(Net) File Data:\n";
|
||||||
}
|
}
|
||||||
fccrcm -> print(out);
|
fccrcm -> print_string(out);
|
||||||
rslog(RSL_DEBUG_BASIC, ftserverzone, out.str());
|
rslog(RSL_DEBUG_BASIC, ftserverzone, out);
|
||||||
#endif
|
#endif
|
||||||
i++; /* count */
|
i++; /* count */
|
||||||
|
|
||||||
@ -1340,13 +1331,13 @@ FileInfo(ffr);
|
|||||||
{
|
{
|
||||||
#ifdef SERVER_DEBUG
|
#ifdef SERVER_DEBUG
|
||||||
std::cerr << "ftServer::handleFileData() Recvd ChunkMap request" << std::endl;
|
std::cerr << "ftServer::handleFileData() Recvd ChunkMap request" << std::endl;
|
||||||
std::ostringstream out;
|
std::string out;
|
||||||
if (i == i_init)
|
if (i == i_init)
|
||||||
{
|
{
|
||||||
out << "Incoming(Net) File CRC Request:" << std::endl;
|
out += "Incoming(Net) File CRC Request:\n";
|
||||||
}
|
}
|
||||||
fscrcr -> print(out);
|
fscrcr -> print_string(out);
|
||||||
rslog(RSL_DEBUG_BASIC, ftserverzone, out.str());
|
rslog(RSL_DEBUG_BASIC, ftserverzone, out);
|
||||||
#endif
|
#endif
|
||||||
i++; /* count */
|
i++; /* count */
|
||||||
|
|
||||||
@ -1361,13 +1352,13 @@ FileInfo(ffr);
|
|||||||
{
|
{
|
||||||
#ifdef SERVER_DEBUG
|
#ifdef SERVER_DEBUG
|
||||||
std::cerr << "ftServer::handleFileData() Recvd ChunkMap request" << std::endl;
|
std::cerr << "ftServer::handleFileData() Recvd ChunkMap request" << std::endl;
|
||||||
std::ostringstream out;
|
std::string out;
|
||||||
if (i == i_init)
|
if (i == i_init)
|
||||||
{
|
{
|
||||||
out << "Incoming(Net) File Data:" << std::endl;
|
out += "Incoming(Net) File Data:\n";
|
||||||
}
|
}
|
||||||
fscrc -> print(out);
|
fscrc -> print_string(out);
|
||||||
rslog(RSL_DEBUG_BASIC, ftserverzone, out.str());
|
rslog(RSL_DEBUG_BASIC, ftserverzone, out);
|
||||||
#endif
|
#endif
|
||||||
i++; /* count */
|
i++; /* count */
|
||||||
|
|
||||||
|
@ -29,7 +29,6 @@
|
|||||||
|
|
||||||
#include "tcpstream.h"
|
#include "tcpstream.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
@ -40,7 +39,7 @@
|
|||||||
|
|
||||||
/* Debugging for STATE change, and Startup SYNs */
|
/* Debugging for STATE change, and Startup SYNs */
|
||||||
#include "util/rsdebug.h"
|
#include "util/rsdebug.h"
|
||||||
|
#include "util/rsstring.h"
|
||||||
#include "util/rsrandom.h"
|
#include "util/rsrandom.h"
|
||||||
|
|
||||||
const int rstcpstreamzone = 28455;
|
const int rstcpstreamzone = 28455;
|
||||||
@ -173,10 +172,7 @@ int TcpStream::connect(const struct sockaddr_in &raddr, uint32_t conn_period)
|
|||||||
std::cerr << "TcpStream STATE -> TCP_SYN_SENT" << std::endl;
|
std::cerr << "TcpStream STATE -> TCP_SYN_SENT" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
std::ostringstream out;
|
rslog(RSL_WARNING,rstcpstreamzone,"TcpStream::state => TCP_SYN_SENT (Connect)");
|
||||||
out << "TcpStream::state => TCP_SYN_SENT";
|
|
||||||
out << " (Connect)";
|
|
||||||
rslog(RSL_WARNING,rstcpstreamzone,out.str());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tcpMtx.unlock(); /******** UNLOCK MUTEX *********/
|
tcpMtx.unlock(); /******** UNLOCK MUTEX *********/
|
||||||
@ -997,12 +993,7 @@ int TcpStream::recv_check()
|
|||||||
* for max efficiency
|
* for max efficiency
|
||||||
*/
|
*/
|
||||||
|
|
||||||
{
|
rslog(RSL_WARNING, rstcpstreamzone, "TcpStream::state => TCP_CLOSED (kNoPktTimeout)");
|
||||||
std::ostringstream out;
|
|
||||||
out << "TcpStream::state => TCP_CLOSED";
|
|
||||||
out << " (kNoPktTimeout)";
|
|
||||||
rslog(RSL_WARNING, rstcpstreamzone, out.str());
|
|
||||||
}
|
|
||||||
|
|
||||||
outStreamActive = false;
|
outStreamActive = false;
|
||||||
inStreamActive = false;
|
inStreamActive = false;
|
||||||
@ -1015,11 +1006,7 @@ int TcpStream::recv_check()
|
|||||||
int TcpStream::cleanup()
|
int TcpStream::cleanup()
|
||||||
{
|
{
|
||||||
// This shuts it all down! no matter what.
|
// This shuts it all down! no matter what.
|
||||||
{
|
rslog(RSL_WARNING, rstcpstreamzone, "TcpStream::cleanup() state = TCP_CLOSED");
|
||||||
std::ostringstream out;
|
|
||||||
out << "TcpStream::cleanup() state = TCP_CLOSED";
|
|
||||||
rslog(RSL_WARNING, rstcpstreamzone, out.str());
|
|
||||||
}
|
|
||||||
|
|
||||||
outStreamActive = false;
|
outStreamActive = false;
|
||||||
inStreamActive = false;
|
inStreamActive = false;
|
||||||
@ -1181,10 +1168,7 @@ int TcpStream::handleIncoming(TcpPacket *pkt)
|
|||||||
state = TCP_CLOSED;
|
state = TCP_CLOSED;
|
||||||
// return incoming_TimedWait(pkt);
|
// return incoming_TimedWait(pkt);
|
||||||
{
|
{
|
||||||
std::ostringstream out;
|
rslog(RSL_WARNING, rstcpstreamzone, "TcpStream::state => TCP_CLOSED (recvd TCP_TIMED_WAIT?)");
|
||||||
out << "TcpStream::state => TCP_CLOSED";
|
|
||||||
out << " (recvd TCP_TIMED_WAIT?)";
|
|
||||||
rslog(RSL_WARNING, rstcpstreamzone, out.str());
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1257,12 +1241,8 @@ int TcpStream::incoming_Closed(TcpPacket *pkt)
|
|||||||
#ifdef DEBUG_TCP_STREAM
|
#ifdef DEBUG_TCP_STREAM
|
||||||
std::cerr << "TcpStream STATE -> TCP_SYN_RCVD" << std::endl;
|
std::cerr << "TcpStream STATE -> TCP_SYN_RCVD" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
{
|
|
||||||
std::ostringstream out;
|
rslog(RSL_WARNING, rstcpstreamzone, "TcpStream::state => TCP_SYN_RECVD (recvd SYN & !ACK)");
|
||||||
out << "TcpStream::state => TCP_SYN_RECVD";
|
|
||||||
out << " (recvd SYN & !ACK)";
|
|
||||||
rslog(RSL_WARNING, rstcpstreamzone, out.str());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
delete pkt;
|
delete pkt;
|
||||||
@ -1327,12 +1307,8 @@ int TcpStream::incoming_SynSent(TcpPacket *pkt)
|
|||||||
#ifdef DEBUG_TCP_STREAM
|
#ifdef DEBUG_TCP_STREAM
|
||||||
std::cerr << "TcpStream STATE -> TCP_ESTABLISHED" << std::endl;
|
std::cerr << "TcpStream STATE -> TCP_ESTABLISHED" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
{
|
|
||||||
std::ostringstream out;
|
rslog(RSL_WARNING, rstcpstreamzone, "TcpStream::state => TCP_ESTABLISHED (recvd SUN & ACK)");
|
||||||
out << "TcpStream::state => TCP_ESTABLISHED";
|
|
||||||
out << " (recvd SUN & ACK)";
|
|
||||||
rslog(RSL_WARNING, rstcpstreamzone, out.str());
|
|
||||||
}
|
|
||||||
|
|
||||||
delete pkt;
|
delete pkt;
|
||||||
}
|
}
|
||||||
@ -1356,12 +1332,9 @@ int TcpStream::incoming_SynRcvd(TcpPacket *pkt)
|
|||||||
#ifdef DEBUG_TCP_STREAM
|
#ifdef DEBUG_TCP_STREAM
|
||||||
std::cerr << "TcpStream STATE -> TCP_CLOSED" << std::endl;
|
std::cerr << "TcpStream STATE -> TCP_CLOSED" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
{
|
|
||||||
std::ostringstream out;
|
rslog(RSL_WARNING, rstcpstreamzone, "TcpStream::state => TCP_CLOSED (recvd RST)");
|
||||||
out << "TcpStream::state => TCP_CLOSED";
|
|
||||||
out << " (recvd RST)";
|
|
||||||
rslog(RSL_WARNING, rstcpstreamzone, out.str());
|
|
||||||
}
|
|
||||||
delete pkt;
|
delete pkt;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -1426,13 +1399,8 @@ int TcpStream::incoming_SynRcvd(TcpPacket *pkt)
|
|||||||
#ifdef DEBUG_TCP_STREAM
|
#ifdef DEBUG_TCP_STREAM
|
||||||
std::cerr << "TcpStream STATE -> TCP_ESTABLISHED" << std::endl;
|
std::cerr << "TcpStream STATE -> TCP_ESTABLISHED" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
{
|
|
||||||
std::ostringstream out;
|
|
||||||
out << "TcpStream::state => TCP_ESTABLISHED";
|
|
||||||
out << " (have SYN, recvd ACK)";
|
|
||||||
rslog(RSL_WARNING, rstcpstreamzone, out.str());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
rslog(RSL_WARNING, rstcpstreamzone, "TcpStream::state => TCP_ESTABLISHED (have SYN, recvd ACK)");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ackWithData)
|
if (ackWithData)
|
||||||
@ -1735,12 +1703,8 @@ int TcpStream::check_InPkts()
|
|||||||
std::cerr << "TcpStream::state = TCP_CLOSE_WAIT";
|
std::cerr << "TcpStream::state = TCP_CLOSE_WAIT";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
#endif
|
#endif
|
||||||
{
|
|
||||||
std::ostringstream out;
|
rslog(RSL_WARNING, rstcpstreamzone, "TcpStream::state => TCP_CLOSE_WAIT (recvd FIN)");
|
||||||
out << "TcpStream::state => TCP_CLOSE_WAIT";
|
|
||||||
out << " (recvd FIN)";
|
|
||||||
rslog(RSL_WARNING, rstcpstreamzone, out.str());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (state == TCP_FIN_WAIT_1)
|
else if (state == TCP_FIN_WAIT_1)
|
||||||
{
|
{
|
||||||
@ -1749,12 +1713,8 @@ int TcpStream::check_InPkts()
|
|||||||
std::cerr << "TcpStream::state = TCP_CLOSING";
|
std::cerr << "TcpStream::state = TCP_CLOSING";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
#endif
|
#endif
|
||||||
{
|
|
||||||
std::ostringstream out;
|
rslog(RSL_WARNING, rstcpstreamzone, "TcpStream::state => TCP_CLOSING (FIN_WAIT_1, recvd FIN)");
|
||||||
out << "TcpStream::state => TCP_CLOSING";
|
|
||||||
out << " (FIN_WAIT_1, recvd FIN)";
|
|
||||||
rslog(RSL_WARNING, rstcpstreamzone, out.str());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (state == TCP_FIN_WAIT_2)
|
else if (state == TCP_FIN_WAIT_2)
|
||||||
{
|
{
|
||||||
@ -1763,12 +1723,9 @@ int TcpStream::check_InPkts()
|
|||||||
std::cerr << "TcpStream::state = TCP_TIMED_WAIT";
|
std::cerr << "TcpStream::state = TCP_TIMED_WAIT";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
#endif
|
#endif
|
||||||
{
|
|
||||||
std::ostringstream out;
|
rslog(RSL_WARNING, rstcpstreamzone, "TcpStream::state => TCP_TIMED_WAIT (FIN_WAIT_2, recvd FIN)");
|
||||||
out << "TcpStream::state => TCP_TIMED_WAIT";
|
|
||||||
out << " (FIN_WAIT_2, recvd FIN)";
|
|
||||||
rslog(RSL_WARNING, rstcpstreamzone, out.str());
|
|
||||||
}
|
|
||||||
cleanup();
|
cleanup();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1784,12 +1741,8 @@ int TcpStream::check_InPkts()
|
|||||||
std::cerr << "TcpStream::state = TCP_FIN_WAIT_2";
|
std::cerr << "TcpStream::state = TCP_FIN_WAIT_2";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
#endif
|
#endif
|
||||||
{
|
|
||||||
std::ostringstream out;
|
rslog(RSL_WARNING, rstcpstreamzone, "TcpStream::state => TCP_FIN_WAIT_2 (FIN_WAIT_1, recvd ACK)");
|
||||||
out << "TcpStream::state => TCP_FIN_WAIT_2";
|
|
||||||
out << " (FIN_WAIT_1, recvd ACK)";
|
|
||||||
rslog(RSL_WARNING, rstcpstreamzone, out.str());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (state == TCP_LAST_ACK)
|
else if (state == TCP_LAST_ACK)
|
||||||
{
|
{
|
||||||
@ -1798,12 +1751,9 @@ int TcpStream::check_InPkts()
|
|||||||
std::cerr << "TcpStream::state = TCP_CLOSED";
|
std::cerr << "TcpStream::state = TCP_CLOSED";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
#endif
|
#endif
|
||||||
{
|
|
||||||
std::ostringstream out;
|
rslog(RSL_WARNING, rstcpstreamzone, "TcpStream::state => TCP_CLOSED (LAST_ACK, recvd ACK)");
|
||||||
out << "TcpStream::state => TCP_CLOSED";
|
|
||||||
out << " (LAST_ACK, recvd ACK)";
|
|
||||||
rslog(RSL_WARNING, rstcpstreamzone, out.str());
|
|
||||||
}
|
|
||||||
cleanup();
|
cleanup();
|
||||||
}
|
}
|
||||||
else if (state == TCP_CLOSING)
|
else if (state == TCP_CLOSING)
|
||||||
@ -1813,12 +1763,9 @@ int TcpStream::check_InPkts()
|
|||||||
std::cerr << "TcpStream::state = TCP_TIMED_WAIT";
|
std::cerr << "TcpStream::state = TCP_TIMED_WAIT";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
#endif
|
#endif
|
||||||
{
|
|
||||||
std::ostringstream out;
|
rslog(RSL_WARNING, rstcpstreamzone, "TcpStream::state => TCP_TIMED_WAIT (TCP_CLOSING, recvd ACK)");
|
||||||
out << "TcpStream::state => TCP_TIMED_WAIT";
|
|
||||||
out << " (TCP_CLOSING, recvd ACK)";
|
|
||||||
rslog(RSL_WARNING, rstcpstreamzone, out.str());
|
|
||||||
}
|
|
||||||
cleanup();
|
cleanup();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2089,12 +2036,10 @@ int TcpStream::retrans()
|
|||||||
setTTL(getTTL() + 1);
|
setTTL(getTTL() + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ostringstream out;
|
std::string out;
|
||||||
out << "TcpStream::retrans() Startup SYNs ";
|
rs_sprintf(out, "TcpStream::retrans() Startup SYNs retrans count: %u New TTL: %d", pkt->retrans, getTTL());
|
||||||
out << "retrans count: " << pkt->retrans;
|
|
||||||
out << " New TTL: " << getTTL();
|
|
||||||
|
|
||||||
rslog(RSL_WARNING, rstcpstreamzone, out.str());
|
rslog(RSL_WARNING, rstcpstreamzone, out);
|
||||||
|
|
||||||
#ifdef DEBUG_TCP_STREAM
|
#ifdef DEBUG_TCP_STREAM
|
||||||
std::cerr << out.str() << std::endl;
|
std::cerr << out.str() << std::endl;
|
||||||
@ -2128,12 +2073,8 @@ int TcpStream::retrans()
|
|||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
{
|
|
||||||
std::ostringstream out;
|
rslog(RSL_WARNING,rstcpstreamzone,"TcpStream::state => TCP_CLOSED (Too Many Retransmits)");
|
||||||
out << "TcpStream::state => TCP_CLOSED";
|
|
||||||
out << " (Too Many Retransmits)";
|
|
||||||
rslog(RSL_WARNING,rstcpstreamzone,out.str());
|
|
||||||
}
|
|
||||||
|
|
||||||
outStreamActive = false;
|
outStreamActive = false;
|
||||||
inStreamActive = false;
|
inStreamActive = false;
|
||||||
@ -2461,12 +2402,8 @@ int TcpStream::send()
|
|||||||
std::cerr << "TcpStream::state = TCP_FIN_WAIT_1";
|
std::cerr << "TcpStream::state = TCP_FIN_WAIT_1";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
#endif
|
#endif
|
||||||
{
|
|
||||||
std::ostringstream out;
|
rslog(RSL_WARNING, rstcpstreamzone, "TcpStream::state => TCP_FIN_WAIT_1 (End of Stream)");
|
||||||
out << "TcpStream::state => TCP_FIN_WAIT_1";
|
|
||||||
out << " (End of Stream)";
|
|
||||||
rslog(RSL_WARNING, rstcpstreamzone, out.str());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (state == TCP_CLOSE_WAIT)
|
else if (state == TCP_CLOSE_WAIT)
|
||||||
{
|
{
|
||||||
@ -2475,12 +2412,8 @@ int TcpStream::send()
|
|||||||
std::cerr << "TcpStream::state = TCP_LAST_ACK";
|
std::cerr << "TcpStream::state = TCP_LAST_ACK";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
#endif
|
#endif
|
||||||
{
|
|
||||||
std::ostringstream out;
|
rslog(RSL_WARNING, rstcpstreamzone, "TcpStream::state => TCP_LAST_ACK (CLOSE_WAIT, End of Stream)");
|
||||||
out << "TcpStream::state => TCP_LAST_ACK";
|
|
||||||
out << " (CLOSE_WAIT, End of Stream)";
|
|
||||||
rslog(RSL_WARNING, rstcpstreamzone, out.str());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
#ifdef DEBUG_UDP_RELAY
|
#ifdef DEBUG_UDP_RELAY
|
||||||
// DEBUG FUNCTION
|
// DEBUG FUNCTION
|
||||||
#include <sstream>
|
#include "util/rsstring.h"
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
int displayUdpRelayPacketHeader(const void *data, const int size);
|
int displayUdpRelayPacketHeader(const void *data, const int size);
|
||||||
#endif
|
#endif
|
||||||
@ -888,19 +888,19 @@ int displayUdpRelayPacketHeader(const void *data, const int size)
|
|||||||
dsize = size;
|
dsize = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ostringstream out;
|
std::string out;
|
||||||
for(int i = 0; i < dsize; i++)
|
for(int i = 0; i < dsize; i++)
|
||||||
{
|
{
|
||||||
if ((i > 0) && (i % 16 == 0))
|
if ((i > 0) && (i % 16 == 0))
|
||||||
{
|
{
|
||||||
out << std::endl;
|
out += "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
out << std::setw(2) << std::setfill('0') << std::hex << (uint32_t) ((uint8_t*) data)[i];
|
rs_sprintf_append(out, "%02x", (uint32_t) ((uint8_t*) data)[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cerr << "displayUdpRelayPacketHeader()" << std::endl;
|
std::cerr << "displayUdpRelayPacketHeader()" << std::endl;
|
||||||
std::cerr << out.str();
|
std::cerr << out;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -25,10 +25,10 @@
|
|||||||
|
|
||||||
#include "tcponudp/udpstunner.h"
|
#include "tcponudp/udpstunner.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
|
||||||
|
|
||||||
#include "util/rsrandom.h"
|
#include "util/rsrandom.h"
|
||||||
#include "util/rsprint.h"
|
#include "util/rsprint.h"
|
||||||
|
#include "util/rsstring.h"
|
||||||
|
|
||||||
static const int STUN_TTL = 64;
|
static const int STUN_TTL = 64;
|
||||||
|
|
||||||
@ -117,7 +117,7 @@ int UdpStunner::grabExclusiveMode(std::string holder) /* returns seconds since
|
|||||||
|
|
||||||
|
|
||||||
#ifdef DEBUG_UDP_STUNNER_FILTER
|
#ifdef DEBUG_UDP_STUNNER_FILTER
|
||||||
std::cerr << "UdpStunner::grabExclusiveMode();"
|
std::cerr << "UdpStunner::grabExclusiveMode()";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -464,14 +464,12 @@ int UdpStunner::doStun(struct sockaddr_in stun_addr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_UDP_STUNNER
|
#ifdef DEBUG_UDP_STUNNER
|
||||||
std::ostringstream out;
|
std::string out;
|
||||||
out << "UdpStunner::doStun() Sent Stun Packet(" << sentlen << ") ";
|
rs_sprintf(out, "UdpStunner::doStun() Sent Stun Packet(%d) to:%s:%u", sentlen, rs_inet_ntoa(stun_addr.sin_addr).c_str(), ntohs(stun_addr.sin_port));
|
||||||
out << " to:";
|
|
||||||
out << inet_ntoa(stun_addr.sin_addr) << ":" << ntohs(stun_addr.sin_port);
|
|
||||||
|
|
||||||
std::cerr << out.str() << std::endl;
|
std::cerr << out << std::endl;
|
||||||
|
|
||||||
//pqioutput(PQL_ALERT, pqistunzone, out.str());
|
//pqioutput(PQL_ALERT, pqistunzone, out);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@ -504,10 +502,9 @@ bool UdpStun_response(void *stun_pkt, int size, struct sockaddr_in &addr)
|
|||||||
|
|
||||||
|
|
||||||
#ifdef DEBUG_UDP_STUNNER_FILTER
|
#ifdef DEBUG_UDP_STUNNER_FILTER
|
||||||
std::ostringstream out;
|
std::string out;
|
||||||
out << "UdpStunner::response() Recvd a Stun Response, ext_addr: ";
|
rs_sprintf(out, "UdpStunner::response() Recvd a Stun Response, ext_addr: %s:%u", rs_inet_ntoa(addr.sin_addr).c_str(), ntohs(addr.sin_port));
|
||||||
out << inet_ntoa(addr.sin_addr) << ":" << ntohs(addr.sin_port);
|
std::cerr << out << std::endl;
|
||||||
std::cerr << out.str() << std::endl;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -909,13 +906,11 @@ bool UdpStunner::attemptStun()
|
|||||||
bool UdpStunner::locked_recvdStun(const struct sockaddr_in &remote, const struct sockaddr_in &extaddr)
|
bool UdpStunner::locked_recvdStun(const struct sockaddr_in &remote, const struct sockaddr_in &extaddr)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_UDP_STUNNER
|
#ifdef DEBUG_UDP_STUNNER
|
||||||
std::ostringstream out;
|
std::string out;
|
||||||
out << "UdpStunner::locked_recvdStun() from:";
|
rs_sprintf(out, "UdpStunner::locked_recvdStun() from:%s:%u", rs_inet_ntoa(remote.sin_addr).c_str(), ntohs(remote.sin_port));
|
||||||
out << inet_ntoa(remote.sin_addr) << ":" << ntohs(remote.sin_port);
|
rs_sprintf_append(out, " claiming ExtAddr is:%s:%u", rs_inet_ntoa(extaddr.sin_addr).c_str(), ntohs(extaddr.sin_port));
|
||||||
out << " claiming ExtAddr is:";
|
|
||||||
out << inet_ntoa(extaddr.sin_addr) << ":" << ntohs(extaddr.sin_port);
|
|
||||||
|
|
||||||
std::cerr << out.str() << std::endl;
|
std::cerr << out << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef UDPSTUN_ALLOW_LOCALNET
|
#ifdef UDPSTUN_ALLOW_LOCALNET
|
||||||
@ -1016,9 +1011,8 @@ bool UdpStunner::locked_recvdStun(const struct sockaddr_in &remote, const str
|
|||||||
bool UdpStunner::locked_checkExternalAddress()
|
bool UdpStunner::locked_checkExternalAddress()
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_UDP_STUNNER
|
#ifdef DEBUG_UDP_STUNNER
|
||||||
std::ostringstream out;
|
std::string out = "UdpStunner::locked_checkExternalAddress()";
|
||||||
out << "UdpStunner::locked_checkExternalAddress()";
|
std::cerr << out << std::endl;
|
||||||
std::cerr << out.str() << std::endl;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool found1 = false;
|
bool found1 = false;
|
||||||
@ -1128,28 +1122,25 @@ bool UdpStunner::locked_checkExternalAddress()
|
|||||||
bool UdpStunner::locked_printStunList()
|
bool UdpStunner::locked_printStunList()
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_UDP_STUNNER
|
#ifdef DEBUG_UDP_STUNNER
|
||||||
std::ostringstream out;
|
std::string out = "locked_printStunList()\n";
|
||||||
|
|
||||||
time_t now = time(NULL);
|
time_t now = time(NULL);
|
||||||
out << "locked_printStunList()" << std::endl;
|
rs_sprintf_append(out, "\tLastSendStun: %ld\n", now - mStunLastSendStun);
|
||||||
out << "\tLastSendStun: " << now - mStunLastSendStun << std::endl;
|
rs_sprintf_append(out, "\tLastSendAny: %ld\n", now - mStunLastSendAny);
|
||||||
out << "\tLastSendAny: " << now - mStunLastSendAny << std::endl;
|
rs_sprintf_append(out, "\tLastRecvResp: %ld\n", now - mStunLastRecvResp);
|
||||||
out << "\tLastRecvResp: " << now - mStunLastRecvResp << std::endl;
|
rs_sprintf_append(out, "\tLastRecvAny: %ld\n", now - mStunLastRecvAny);
|
||||||
out << "\tLastRecvAny: " << now - mStunLastRecvAny << std::endl;
|
|
||||||
|
|
||||||
std::list<TouStunPeer>::iterator it;
|
std::list<TouStunPeer>::iterator it;
|
||||||
for(it = mStunList.begin(); it != mStunList.end(); it++)
|
for(it = mStunList.begin(); it != mStunList.end(); it++)
|
||||||
{
|
{
|
||||||
out << "id:" << RsUtil::BinToHex(it->id) << " addr: " << inet_ntoa(it->remote.sin_addr);
|
out += "id:" + RsUtil::BinToHex(it->id);
|
||||||
out << ":" << htons(it->remote.sin_port);
|
rs_sprintf_append(out, " addr: %s:%u", rs_inet_ntoa(it->remote.sin_addr).c_str(), htons(it->remote.sin_port));
|
||||||
out << " eaddr: " << inet_ntoa(it->eaddr.sin_addr);
|
rs_sprintf_append(out, " eaddr: %s:%u", rs_inet_ntoa(it->eaddr.sin_addr).c_str(), htons(it->eaddr.sin_port));
|
||||||
out << ":" << htons(it->eaddr.sin_port);
|
rs_sprintf_append(out, " failCount: %lu", it->failCount);
|
||||||
out << " failCount: " << it->failCount;
|
rs_sprintf_append(out, " lastSend: %ld\n", now - it->lastsend);
|
||||||
out << " lastSend: " << now - it->lastsend;
|
|
||||||
out << std::endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cerr << out.str();
|
std::cerr << out;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -71,9 +71,6 @@ bool isLoopbackNet(const struct in_addr *addr);
|
|||||||
bool isPrivateNet(const struct in_addr *addr);
|
bool isPrivateNet(const struct in_addr *addr);
|
||||||
bool isExternalNet(const struct in_addr *addr);
|
bool isExternalNet(const struct in_addr *addr);
|
||||||
|
|
||||||
/* convert addresses */
|
|
||||||
bool getIPAddressFromString (const char *addr_str, struct in_addr *addr);
|
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream& o,const struct sockaddr_in&) ;
|
std::ostream& operator<<(std::ostream& o,const struct sockaddr_in&) ;
|
||||||
|
|
||||||
/* thread-safe version of inet_ntoa */
|
/* thread-safe version of inet_ntoa */
|
||||||
|
Loading…
Reference in New Issue
Block a user