Improve connections debug logs.

This commit is contained in:
John Preston 2018-05-28 11:36:12 +03:00
parent 0eb3d20250
commit 4e858ba839
4 changed files with 33 additions and 4 deletions

View File

@ -1144,6 +1144,9 @@ void ConnectionPrivate::connectToServer(bool afterConfig) {
}); });
return; return;
} }
DEBUG_LOG(("Connection Info: Connecting to %1 with %2 test connections."
).arg(_shiftedDcId
).arg(_testConnections.size()));
if (!_startedConnectingAt) { if (!_startedConnectingAt) {
_startedConnectingAt = getms(true); _startedConnectingAt = getms(true);

View File

@ -71,7 +71,6 @@ void HttpConnection::connectToServer(
const bytes::vector &protocolSecret, const bytes::vector &protocolSecret,
int16 protocolDcId) { int16 protocolDcId) {
_address = address; _address = address;
TCP_LOG(("HTTP Info: address is %1").arg(url().toDisplayString()));
connect( connect(
&_manager, &_manager,
&QNetworkAccessManager::finished, &QNetworkAccessManager::finished,
@ -80,8 +79,10 @@ void HttpConnection::connectToServer(
mtpBuffer buffer(preparePQFake(_checkNonce)); mtpBuffer buffer(preparePQFake(_checkNonce));
DEBUG_LOG(("Connection Info: " DEBUG_LOG(("HTTP Info: "
"sending fake req_pq through HTTP transport to '%1'").arg(address)); "dc:%1 - Sending fake req_pq to '%2'"
).arg(protocolDcId
).arg(url().toDisplayString()));
_pingTime = getms(); _pingTime = getms();
sendData(buffer); sendData(buffer);

View File

@ -70,6 +70,12 @@ void ResolvingConnection::setChild(ConnectionPointer &&child) {
&AbstractConnection::disconnected, &AbstractConnection::disconnected,
this, this,
&ResolvingConnection::handleDisconnected); &ResolvingConnection::handleDisconnected);
DEBUG_LOG(("Resolving Info: dc:%1 proxy '%2' got new child '%3'"
).arg(_protocolDcId
).arg(_proxy.host + ':' + QString::number(_proxy.port)
).arg((_ipIndex >= 0 && _ipIndex < _proxy.resolvedIPs.size())
? _proxy.resolvedIPs[_ipIndex]
: _proxy.host));
if (_protocolDcId) { if (_protocolDcId) {
_child->connectToServer( _child->connectToServer(
_address, _address,
@ -213,6 +219,12 @@ void ResolvingConnection::connectToServer(
_port = port; _port = port;
_protocolSecret = protocolSecret; _protocolSecret = protocolSecret;
_protocolDcId = protocolDcId; _protocolDcId = protocolDcId;
DEBUG_LOG(("Resolving Info: dc:%1 proxy '%2' connects a child '%3'"
).arg(_protocolDcId
).arg(_proxy.host +':' + QString::number(_proxy.port)
).arg((_ipIndex >= 0 && _ipIndex < _proxy.resolvedIPs.size())
? _proxy.resolvedIPs[_ipIndex]
: _proxy.host));
return _child->connectToServer( return _child->connectToServer(
address, address,
port, port,

View File

@ -231,7 +231,10 @@ void TcpConnection::socketConnected() {
if (_status == Status::Waiting) { if (_status == Status::Waiting) {
mtpBuffer buffer(preparePQFake(_checkNonce)); mtpBuffer buffer(preparePQFake(_checkNonce));
DEBUG_LOG(("Connection Info: sending fake req_pq through TCP transport to %1").arg(_address)); DEBUG_LOG(("TCP Info: "
"dc:%1 - Sending fake req_pq to '%2'"
).arg(_protocolDcId
).arg(_address + ':' + QString::number(_port)));
if (_timeout < 0) _timeout = -_timeout; if (_timeout < 0) _timeout = -_timeout;
_timeoutTimer.callOnce(_timeout); _timeoutTimer.callOnce(_timeout);
@ -390,10 +393,20 @@ void TcpConnection::connectToServer(
_address = _proxy.host; _address = _proxy.host;
_port = _proxy.port; _port = _proxy.port;
_protocolSecret = ProtocolSecretFromPassword(_proxy.password); _protocolSecret = ProtocolSecretFromPassword(_proxy.password);
DEBUG_LOG(("TCP Info: "
"dc:%1 - Connecting to proxy '%2'"
).arg(protocolDcId
).arg(_address + ':' + QString::number(_port)));
} else { } else {
_address = address; _address = address;
_port = port; _port = port;
_protocolSecret = protocolSecret; _protocolSecret = protocolSecret;
DEBUG_LOG(("TCP Info: "
"dc:%1 - Connecting to '%2'"
).arg(protocolDcId
).arg(_address + ':' + QString::number(_port)));
} }
_protocolDcId = protocolDcId; _protocolDcId = protocolDcId;