diff --git a/internal/server/state.go b/internal/server/state.go index 782447e..cbd7661 100644 --- a/internal/server/state.go +++ b/internal/server/state.go @@ -111,6 +111,7 @@ func parseProxyBook(bookEntries map[string][]string) (map[string]net.Addr, error return proxyBook, nil } +// ParseConfig reads the config file or semicolon-separated options and parse them into a RawConfig func ParseConfig(conf string) (raw RawConfig, err error) { content, errPath := ioutil.ReadFile(conf) if errPath != nil { @@ -132,7 +133,7 @@ func ParseConfig(conf string) (raw RawConfig, err error) { return } -// ParseConfig parses the config (either a path to json or the json itself as argument) into a State variable +// InitState process the RawConfig and initialises a server State accordingly func InitState(preParse RawConfig, worldState common.WorldState) (sta *State, err error) { sta = &State{ BypassUID: make(map[[16]byte]struct{}), diff --git a/internal/test/integration_test.go b/internal/test/integration_test.go index 54b92f0..773227e 100644 --- a/internal/test/integration_test.go +++ b/internal/test/integration_test.go @@ -528,9 +528,10 @@ func BenchmarkThroughput(b *testing.B) { b.Fatal(err) } - b.Run("single conn", func(b *testing.B) { + b.Run("single stream", func(b *testing.B) { more := make(chan int, 10) go func() { + // sender writeBuf := make([]byte, bufSize+100) serverConn, _ := proxyFromCkServerL.Accept() for { @@ -538,6 +539,7 @@ func BenchmarkThroughput(b *testing.B) { <-more } }() + // receiver clientConn, _ := proxyToCkClientD.Dial("", "") readBuf := make([]byte, bufSize) clientConn.Write([]byte{1}) // to make server accept @@ -545,6 +547,7 @@ func BenchmarkThroughput(b *testing.B) { b.ResetTimer() for i := 0; i < b.N; i++ { io.ReadFull(clientConn, readBuf) + // ask for more more <- 0 } })