diff --git a/client_handler.go b/client_handler.go index 9c04b8b..3198bfc 100644 --- a/client_handler.go +++ b/client_handler.go @@ -1,6 +1,9 @@ package server -import "io" +import ( + "io" + "time" +) type ClientHandler interface { Dial() (conn io.ReadWriteCloser, err error) @@ -8,5 +11,11 @@ type ClientHandler interface { Handle(rwc io.ReadWriteCloser, stopChan chan struct{}) GetAddr() string + GetPendingRequests() int + GetRequestTimeout() time.Duration + GetSendBufferSize() int + GetRecvBufferSize() int + GetKeepAlivePeriod() time.Duration + Validate() } diff --git a/client_handlers.go b/client_handlers.go index 5b06669..5f1ee6b 100644 --- a/client_handlers.go +++ b/client_handlers.go @@ -51,13 +51,33 @@ func (ch *ClientHandlers) OnHandshake(remoteAddr string, rwc io.ReadWriteCloser) } func (ch *ClientHandlers) Handle(rwc io.ReadWriteCloser, stopChan chan struct{}) { - + // no op } func (ch *ClientHandlers) GetAddr() string { return ch.Addr } +func (ch *ClientHandlers) GetPendingRequests() int { + return ch.PendingRequests +} + +func (ch *ClientHandlers) GetRequestTimeout() time.Duration { + return ch.RequestTimeout +} + +func (ch *ClientHandlers) GetSendBufferSize() int { + return ch.SendBufferSize +} + +func (ch *ClientHandlers) GetRecvBufferSize() int { + return ch.RecvBufferSize +} + +func (ch *ClientHandlers) GetKeepAlivePeriod() time.Duration { + return ch.KeepAlivePeriod +} + func (ch *ClientHandlers) Validate() { if ch.PendingRequests <= 0 { ch.PendingRequests = DefaultPendingMessages