|
|
@@ -4,7 +4,9 @@ import (
|
|
|
"bufio"
|
|
|
"context"
|
|
|
"encoding/json"
|
|
|
+ "errors"
|
|
|
"fmt"
|
|
|
+ "io"
|
|
|
"net/http"
|
|
|
"strings"
|
|
|
"time"
|
|
|
@@ -71,6 +73,10 @@ func (m *Monitor) Run(ctx context.Context) {
|
|
|
if ctx.Err() != nil {
|
|
|
return
|
|
|
}
|
|
|
+ if errors.Is(err, io.EOF) || errors.Is(err, io.ErrUnexpectedEOF) {
|
|
|
+ logger.Info("端口 %d 连接关闭: %v, 停止监控", m.port, err)
|
|
|
+ return
|
|
|
+ }
|
|
|
logger.Warn("端口 %d 连接断开: %v, 3秒后重连", m.port, err)
|
|
|
select {
|
|
|
case <-ctx.Done():
|