mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-04-10 15:21:58 +02:00
Merge pull request #16256 from SimonWalton-HiFi/supress-repeated-socket-logging
BUGZ-1543: Suppress repeated socket logging
This commit is contained in:
commit
f513b65e9d
1 changed files with 27 additions and 9 deletions
|
@ -239,15 +239,24 @@ qint64 Socket::writeDatagram(const QByteArray& datagram, const HifiSockAddr& soc
|
|||
int pending = _udpSocket.bytesToWrite();
|
||||
if (bytesWritten < 0 || pending) {
|
||||
int wsaError = 0;
|
||||
static std::atomic<int> previousWsaError (0);
|
||||
#ifdef WIN32
|
||||
wsaError = WSAGetLastError();
|
||||
#endif
|
||||
qCDebug(networking) << "udt::writeDatagram (" << _udpSocket.state() << sockAddr << ") error - " << wsaError << _udpSocket.error() << "(" << _udpSocket.errorString() << ")"
|
||||
QString errorString;
|
||||
QDebug(&errorString) << "udt::writeDatagram (" << _udpSocket.state() << sockAddr << ") error - "
|
||||
<< wsaError << _udpSocket.error() << "(" << _udpSocket.errorString() << ")"
|
||||
<< (pending ? "pending bytes:" : "pending:") << pending;
|
||||
|
||||
if (previousWsaError.exchange(wsaError) != wsaError) {
|
||||
qCDebug(networking).noquote() << errorString;
|
||||
#ifdef DEBUG_EVENT_QUEUE
|
||||
int nodeListQueueSize = ::hifi::qt::getEventQueueSize(thread());
|
||||
qCDebug(networking) << "Networking queue size - " << nodeListQueueSize << "writing datagram to" << sockAddr;
|
||||
#endif // DEBUG_EVENT_QUEUE
|
||||
int nodeListQueueSize = ::hifi::qt::getEventQueueSize(thread());
|
||||
qCDebug(networking) << "Networking queue size - " << nodeListQueueSize << "writing datagram to" << sockAddr;
|
||||
#endif // DEBUG_EVENT_QUEUE
|
||||
} else {
|
||||
HIFI_FCDEBUG(networking(), errorString.toLatin1().constData());
|
||||
}
|
||||
}
|
||||
|
||||
return bytesWritten;
|
||||
|
@ -525,16 +534,25 @@ std::vector<HifiSockAddr> Socket::getConnectionSockAddrs() {
|
|||
|
||||
void Socket::handleSocketError(QAbstractSocket::SocketError socketError) {
|
||||
int wsaError = 0;
|
||||
static std::atomic<int> previousWsaError(0);
|
||||
#ifdef WIN32
|
||||
wsaError = WSAGetLastError();
|
||||
#endif
|
||||
int pending = _udpSocket.bytesToWrite();
|
||||
qCDebug(networking) << "udt::Socket (" << _udpSocket.state() << ") error - " << wsaError << socketError << "(" << _udpSocket.errorString() << ")"
|
||||
<< (pending ? "pending bytes:" : "pending:") << pending;
|
||||
QString errorString;
|
||||
QDebug(&errorString) << "udt::Socket (" << _udpSocket.state() << ") error - " << wsaError << socketError <<
|
||||
"(" << _udpSocket.errorString() << ")" << (pending ? "pending bytes:" : "pending:")
|
||||
<< pending;
|
||||
|
||||
if (previousWsaError.exchange(wsaError) != wsaError) {
|
||||
qCDebug(networking).noquote() << errorString;
|
||||
#ifdef DEBUG_EVENT_QUEUE
|
||||
int nodeListQueueSize = ::hifi::qt::getEventQueueSize(thread());
|
||||
qCDebug(networking) << "Networking queue size - " << nodeListQueueSize;
|
||||
#endif // DEBUG_EVENT_QUEUE
|
||||
int nodeListQueueSize = ::hifi::qt::getEventQueueSize(thread());
|
||||
qCDebug(networking) << "Networking queue size - " << nodeListQueueSize;
|
||||
#endif // DEBUG_EVENT_QUEUE
|
||||
} else {
|
||||
HIFI_FCDEBUG(networking(), errorString.toLatin1().constData());
|
||||
}
|
||||
}
|
||||
|
||||
void Socket::handleStateChanged(QAbstractSocket::SocketState socketState) {
|
||||
|
|
Loading…
Reference in a new issue