From cf81c9a4427758ccee3a74fc2b46bccab759dad5 Mon Sep 17 00:00:00 2001 From: "jackdaw@loafle.com" Date: Tue, 11 Apr 2017 12:20:14 +0900 Subject: [PATCH] . --- socket_health_crawler.go | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/socket_health_crawler.go b/socket_health_crawler.go index b5d4a86..aa78cbc 100644 --- a/socket_health_crawler.go +++ b/socket_health_crawler.go @@ -56,7 +56,7 @@ func (s *SocketHeahthCrawler) CheckHeahth(params map[string]interface{}) (bool, return false, err } defer conn.Close() - + if s.m.IsPrePacket() == true { bytes := make([]byte, 1024) n, _ := conn.Read(bytes) @@ -64,42 +64,42 @@ func (s *SocketHeahthCrawler) CheckHeahth(params map[string]interface{}) (bool, if s.m.Match(0, p, nil) == false { return false, nil } else { - - for i := 1 ; i < s.m.PacketCount(); i++ { + + for i := 1; i < s.m.PacketCount(); i++ { pack := s.m.Packet(i) conn.Write(pack.Buffer) bytes := make([]byte, 1024) n, _ := conn.Read(bytes) - + if s.m.IsNoResponse(i) == true { // empty last response break } - + p := packet.NewPacket(bytes, n) if s.m.Match(i, p, nil) == false { return false, nil } } - + } - + } else { - for i := 0 ; i < s.m.PacketCount(); i++ { + for i := 0; i < s.m.PacketCount(); i++ { pack := s.m.Packet(i) conn.Write(pack.Buffer) bytes := make([]byte, 1024) n, _ := conn.Read(bytes) - + if s.m.IsNoResponse(i) == true { // empty last response break } - + p := packet.NewPacket(bytes, n) if s.m.Match(i, p, nil) == false { return false, nil } } } - + return true, nil }