fix race condition

This commit is contained in:
ginuerzh
2023-10-19 23:47:47 +08:00
parent f2fd6554ad
commit cc4310106b
29 changed files with 157 additions and 156 deletions

View File

@ -7,6 +7,10 @@ import (
smux "github.com/xtaci/smux"
)
const (
defaultVersion = 2
)
type Config struct {
// SMUX Protocol version, support 1,2
Version int
@ -36,6 +40,8 @@ type Config struct {
func convertConfig(cfg *Config) *smux.Config {
smuxCfg := smux.DefaultConfig()
smuxCfg.Version = defaultVersion
if cfg == nil {
return smuxCfg
}