示例#1
0
文件: srunner.go 项目: jnylam/cs189a
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)
}
示例#2
0
func (ts *windowTestSystem) setServerWriteDropPercent(percent int) {
	ts.t.Logf("Server write drop percent set to %d%%", percent)
	lspnet.SetServerWriteDropPercent(percent)
}