more default options, fixed tests

This commit is contained in:
Derek Collison
2012-11-13 11:39:31 -08:00
parent c3eba76367
commit 3ea6f64c73
2 changed files with 7 additions and 1 deletions

View File

@@ -33,7 +33,7 @@ func createClientAsync(ch chan *client, s *Server, cli net.Conn) {
func rawSetup() (*Server, *client, *bufio.Reader, string) {
cli, srv := net.Pipe()
cr := bufio.NewReaderSize(cli, defaultBufSize)
s := New()
s := New(Options{})
ch := make(chan *client)
createClientAsync(ch, s, srv)
l, _ := cr.ReadString('\n')

View File

@@ -43,6 +43,12 @@ type Server struct {
}
func optionDefaults(opt *Options) {
if opt.Host == "" {
opt.Host = DEFAULT_HOST
}
if opt.Port == 0 {
opt.Port = DEFAULT_PORT
}
if opt.MaxConn == 0 {
opt.MaxConn = DEFAULT_MAX_CONNECTIONS
}