Delete CUtlString and CUtlStringBuilder, use std::string everywhere.

This commit is contained in:
Fletcher Dunn
2018-04-02 12:51:24 -07:00
parent 3b08948e63
commit dc6fcbc2cf
13 changed files with 125 additions and 3158 deletions
@@ -161,9 +161,8 @@ public:
/// Set a name for the connection, used mostly for debugging
virtual void SetConnectionName( HSteamNetConnection hPeer, const char *pszName ) = 0;
/// Fetch connection user data. Returns -1 if handle is invalid
/// or if you haven't set any userdata on the connection.
virtual void GetConnectionName( HSteamNetConnection hPeer, char *ppszName, int nMaxLen ) = 0;
/// Fetch connection name. Returns false if handle is invalid
virtual bool GetConnectionName( HSteamNetConnection hPeer, char *pszName, int nMaxLen ) = 0;
/// Send a message to the remote host on the connected socket.
///
-1
View File
@@ -119,7 +119,6 @@ sources = [
'tier1/netadr.cpp',
'tier1/utlbuffer.cpp',
'tier1/utlmemory.cpp',
'tier1/utlstring.cpp',
'vstdlib/strtools.cpp',
]
+6 -6
View File
@@ -17,7 +17,7 @@
#include "tier1/utlmemory.h"
#include "tier0/validator.h"
#include <stdarg.h>
#include "tier1/utlstring.h"
//SDR_PUBLIC #include "tier1/utlstring.h"
//-----------------------------------------------------------------------------
// Description of character conversions for string output
@@ -292,7 +292,7 @@ public:
// Returns the base as a const char*, only valid in text mode.
const char *String() const;
// Copies the content of the buffer into a string (valid for binary and text mode).
void CopyToString( CUtlString &strText ) const;
//SDR_PUBLIC void CopyToString( CUtlString &strText ) const;
// memory allocation size, does *not* reflect size written or read,
// use TellPut or TellGet for that
@@ -747,10 +747,10 @@ inline const char *CUtlBuffer::String() const
return "";
}
inline void CUtlBuffer::CopyToString( CUtlString &strText ) const
{
strText.SetDirect( (const char *)Base(), TellMaxPut() );
}
//SDR_PUBLIC inline void CUtlBuffer::CopyToString( CUtlString &strText ) const
//SDR_PUBLIC {
//SDR_PUBLIC strText.SetDirect( (const char *)Base(), TellMaxPut() );
//SDR_PUBLIC }
inline int CUtlBuffer::Size() const // FIXME delete soon
+14 -14
View File
@@ -15,7 +15,7 @@
#include "tier0/dbg.h"
#include "tier1/bitstring.h"
#include "tier1/generichash.h"
#include "tier1/utlstring.h"
//SDR_PUBLIC #include "tier1/utlstring.h"
#include "tier1/utliterator.h"
#include "tier1/utlvector.h"
@@ -81,19 +81,19 @@ public:
inline bool operator!() const { return false; }
};
// Specialization to compare char * AS strings
template <>
class CDefEquals < CUtlString >
{
public:
CDefEquals() {}
CDefEquals( int i ) {}
inline bool operator()( CUtlString lhs, CUtlString rhs ) const
{
return (V_strcmp( lhs.String(), rhs.String() ) == 0);
}
inline bool operator!() const { return false; }
};
//SDR_PUBLIC // Specialization to compare char * AS strings
//SDR_PUBLIC template <>
//SDR_PUBLIC class CDefEquals < CUtlString >
//SDR_PUBLIC {
//SDR_PUBLIC public:
//SDR_PUBLIC CDefEquals() {}
//SDR_PUBLIC CDefEquals( int i ) {}
//SDR_PUBLIC inline bool operator()( CUtlString lhs, CUtlString rhs ) const
//SDR_PUBLIC {
//SDR_PUBLIC return (V_strcmp( lhs.String(), rhs.String() ) == 0);
//SDR_PUBLIC }
//SDR_PUBLIC inline bool operator!() const { return false; }
//SDR_PUBLIC };
//-----------------------------------------------------------------------------
// Purpose: Case insensitive const char * comparison
File diff suppressed because it is too large Load Diff
@@ -11,7 +11,6 @@
#include "../steamnetworkingsockets_internal.h"
#include "crypto.h"
#include "keypair.h"
#include <tier1/utlstring.h>
#include <vstdlib/random.h>
//#include "curl/curl.h"
@@ -116,21 +115,23 @@ void GenKeyPair()
DbgVerify( nKeyID != 0 );
// Generate the key comment
CUtlStringBuilder szComment;
std::string sComment;
for ( uint32 id: s_vecDataCenterIDs )
{
char szTemp[ 8 ];
GetSteamNetworkingLocationPOPStringFromID( id, szTemp );
szComment.AppendFormat( "%s-", szTemp );
sComment += szTemp;
sComment += '-';
}
// AppID?
szComment.AppendFormat( "ID%llu", nKeyID );
// Key ID
sComment += "ID";
sComment += nKeyID;
uint32 cbText = 0;
char text[ 16000 ];
DbgVerify( s_keyCertPub.GetAsOpenSSHAuthorizedKeys( text, sizeof(text), &cbText, szComment.String() ) );
DbgVerify( s_keyCertPub.GetAsOpenSSHAuthorizedKeys( text, sizeof(text), &cbText, sComment.c_str() ) );
Msg( "\nPublic key:\n" );
Msg( "%s\n", text );
@@ -156,8 +157,10 @@ void GenKeyPair()
static const char k_szSDRCertPEMHeader[] = "-----BEGIN STEAMDATAGRAM CERT-----";
static const char k_szSDRCertPEMFooter[] = "-----END STEAMDATAGRAM CERT-----";
void PrintCertInfo( const CMsgSteamDatagramCertificateSigned &msgSigned, CUtlStringBuilder &buf, const char *pszJSONIndent )
void PrintCertInfo( const CMsgSteamDatagramCertificateSigned &msgSigned, std::string &sOutResult, const char *pszJSONIndent )
{
char szTemp[ 256 ];
CMsgSteamDatagramCertificate msgCert;
msgCert.ParseFromString( msgSigned.cert() );
@@ -175,45 +178,58 @@ void PrintCertInfo( const CMsgSteamDatagramCertificateSigned &msgSigned, CUtlStr
Plat_ctime( &timeExpiry, szTimeExpiry, sizeof(szTimeExpiry) );
V_StripTrailingWhitespaceASCII( szTimeExpiry );
CUtlString sDataCenterIDs;
std::string sDataCenterIDs;
for ( uint32 id: msgCert.gameserver_datacenter_ids() )
{
char szTemp[ 8 ];
GetSteamNetworkingLocationPOPStringFromID( id, szTemp );
if ( pszJSONIndent )
{
if ( !sDataCenterIDs.IsEmpty() )
sDataCenterIDs.AppendChar( ',' );
sDataCenterIDs.AppendChar( '\"' );
sDataCenterIDs.Append( szTemp );
sDataCenterIDs.AppendChar( '\"' );
if ( !sDataCenterIDs.empty() )
sDataCenterIDs += ',';
sDataCenterIDs += '\"';
sDataCenterIDs += szTemp;
sDataCenterIDs += '\"';
}
else
{
if ( !sDataCenterIDs.IsEmpty() )
sDataCenterIDs.AppendChar( ' ' );
sDataCenterIDs.Append( szTemp );
if ( !sDataCenterIDs.empty() )
sDataCenterIDs += ' ';
sDataCenterIDs += szTemp;
}
}
if ( pszJSONIndent )
{
buf.AppendFormat( "%s\"key_id\": %llu,\n", pszJSONIndent, CalculatePublicKeyID( pubKey ) );
if ( !sDataCenterIDs.IsEmpty() )
buf.AppendFormat( "%s\"data_centers\": [ %s ],\n", pszJSONIndent, sDataCenterIDs.String() );
buf.AppendFormat( "%s\"created\": \"%s\",\n", pszJSONIndent, szTimeCreated );
buf.AppendFormat( "%s\"expires\": \"%s\",\n", pszJSONIndent, szTimeExpiry );
buf.AppendFormat( "%s\"ca_key_id\": %" PRIu64 "\n", pszJSONIndent, msgSigned.ca_key_id() );
V_sprintf_safe( szTemp, "%s\"key_id\": %llu,\n", pszJSONIndent, CalculatePublicKeyID( pubKey ) );
sOutResult += szTemp;
if ( !sDataCenterIDs.empty() )
{
V_sprintf_safe( szTemp, "%s\"data_centers\": [ %s ],\n", pszJSONIndent, sDataCenterIDs.c_str() );
sOutResult += szTemp;
}
V_sprintf_safe( szTemp, "%s\"created\": \"%s\",\n", pszJSONIndent, szTimeCreated );
sOutResult += szTemp;
V_sprintf_safe( szTemp, "%s\"expires\": \"%s\",\n", pszJSONIndent, szTimeExpiry );
sOutResult += szTemp;
V_sprintf_safe( szTemp, "%s\"ca_key_id\": %" PRIu64 "\n", pszJSONIndent, msgSigned.ca_key_id() );
sOutResult += szTemp;
}
else
{
buf.AppendFormat( "Public key ID. . : %llu\n", CalculatePublicKeyID( pubKey ) );
buf.AppendFormat( "Created. . . . . : %s\n", szTimeCreated );
buf.AppendFormat( "Expires. . . . . : %s\n", szTimeExpiry );
buf.AppendFormat( "CA key ID. . . . : %" PRIu64 "\n", msgSigned.ca_key_id() );
if ( sDataCenterIDs )
buf.AppendFormat( "Data center(s) . : %s\n", sDataCenterIDs.String() );
V_sprintf_safe( szTemp, "Public key ID. . : %llu\n", CalculatePublicKeyID( pubKey ) );
sOutResult += szTemp;
V_sprintf_safe( szTemp, "Created. . . . . : %s\n", szTimeCreated );
sOutResult += szTemp;
V_sprintf_safe( szTemp, "Expires. . . . . : %s\n", szTimeExpiry );
sOutResult += szTemp;
V_sprintf_safe( szTemp, "CA key ID. . . . : %" PRIu64 "\n", msgSigned.ca_key_id() );
sOutResult += szTemp;
if ( !sDataCenterIDs.empty() )
{
V_sprintf_safe( szTemp, "Data center(s) . : %s\n", sDataCenterIDs.c_str() );
sOutResult += szTemp;
}
}
}
@@ -272,9 +288,9 @@ void CreateCert()
Msg( "%s\n", k_szSDRCertPEMHeader );
Msg( "%s\n", text );
Msg( "%s\n", k_szSDRCertPEMFooter );
CUtlStringBuilder sDetails;
std::string sDetails;
PrintCertInfo( msgSigned, sDetails, nullptr );
Msg( "%s", sDetails.String() );
Msg( "%s", sDetails.c_str() );
}
///////////////////////////////////////////////////////////////////////////////
@@ -650,13 +650,14 @@ void CSteamNetworkingSockets::SetConnectionName( HSteamNetConnection hPeer, cons
pConn->SetName( pszName );
}
void CSteamNetworkingSockets::GetConnectionName( HSteamNetConnection hPeer, char *pszName, int nMaxLen )
bool CSteamNetworkingSockets::GetConnectionName( HSteamNetConnection hPeer, char *pszName, int nMaxLen )
{
SteamDatagramTransportLock scopeLock;
CSteamNetworkConnectionBase *pConn = GetConnectionByHandle( hPeer );
if ( !pConn )
return;
pConn->GetName( pszName, nMaxLen );
return false;
V_strncpy( pszName, pConn->GetName(), nMaxLen );
return true;
}
EResult CSteamNetworkingSockets::SendMessageToConnection( HSteamNetConnection hConn, const void *pData, uint32 cbData, ESteamNetworkingSendType eSendType )
@@ -173,7 +173,7 @@ public:
virtual bool SetConnectionUserData( HSteamNetConnection hPeer, int64 nUserData ) OVERRIDE;
virtual int64 GetConnectionUserData( HSteamNetConnection hPeer ) OVERRIDE;
virtual void SetConnectionName( HSteamNetConnection hPeer, const char *pszName ) OVERRIDE;
virtual void GetConnectionName( HSteamNetConnection hPeer, char *pszName, int nMaxLen ) OVERRIDE;
virtual bool GetConnectionName( HSteamNetConnection hPeer, char *pszName, int nMaxLen ) OVERRIDE;
virtual EResult SendMessageToConnection( HSteamNetConnection hConn, const void *pData, uint32 cbData, ESteamNetworkingSendType eSendType ) OVERRIDE;
virtual EResult FlushMessagesOnConnection( HSteamNetConnection hConn );
virtual int ReceiveMessagesOnConnection( HSteamNetConnection hConn, ISteamNetworkingMessage **ppOutMessages, int nMaxMessages ) OVERRIDE;
@@ -559,9 +559,11 @@ bool CSteamNetworkConnectionBase::BInitConnection( uint32 nPeerProtocolVersion,
m_hConnectionSelf = g_listConnections.AddToTail( this ) | s_nUpperBits;
// Set a default name if we haven't been given one
if ( m_sName.IsEmpty() )
if ( m_sName.empty() )
{
m_sName.Format( "%d", m_hConnectionSelf & ~s_nUpperBits );
char temp[ 64 ];
V_sprintf_safe( temp, "%d", m_hConnectionSelf & ~s_nUpperBits );
m_sName = temp;
}
// Clear everything out
@@ -1320,13 +1322,6 @@ bool CSteamNetworkConnectionBase::RecvDataChunk( uint16 unSeqNum, const void *pC
return SNP_RecvDataChunk( unSeqNum, arDecryptedChunk, cbDecrypted, cbPacketSize, usecNow );
}
bool CSteamNetworkConnectionBase::GetDebugText( char *pszOut, int nOutCCH )
{
CUtlString snpDebug = SNP_GetDebugText();
V_strncpy( pszOut, snpDebug.String(), nOutCCH );
return true;
}
void CSteamNetworkConnectionBase::APICloseConnection( int nReason, const char *pszDebug, bool bEnableLinger )
{
@@ -13,7 +13,6 @@
#include <tier1/utllinkedlist.h>
#include <tier1/netadr.h>
#include <tier1/utlhashmap.h>
#include <tier1/utlstring.h>
#include "steamnetworkingsockets_lowlevel.h"
#include "keypair.h"
#include <tier0/memdbgoff.h>
@@ -240,7 +239,7 @@ public:
void SetUserData( int64 nUserData );
// Get/set name
inline void GetName( char *pszName, int nMaxLen ) const { V_strncpy( pszName, m_sName.String(), nMaxLen); }
inline const char *GetName() const { return m_sName.c_str(); }
void SetName( const char *pszName ) { m_sName = pszName; }
/// High level state of the connection
@@ -331,7 +330,7 @@ public:
/// Called when we receive an (end-to-end) packet with a sequence number
void RecvNonDataSequencedPacket( uint16 nWireSeqNum, SteamNetworkingMicroseconds usecNow );
bool GetDebugText( char *pszOut, int nOutCCH );
void GetDebugText( char *pszOut, int nOutCCH );
// Called from SNP to update transmit/receive speeds
void UpdateSpeeds( int nTXSpeed, int nRXSpeed );
@@ -385,7 +384,7 @@ protected:
int64 m_nUserData;
/// Name (for debugging)
CUtlString m_sName;
std::string m_sName;
// Implements IThinker.
// Connections do not override this. Do any periodic work in ThinkConnection()
@@ -505,7 +504,7 @@ protected:
void SNP_CheckForReliable( SteamNetworkingMicroseconds usecNow );
void SNP_UpdateX( SteamNetworkingMicroseconds usecNow );
bool SNP_InsertSegment( SSNPBuffer *p_buf, uint8 flags, int nSize );
CUtlString SNP_GetDebugText();
std::string SNP_GetDebugText();
void SNP_PopulateDetailedStats( SteamDatagramLinkStats &info ) const;
void SNP_PopulateQuickStats( SteamNetworkingQuickConnectionStatus &info, SteamNetworkingMicroseconds usecNow );
bool SNP_UpdateIMean( uint16 unSeqNum, SteamNetworkingMicroseconds usecNow );
@@ -106,7 +106,7 @@ void CSteamNetworkConnectionBase::SNP_InitializeConnection( SteamNetworkingMicro
if ( steamdatagram_snp_log_x )
SpewMsg( "%12llu %s: INITIAL X=%d rtt=%dms tx_s=%d\n",
usecNow,
m_sName.String(),
m_sName.c_str(),
m_senderState.m_n_x,
m_statsEndToEnd.m_ping.m_nSmoothedPing,
m_senderState.m_n_tx_s );
@@ -171,7 +171,7 @@ EResult CSteamNetworkConnectionBase::SNP_SendMessage( SteamNetworkingMicrosecond
if ( steamdatagram_snp_log_message )
SpewMsg( "%12llu %s: SendMessage %s: MsgNum=%d sz=%d\n",
usecNow,
m_sName.String(),
m_sName.c_str(),
pSendMessage->m_bReliable ? "RELIABLE" : "UNRELIABLE",
pSendMessage->m_unMsgNum,
pSendMessage->m_nSize );
@@ -187,7 +187,7 @@ EResult CSteamNetworkConnectionBase::SNP_SendMessage( SteamNetworkingMicrosecond
if ( steamdatagram_snp_log_nagle )
SpewMsg( "%12llu %s: NAGLE cleared nagle timer because pendingBytes %d > %d\n",
usecNow,
m_sName.String(),
m_sName.c_str(),
m_senderState.PendingBytesTotal(),
k_cbSteamNetworkingSocketsMaxMessageNoFragment );
m_senderState.FlushNagle();
@@ -198,7 +198,7 @@ EResult CSteamNetworkConnectionBase::SNP_SendMessage( SteamNetworkingMicrosecond
if ( steamdatagram_snp_log_nagle )
SpewMsg( "%12llu %s: NAGLE cleared nagle timer because message was sent with type %d\n",
usecNow,
m_sName.String(),
m_sName.c_str(),
eSendType );
m_senderState.FlushNagle();
}
@@ -208,7 +208,7 @@ EResult CSteamNetworkConnectionBase::SNP_SendMessage( SteamNetworkingMicrosecond
if ( steamdatagram_snp_log_nagle )
SpewMsg( "%12llu %s: NAGLE SET to %llu (%d delay)\n",
usecNow,
m_sName.String(),
m_sName.c_str(),
m_senderState.m_t_nagle,
steamdatagram_snp_nagle_time );
}
@@ -221,7 +221,7 @@ EResult CSteamNetworkConnectionBase::SNP_SendMessage( SteamNetworkingMicrosecond
{
SpewVerbose( "%12llu %s: RATELIM QueueTime is %.1fms, SendRate=%.1fk, BytesQueued=%d\n",
usecNow,
m_sName.String(),
m_sName.c_str(),
m_senderState.CalcTimeUntilNextSend() * 1e-3,
m_senderState.m_n_x * ( 1.0/1024.0),
m_senderState.PendingBytesTotal()
@@ -242,7 +242,7 @@ EResult CSteamNetworkConnectionBase::SNP_FlushMessage( SteamNetworkingMicrosecon
if ( steamdatagram_snp_log_nagle )
SpewMsg( "%12llu %s: NAGLE FlushMessasge\n",
usecNow,
m_sName.String() );
m_sName.c_str() );
m_senderState.FlushNagle();
@@ -395,7 +395,7 @@ void CSteamNetworkConnectionBase::SNP_CheckForReliable( SteamNetworkingMicroseco
if ( steamdatagram_snp_log_reliable )
SpewMsg( "%12llu %s: %s CheckForReliable: sentMsgNum=%d, recvMsgNum=%d, recvSeqNum=%d, sendSeqNum=%d sendSeqOffset=%d\n",
usecNow,
m_sName.String(),
m_sName.c_str(),
pMsg == m_senderState.m_pSendMessages ? "SEND" : "SENT",
pMsg->m_unMsgNum,
m_senderState.m_unRecvMsgNumReliable,
@@ -409,7 +409,7 @@ void CSteamNetworkConnectionBase::SNP_CheckForReliable( SteamNetworkingMicroseco
if ( steamdatagram_snp_log_reliable )
SpewMsg( "%12llu %s: %s ACK recvMsgNum %d is after sentMsgNum %d, acknowledged\n",
usecNow,
m_sName.String(),
m_sName.c_str(),
pMsg == m_senderState.m_pSendMessages ? "SEND" : "SENT",
m_senderState.m_unRecvMsgNumReliable,
pMsg->m_unMsgNum );
@@ -440,7 +440,7 @@ void CSteamNetworkConnectionBase::SNP_CheckForReliable( SteamNetworkingMicroseco
if ( steamdatagram_snp_log_reliable )
SpewMsg( "%12llu %s: %s NAK sentMsgNum %d: recvSeqNum %d is GTE sentSeqNum %d, but ack is previous msg %d:%u\n",
usecNow,
m_sName.String(),
m_sName.c_str(),
pMsg == m_senderState.m_pSendMessages ? "SEND" : "SENT",
pMsg->m_unMsgNum,
m_senderState.m_unRecvSeqNum,
@@ -456,7 +456,7 @@ void CSteamNetworkConnectionBase::SNP_CheckForReliable( SteamNetworkingMicroseco
if ( steamdatagram_snp_log_reliable )
SpewMsg( "%12llu %s: %s recvMsgNum %d != sentMsgNum %d, lastAck %d:%u\n",
usecNow,
m_sName.String(),
m_sName.c_str(),
pMsg == m_senderState.m_pSendMessages ? "SEND" : "SENT",
m_senderState.m_unRecvMsgNumReliable,
pMsg->m_unMsgNum,
@@ -478,7 +478,7 @@ void CSteamNetworkConnectionBase::SNP_CheckForReliable( SteamNetworkingMicroseco
if ( steamdatagram_snp_log_reliable )
SpewMsg( "%12llu %s: %s NAK sentMsgNum %d: recvSeqNum %d is GTE sentSeqNum %d, but m_unRecvMsgAmt %d is less than m_nSentAmt %d\n",
usecNow,
m_sName.String(),
m_sName.c_str(),
pMsg == m_senderState.m_pSendMessages ? "SEND" : "SENT",
pMsg->m_unMsgNum,
m_senderState.m_unRecvSeqNum,
@@ -493,7 +493,7 @@ void CSteamNetworkConnectionBase::SNP_CheckForReliable( SteamNetworkingMicroseco
if ( steamdatagram_snp_log_reliable )
SpewMsg( "%12llu %s: %s ACK sentMsgNum %d: recvSeqNum %d is GTE sentSeqNum %d, m_unRecvMsgAmt %d is GTE than m_nSentAmt %d\n",
usecNow,
m_sName.String(),
m_sName.c_str(),
pMsg == m_senderState.m_pSendMessages ? "SEND" : "SENT",
pMsg->m_unMsgNum,
m_senderState.m_unRecvSeqNum,
@@ -515,7 +515,7 @@ void CSteamNetworkConnectionBase::SNP_CheckForReliable( SteamNetworkingMicroseco
if ( steamdatagram_snp_log_reliable )
SpewMsg( "%12llu %s: SENT Finished sentMsgNum %d lastAck %d:%u\n",
usecNow,
m_sName.String(),
m_sName.c_str(),
pMsg->m_unMsgNum,
m_senderState.m_unRecvMsgNumReliable,
m_senderState.m_unRecvMsgAmtReliable );
@@ -545,7 +545,7 @@ void CSteamNetworkConnectionBase::SNP_CheckForReliable( SteamNetworkingMicroseco
if ( steamdatagram_snp_log_reliable || steamdatagram_snp_log_loss )
SpewMsg( "%12llu %s: RTO sentMsgNum %d\n",
usecNow,
m_sName.String(),
m_sName.c_str(),
pMsg->m_unMsgNum );
// Set for retransmit due to timeout
@@ -575,7 +575,7 @@ void CSteamNetworkConnectionBase::SNP_PrepareFeedback( SteamNetworkingMicrosecon
if ( steamdatagram_snp_log_feedback )
SpewMsg( "%12llu %s: TFRC_FBACK_PERIODIC usec_delta=%llu bytes_recv=%d n_x_recv=%d m_n_x_recv=%d\n",
usecNow,
m_sName.String(),
m_sName.c_str(),
usec_delta,
m_receiverState.m_n_bytes_recv,
n_x_recv,
@@ -746,7 +746,7 @@ bool CSteamNetworkConnectionBase::SNP_AddLossEvent( uint16 unSeqNum, SteamNetwor
if ( steamdatagram_snp_log_loss )
SpewMsg( "%12llu %s: LOSS INITIAL: x_recv: %d, cur_p: %.8f len: %d\n",
usecNow,
m_sName.String(),
m_sName.c_str(),
n_x_recv,
cur_p,
len );
@@ -852,7 +852,7 @@ void CSteamNetworkConnectionBase::SNP_NoFeedbackTimer( SteamNetworkingMicrosecon
if ( steamdatagram_snp_log_feedback )
SpewMsg( "%12llu %s: NO FEEDBACK TIMER X=%d, was %d, timer is %llu (rtt is %dms)\n",
usecNow,
m_sName.String(),
m_sName.c_str(),
m_senderState.m_n_x,
n_old_x,
m_senderState.m_usec_nfb - usecNow,
@@ -871,7 +871,7 @@ int CSteamNetworkConnectionBase::SNP_CheckForLoss( uint16 unSeqNum, SteamNetwork
{
SpewMsg( "%12llu %s: RECV OOO PACKET(S) %d (wanted %d)\n",
usecNow,
m_sName.String(),
m_sName.c_str(),
unSeqNum,
( uint16 )( m_receiverState.m_queue_rx_hist.back().m_unRecvSeqNum + 1 ) );
@@ -884,7 +884,7 @@ int CSteamNetworkConnectionBase::SNP_CheckForLoss( uint16 unSeqNum, SteamNetwork
if ( steamdatagram_snp_log_packet || steamdatagram_snp_log_loss )
SpewMsg( "%12llu %s: RECV LOST %d PACKET(S) %d - %d\n",
usecNow,
m_sName.String(),
m_sName.c_str(),
nSeqDelta - 1,
first,
second );
@@ -931,7 +931,7 @@ bool CSteamNetworkConnectionBase::SNP_RecvDataChunk( uint16 unSeqNum, const void
if ( steamdatagram_snp_log_packet )
SpewMsg( "%12llu %s: RECV PACKET %d usecNow=%llu sz=%d(%d) recvSeqNum:%d recvMsgNum:%d recvMsgAmt:%d\n",
usecNow,
m_sName.String(),
m_sName.c_str(),
unSeqNum,
usecNow,
cbChunk,
@@ -1024,7 +1024,7 @@ bool CSteamNetworkConnectionBase::SNP_RecvDataChunk( uint16 unSeqNum, const void
if ( steamdatagram_snp_log_feedback )
SpewMsg( "%12llu %s: RECV FEEDBACK %d x_recv:%d t_delay:%d p:%d\n",
usecNow,
m_sName.String(),
m_sName.c_str(),
unSeqNum,
LittleDWord( pFeedback->m_un_X_recv ),
LittleDWord( pFeedback->m_un_t_delay ),
@@ -1065,7 +1065,7 @@ bool CSteamNetworkConnectionBase::SNP_RecvDataChunk( uint16 unSeqNum, const void
if ( steamdatagram_snp_log_rtt )
SpewMsg( "%12llu %s: RECV UPDATE RTT rtt:%dms seqNum:%d ts:%d r_sample:%llu diff_ts:%llu t_delay:%d\n",
usecNow,
m_sName.String(),
m_sName.c_str(),
m_statsEndToEnd.m_ping.m_nSmoothedPing,
m_senderState.m_unRecvSeqNum,
(int)( tx_hist_entry.m_usec_ts / 1000 ),
@@ -1144,7 +1144,7 @@ bool CSteamNetworkConnectionBase::SNP_RecvDataChunk( uint16 unSeqNum, const void
if ( steamdatagram_snp_log_segments )
SpewMsg( "%12llu %s: Unexpected reliable message segment %d:%u sz=%d (expected %d)\n",
usecNow,
m_sName.String(),
m_sName.c_str(),
unMsgNum,
unOffset,
nSegmentSize,
@@ -1157,7 +1157,7 @@ bool CSteamNetworkConnectionBase::SNP_RecvDataChunk( uint16 unSeqNum, const void
if ( steamdatagram_snp_log_segments )
SpewMsg( "%12llu %s: Unexpected reliable message offset %d:%u sz=%d (expected %d:%u)\n",
usecNow,
m_sName.String(),
m_sName.c_str(),
unMsgNum,
unOffset,
nSegmentSize,
@@ -1174,7 +1174,7 @@ bool CSteamNetworkConnectionBase::SNP_RecvDataChunk( uint16 unSeqNum, const void
if ( steamdatagram_snp_log_segments )
SpewMsg( "%12llu %s: RELIABLE %d: msgNum %d offset=%d recvAmt=%d segmentSize=%d%s\n",
usecNow,
m_sName.String(),
m_sName.c_str(),
unSeqNum,
unMsgNum,
unOffset,
@@ -1190,7 +1190,7 @@ bool CSteamNetworkConnectionBase::SNP_RecvDataChunk( uint16 unSeqNum, const void
if ( steamdatagram_snp_log_message || steamdatagram_snp_log_reliable )
SpewMsg( "%12llu %s: RecvMessage RELIABLE: MsgNum=%d sz=%d\n",
usecNow,
m_sName.String(),
m_sName.c_str(),
unMsgNum,
recvBuf.TellPut() );
@@ -1212,7 +1212,7 @@ bool CSteamNetworkConnectionBase::SNP_RecvDataChunk( uint16 unSeqNum, const void
if ( steamdatagram_snp_log_segments )
SpewMsg( "%12llu %s: Throwing away unreliable message %d sz=%d\n",
usecNow,
m_sName.String(),
m_sName.c_str(),
m_receiverState.m_unRecvMsgNum,
recvBuf.TellPut() );
recvBuf.Purge();
@@ -1228,7 +1228,7 @@ bool CSteamNetworkConnectionBase::SNP_RecvDataChunk( uint16 unSeqNum, const void
if ( steamdatagram_snp_log_segments )
SpewMsg( "%12llu %s: Unexpected reliable message offset %d:%u sz=%d\n",
usecNow,
m_sName.String(),
m_sName.c_str(),
unMsgNum,
unOffset,
nSegmentSize );
@@ -1242,7 +1242,7 @@ bool CSteamNetworkConnectionBase::SNP_RecvDataChunk( uint16 unSeqNum, const void
if ( steamdatagram_snp_log_segments )
SpewMsg( "%12llu %s: UNRELIABLE %d: msgNum %d offset=%d recvAmt=%d segmentSize=%d%s\n",
usecNow,
m_sName.String(),
m_sName.c_str(),
unSeqNum,
unMsgNum,
unOffset,
@@ -1258,7 +1258,7 @@ bool CSteamNetworkConnectionBase::SNP_RecvDataChunk( uint16 unSeqNum, const void
if ( steamdatagram_snp_log_message )
SpewMsg( "%12llu %s: RecvMessage UNRELIABLE: MsgNum=%d sz=%d\n",
usecNow,
m_sName.String(),
m_sName.c_str(),
unMsgNum,
recvBuf.TellPut() );
@@ -1274,7 +1274,7 @@ bool CSteamNetworkConnectionBase::SNP_RecvDataChunk( uint16 unSeqNum, const void
if ( steamdatagram_snp_log_segments )
SpewMsg( "%12llu %s: MSG recieved unreliable message %d section offset %u (sz=%d)\n",
usecNow,
m_sName.String(),
m_sName.c_str(),
unMsgNum,
unOffset,
nSegmentSize );
@@ -1368,7 +1368,7 @@ void CSteamNetworkConnectionBase::SNP_UpdateX( SteamNetworkingMicroseconds usecN
if ( steamdatagram_snp_log_x )
SpewMsg( "%12llu %s: UPDATE X=%d (was %d) x_recv=%d min_rate=%d p=%u x_calc=%d tx_s=%d\n",
usecNow,
m_sName.String(),
m_sName.c_str(),
m_senderState.m_n_x,
n_old_x,
m_senderState.m_n_x_recv,
@@ -1568,7 +1568,7 @@ int CSteamNetworkConnectionBase::SNP_SendPacket( SteamNetworkingMicroseconds use
if ( steamdatagram_snp_log_packet )
SpewMsg( "%12llu %s: SEND PACKET %d usecNow=%llu sz=%d(%d) recvSeqNum:%d recvMsgNum:%d recvMsgAmt:%d\n",
usecNow,
m_sName.String(),
m_sName.c_str(),
sendSeqNum,
usecNow,
sendBuf.m_nSize,
@@ -1610,7 +1610,7 @@ int CSteamNetworkConnectionBase::SNP_SendPacket( SteamNetworkingMicroseconds use
if ( steamdatagram_snp_log_segments )
SpewMsg( "%12llu %s: %s %d: msgNum %d offset=%d sendAmt=%d segmentSize=%d%s\n",
usecNow,
m_sName.String(),
m_sName.c_str(),
sendPacketEntryMsg.m_bReliable ? "RELIABLE " : "UNRELIABLE",
sendSeqNum,
sendPacketEntryMsg.m_pMsg->m_unMsgNum,
@@ -1664,14 +1664,14 @@ void CSteamNetworkConnectionBase::SNP_ThinkSendState( SteamNetworkingMicrosecond
if ( steamdatagram_snp_log_nagle )
SpewMsg( "%12llu %s: NAGLE WAIT %llu to go\n",
usecNow,
m_sName.String(),
m_sName.c_str(),
m_senderState.m_t_nagle - usecNow );
break;
}
if ( steamdatagram_snp_log_nagle )
SpewMsg( "%12llu %s: NAGLE cleared (pending send), %llu early\n",
usecNow,
m_sName.String(),
m_sName.c_str(),
m_senderState.m_t_nagle - usecNow );
m_senderState.m_t_nagle = 0;
}
@@ -1684,7 +1684,7 @@ void CSteamNetworkConnectionBase::SNP_ThinkSendState( SteamNetworkingMicrosecond
{
SpewMsg( "%12llu %s: NAGLE REACHED (cleared)\n",
usecNow,
m_sName.String() );
m_sName.c_str() );
}
}
@@ -1697,7 +1697,7 @@ void CSteamNetworkConnectionBase::SNP_ThinkSendState( SteamNetworkingMicrosecond
if ( steamdatagram_snp_log_feedback )
SpewMsg( "%12llu %s: TFRC_SSTATE_FBACK_REQ due to rto/2 timeout\n",
usecNow,
m_sName.String() );
m_sName.c_str() );
}
if ( !m_senderState.m_usec_rto && usecNow - m_receiverState.m_usec_tstamp_last_feedback > TCP_RTO_MIN / 2 )
{
@@ -1705,7 +1705,7 @@ void CSteamNetworkConnectionBase::SNP_ThinkSendState( SteamNetworkingMicrosecond
if ( steamdatagram_snp_log_feedback )
SpewMsg( "%12llu %s: TFRC_SSTATE_FBACK_REQ due to TCP_RTO_MIN/2 timeout\n",
usecNow,
m_sName.String() );
m_sName.c_str() );
}
}
@@ -1871,11 +1871,9 @@ void CSteamNetworkConnectionBase::SetMaximumRate( int nRate )
m_senderState.m_n_x = nRate;
}
CUtlString CSteamNetworkConnectionBase::SNP_GetDebugText()
void CSteamNetworkConnectionBase::GetDebugText( char *pszOut, int nOutCCH )
{
CUtlString text;
text.Format( "%s\n"
V_snprintf( pszOut, nOutCCH, "%s\n"
"SenderState\n"
" x . . . . . . %d\n"
" x_recv. . . . %d\n"
@@ -1898,7 +1896,7 @@ CUtlString CSteamNetworkConnectionBase::SNP_GetDebugText()
" i_mean. . . . %d (%.8f)\n"
" msgsReliable. %lld\n"
" msgs. . . . . %lld\n",
m_sName.String(),
m_sName.c_str(),
m_senderState.m_n_x,
m_senderState.m_n_x_recv,
m_senderState.m_n_x_calc,
@@ -1921,8 +1919,6 @@ CUtlString CSteamNetworkConnectionBase::SNP_GetDebugText()
m_receiverState.m_nMessagesRecvReliable,
m_receiverState.m_nMessagesRecvUnreliable
);
return text;
}
} // namespace SteamNetworkingSocketsLib
@@ -10,7 +10,6 @@
#include <tier1/utlvector.h>
#include <tier1/utlbuffer.h>
#include <tier1/utlstring.h>
struct P2PSessionState_t;
File diff suppressed because it is too large Load Diff