mirror of
https://github.com/nabbar/golib.git
synced 2025-10-04 07:26:39 +08:00
Package Socket/Server:
- fix UDP as kernel SOCKGRAM - add unixgram as kernel SOCKGRAM for local socket file - optimize parallel statment - optimize code / minor bugs fix - add IsRunning function - add timeout shutdown based on periodicly check of IsRunning - fix close channel before send empty struct to stop process - optimize clean shutdown - optimize connection process to use less resources and lock pipeline less time
This commit is contained in:
@@ -35,6 +35,7 @@ import (
|
||||
)
|
||||
|
||||
const DefaultBufferSize = 32 * 1024
|
||||
const EOL byte = '\n'
|
||||
|
||||
type ConnState uint8
|
||||
|
||||
@@ -79,13 +80,16 @@ type Handler func(request io.Reader, response io.Writer)
|
||||
type Response func(r io.Reader)
|
||||
|
||||
type Server interface {
|
||||
io.Closer
|
||||
|
||||
RegisterFuncError(f FuncError)
|
||||
RegisterFuncInfo(f FuncInfo)
|
||||
RegisterFuncInfoServer(f FuncInfoSrv)
|
||||
|
||||
SetTLS(enable bool, config libtls.TLSConfig) error
|
||||
Listen(ctx context.Context) error
|
||||
Shutdown()
|
||||
Shutdown() error
|
||||
IsRunning() bool
|
||||
Done() <-chan struct{}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user