Пример #1
0
func New(opt *Options) *GhostClient {
	newClient := &GhostClient{
		bufpool:   util.NewBufpool(),
		connPool:  newConnPool(opt),
		opt:       opt,
		MsgHeader: make([]byte, MSG_HEADER_SIZE),
	}

	newClient.processor.process = newClient.process

	return newClient
}
Пример #2
0
func GhostRun(opt *Options) Server {
	s := Server{
		bufpool: util.NewBufpool(),
		opt:     opt,
		storage: ghost.GetStorage(),
		logger:  getLogger(opt.GetLogfileName()),
	}

	log.Printf("Starting Ghost server on %s", s.opt.GetAddr())

	s.handle()

	return s
}