code: func (g *Graphite) checkEOF(conn net.Conn, wg *sync.WaitGroup) {
  	defer wg.Done()
  	b := make([]byte, 1024)
  	for {
  		num, err := conn.Read(b)
  		if err == io.EOF {
  			log.Info("Graphite.checkEOF: remote closed conn. closing conn")
  			conn.Close()
  			return
  		}
  
  		// in case the remote behaves badly (out of spec for carbon protocol)
  		if num != 0 {
  			log.Warnf("Graphite.checkEOF: read unexpected data from peer: %s\n", b[:num])
  			continue
  		}
  
  		if err != io.EOF {
  			log.Warnf("Graphite.checkEOF: %s. closing conn\n", err)
  			conn.Close()
  			return
  		}
  	}
  }
docs: // normally the remote end should never write anything back
  // but we know when we get EOF that the other end closed the conn
  // if not for this, we can happily write and flush without getting errors (in Go) but getting RST tcp packets back (!)
  // props to Tv` for this trick.