Example #1
0
func NewServer(port int, pipeline *Pipeline) *Server {
	s := new(Server)
	s.Addr = fmt.Sprintf(":%v", port)
	s.Pipeline = pipeline
	s.stopAccepting = make(chan struct{})
	s.closableAcceptReady = make(chan struct{})
	s.AcceptReady = s.closableAcceptReady
	s.handlerWaitGroup = new(sync.WaitGroup)
	s.logPrefix = fmt.Sprintf("%d", syscall.Getpid())

	// buffer pool for reusing connection bufio.Readers
	s.bufferPool = utils.NewBufferPool(100, 8192)
	s.writeBufferPool = utils.NewWriteBufferPool(100, 4096)

	return s
}
Example #2
0
func NewStringBodyFilter() *StringBodyFilter {
	sbf := &StringBodyFilter{}
	sbf.pool = utils.NewBufferPool(100, 1024)
	return sbf
}