From cb961873149b169c8c349e133e617bb6a49616f0 Mon Sep 17 00:00:00 2001 From: crusader Date: Fri, 27 Oct 2017 16:48:49 +0900 Subject: [PATCH] ing --- client_handler.go | 11 ++++++++++- client_handlers.go | 22 +++++++++++++++++++++- 2 files changed, 31 insertions(+), 2 deletions(-) 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