Exemplo n.º 1
0
func (o *ServerOption) init() {
	defval.String(&o.ListenAddr, ":4000")
	defval.Int(&o.PathVarCount, 3)
	defval.Int(&o.FilterCount, 5)
	if o.KeepAlivePeriod == 0 {
		o.KeepAlivePeriod = 3 * time.Minute // same as net/http/server.go:tcpKeepAliveListener
	}
	if o.Logger == nil {
		o.Logger = log2.Default()
	}
}
Exemplo n.º 2
0
func NewListPool(bufsize int, allowsmall bool) Pool {
	p := &ListPool{
		bufsize:    bufsize,
		allowSmall: allowsmall,
	}

	defval.Int(&p.bufsize, DEF_BUFSIZE)

	return p
}
Exemplo n.º 3
0
func NewSyncPool(bufsize int, allowsmall bool) Pool {
	p := &SyncPool{
		bufsize:    bufsize,
		allowSmall: allowsmall,
	}

	defval.Int(&p.bufsize, DEF_BUFSIZE)
	p.pool.New = func() interface{} {
		return make([]byte, p.bufsize)
	}

	return p
}
Exemplo n.º 4
0
func (r *Recovery) Init(env zerver.Env) error {
	defval.Int(&r.Bufsize, 1024*4)
	r.log = log.Derive("Filter", "Recovery")
	return nil
}
Exemplo n.º 5
0
func (r *Recovery) Init(env zerver.Environment) error {
	r.logger = env.Logger().Prefix("[Recovery]")
	defval.Int(&r.Bufsize, 1024*4)
	return nil
}