Close memory holes, adjust tests
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user