ing
This commit is contained in:
parent
ee5c8cf463
commit
6dc7895947
|
@ -13,6 +13,8 @@ import (
|
|||
type Client interface {
|
||||
Start() error
|
||||
Stop()
|
||||
|
||||
GetClientHandler() ClientHandler
|
||||
}
|
||||
|
||||
func NewClient(ch ClientHandler) Client {
|
||||
|
@ -31,6 +33,10 @@ type client struct {
|
|||
stopWg sync.WaitGroup
|
||||
}
|
||||
|
||||
func (c *client) GetClientHandler() ClientHandler {
|
||||
return c.clientHandler
|
||||
}
|
||||
|
||||
func (c *client) Start() error {
|
||||
if nil == c.clientHandler {
|
||||
panic("Client: client handler must be specified.")
|
||||
|
|
|
@ -15,6 +15,8 @@ type Server interface {
|
|||
Start() error
|
||||
Stop()
|
||||
Serve() error
|
||||
|
||||
GetServerHandler() ServerHandler
|
||||
}
|
||||
|
||||
func NewServer(sh ServerHandler) Server {
|
||||
|
@ -35,6 +37,10 @@ type server struct {
|
|||
stopWg sync.WaitGroup
|
||||
}
|
||||
|
||||
func (s *server) GetServerHandler() ServerHandler {
|
||||
return s.serverHandler
|
||||
}
|
||||
|
||||
func (s *server) Start() error {
|
||||
if nil == s.serverHandler {
|
||||
panic("Server: server handler must be specified.")
|
||||
|
|
Loading…
Reference in New Issue
Block a user