提交 421e242d 编写于 作者: J Jonathan Chambers 提交者: spatil

Limit console spam from warning (case 1238954)

Emitting error 100 times is plenty.
上级 c74148de
......@@ -172,6 +172,7 @@ selector_thread_wakeup_drain_pipes (void)
{
gchar buffer [128];
gint received;
static gint warnings_issued = 0;
for (;;) {
#if !defined(HOST_WIN32)
......@@ -179,8 +180,13 @@ selector_thread_wakeup_drain_pipes (void)
if (received == 0)
break;
if (received == -1) {
if (errno != EINTR && errno != EAGAIN)
g_warning ("selector_thread_wakeup_drain_pipes: read () failed, error (%d) %s\n", errno, g_strerror (errno));
if (errno != EINTR && errno != EAGAIN) {
// limit amount of spam we write
if (warnings_issued < 100) {
g_warning ("selector_thread_wakeup_drain_pipes: read () failed, error (%d) %s\n", errno, g_strerror (errno));
warnings_issued++;
}
}
break;
}
#else
......@@ -188,8 +194,13 @@ selector_thread_wakeup_drain_pipes (void)
if (received == 0)
break;
if (received == SOCKET_ERROR) {
if (WSAGetLastError () != WSAEINTR && WSAGetLastError () != WSAEWOULDBLOCK)
g_warning ("selector_thread_wakeup_drain_pipes: recv () failed, error (%d)\n", WSAGetLastError ());
if (WSAGetLastError () != WSAEINTR && WSAGetLastError () != WSAEWOULDBLOCK) {
// limit amount of spam we write
if (warnings_issued < 100) {
g_warning ("selector_thread_wakeup_drain_pipes: recv () failed, error (%d)\n", WSAGetLastError ());
warnings_issued++;
}
}
break;
}
#endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册