func main() { flag.Parse() if !*showLogs { log.SetOutput(ioutil.Discard) } else { lspnet.EnableDebugLogs(true) } lspnet.SetServerReadDropPercent(*readDrop) lspnet.SetServerWriteDropPercent(*writeDrop) params := &lsp.Params{ EpochLimit: *epochLimit, EpochMillis: *epochMillis, WindowSize: *windowSize, } fmt.Printf("Starting server on port %d...\n", *port) srv, err := lsp.NewServer(*port, params) if err != nil { fmt.Printf("Failed to start Server on port %d: %s\n", *port, err) return } fmt.Println("Server waiting for clients...") runServer(srv) }
func (ts *windowTestSystem) setServerWriteDropPercent(percent int) { ts.t.Logf("Server write drop percent set to %d%%", percent) lspnet.SetServerWriteDropPercent(percent) }