From d9a27fd5ac6c8841fbe21573265fd31d94037986 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 15 May 2014 11:29:32 -0700 Subject: [PATCH] command/agent: block windows socket errors --- CHANGELOG.md | 2 ++ command/agent/rpc.go | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d49e01ce9..92a670b4d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,8 @@ BUG FIXES: * Renaming "seperator" to "separator". This is the correct spelling, but both spellings are respected for backwards compatibility. [GH-101] * Private IP is properly found on Windows clients. + * Windows agents won't show "failed to decode" errors on every RPC + request. ## 0.2.0 (May 1, 2014) diff --git a/command/agent/rpc.go b/command/agent/rpc.go index 99ca9479a..e56196f51 100644 --- a/command/agent/rpc.go +++ b/command/agent/rpc.go @@ -295,8 +295,13 @@ func (i *AgentRPC) handleClient(client *rpcClient) { for { // Decode the header if err := client.dec.Decode(&reqHeader); err != nil { - if err != io.EOF && !i.stop { - i.logger.Printf("[ERR] agent.rpc: failed to decode request header: %v", err) + if !i.stop { + // The second part of this if is to block socket + // errors from Windows which appear to happen every + // time there is an EOF. + if err != io.EOF && !strings.Contains(err.Error(), "WSARecv") { + i.logger.Printf("[ERR] agent.rpc: failed to decode request header: %v", err) + } } return }