mirror of
https://github.com/lubosz/overte.git
synced 2025-04-26 23:15:31 +02:00
Use the FCDEBUG mechanism to throttle udt::Socket log-spam
This commit is contained in:
parent
1e94a82ee6
commit
85c9f4d95f
1 changed files with 23 additions and 3 deletions
|
@ -239,11 +239,21 @@ 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;
|
||||
} else {
|
||||
HIFI_FCDEBUG(networking(), errorString.toLatin1().constData());
|
||||
}
|
||||
|
||||
#ifdef DEBUG_EVENT_QUEUE
|
||||
int nodeListQueueSize = ::hifi::qt::getEventQueueSize(thread());
|
||||
qCDebug(networking) << "Networking queue size - " << nodeListQueueSize << "writing datagram to" << sockAddr;
|
||||
|
@ -525,12 +535,22 @@ 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;
|
||||
} else {
|
||||
HIFI_FCDEBUG(networking(), errorString.toLatin1().constData());
|
||||
}
|
||||
|
||||
#ifdef DEBUG_EVENT_QUEUE
|
||||
int nodeListQueueSize = ::hifi::qt::getEventQueueSize(thread());
|
||||
qCDebug(networking) << "Networking queue size - " << nodeListQueueSize;
|
||||
|
|
Loading…
Reference in a new issue