fix: 错误队列不能只读前两个,增加了清除功能,读完全部错误队列

This commit is contained in:
nnbcccscdscdsc
2026-03-24 11:39:02 +08:00
parent 0bd684c1c9
commit 1889679dbe
8 changed files with 771 additions and 60 deletions

View File

@@ -11,6 +11,7 @@ import (
"omnisocketgo/cmd/internal/latencylog"
peerpkg "omnisocketgo/cmd/internal/peer"
"omnisocketgo/cmd/internal/protocol"
"omnisocketgo/cmd/internal/transport"
)
func main() {
@@ -23,10 +24,11 @@ func main() {
bindDevice := flag.String("bind-device", "", "optional Linux network device used when dialing the server")
inboxDir := flag.String("inbox-dir", "inbox", "directory used to persist received text and file messages")
logPath := flag.String("latency-log", "", "optional JSONL file path for latency timestamp logs")
txTimestampDebugLogPath := flag.String("tx-ts-debug-log", "", "optional JSONL file path for TX errqueue debug records")
interactive := flag.Bool("interactive", true, "enable interactive REPL for repeated text/file sends on the same connection")
flag.Parse()
clientOptions := make([]peerpkg.Option, 0, 3)
clientOptions := make([]peerpkg.Option, 0, 4)
if *logPath != "" {
logger, err := latencylog.NewJSONLLogger(*logPath)
if err != nil {
@@ -35,6 +37,14 @@ func main() {
defer logger.Close()
clientOptions = append(clientOptions, peerpkg.WithLogger(logger))
}
if *txTimestampDebugLogPath != "" {
logger, err := transport.NewJSONLTXTimestampDebugLogger(*txTimestampDebugLogPath)
if err != nil {
log.Fatalf("create tx timestamp debug logger %s: %v", *txTimestampDebugLogPath, err)
}
defer logger.Close()
clientOptions = append(clientOptions, peerpkg.WithTXTimestampDebugLogger(logger))
}
if *bindIP != "" {
clientOptions = append(clientOptions, peerpkg.WithBindIP(*bindIP))
}