Beispiel #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()
	}
}
Beispiel #2
0
func NewListPool(bufsize int, allowsmall bool) Pool {
	p := &ListPool{
		bufsize:    bufsize,
		allowSmall: allowsmall,
	}

	defval.Int(&p.bufsize, DEF_BUFSIZE)

	return p
}
Beispiel #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
}
Beispiel #4
0
func (r *Recovery) Init(env zerver.Environment) error {
	r.logger = env.Logger().Prefix("[Recovery]")
	defval.Int(&r.Bufsize, 1024*4)
	return nil
}