Close memory holes, adjust tests

This commit is contained in:
2026-10-19 00:42:19 +00:00
parent 466290d316
commit a81044322b
4 changed files with 380 additions and 19 deletions
+41 -16
View File
@@ -3,6 +3,7 @@ package main
import (
"net"
"sync"
"time"
"github.com/racingmars/go3270"
)
@@ -108,12 +109,14 @@ type TargetSystem struct {
}
type ServerConfig struct {
BindAddress string `toml:"bind_address"`
Codepage string `toml:"codepage"`
TLS bool `toml:"tls"`
CertFile string `toml:"cert_file"`
KeyFile string `toml:"key_file"`
Public bool `toml:"public"`
BindAddress string `toml:"bind_address"`
Codepage string `toml:"codepage"`
TLS bool `toml:"tls"`
CertFile string `toml:"cert_file"`
KeyFile string `toml:"key_file"`
Public bool `toml:"public"`
AutoHoldDiscardLimit int `toml:"auto_hold_discard_limit"`
AutoHoldBurstLimit int `toml:"auto_hold_burst_limit"`
}
type LoginConfig struct {
@@ -146,17 +149,39 @@ type Config struct {
Users []UserConfig `toml:"users"`
}
const (
defaultAutoHoldDiscardLimit = 5
autoHoldDiscardWindow = 5 * time.Second
defaultAutoHoldBurstLimit = 20
autoHoldBurstWindow = 1 * time.Second
)
type SessionSlot struct {
System TargetSystem
Upstream net.Conn
LastScreen []byte
ScreenChanged bool
IsTN3270E bool
IsBound bool
SeqNumber uint16
IsHeld bool
MaxBufferSize int
Mu sync.Mutex
System TargetSystem
Upstream net.Conn
LastScreen []byte
ScreenChanged bool
IsTN3270E bool
IsBound bool
SeqNumber uint16
IsHeld bool
MaxBufferSize int
DiscardCount int
DiscardWindow time.Time
WriteBurstCount int
WriteBurstWindow time.Time
AutoHoldDiscardLimit int
AutoHoldBurstLimit int
Mu sync.Mutex
}
func (s *SessionSlot) resetHoldAndLoopCountersLocked() {
s.IsHeld = false
s.ScreenChanged = false
s.DiscardCount = 0
s.DiscardWindow = time.Time{}
s.WriteBurstCount = 0
s.WriteBurstWindow = time.Time{}
}
type slotRenderInfo struct {