ing
This commit is contained in:
parent
5a8657a1f8
commit
cb96187314
|
@ -1,6 +1,9 @@
|
||||||
package server
|
package server
|
||||||
|
|
||||||
import "io"
|
import (
|
||||||
|
"io"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
type ClientHandler interface {
|
type ClientHandler interface {
|
||||||
Dial() (conn io.ReadWriteCloser, err error)
|
Dial() (conn io.ReadWriteCloser, err error)
|
||||||
|
@ -8,5 +11,11 @@ type ClientHandler interface {
|
||||||
Handle(rwc io.ReadWriteCloser, stopChan chan struct{})
|
Handle(rwc io.ReadWriteCloser, stopChan chan struct{})
|
||||||
|
|
||||||
GetAddr() string
|
GetAddr() string
|
||||||
|
GetPendingRequests() int
|
||||||
|
GetRequestTimeout() time.Duration
|
||||||
|
GetSendBufferSize() int
|
||||||
|
GetRecvBufferSize() int
|
||||||
|
GetKeepAlivePeriod() time.Duration
|
||||||
|
|
||||||
Validate()
|
Validate()
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,13 +51,33 @@ func (ch *ClientHandlers) OnHandshake(remoteAddr string, rwc io.ReadWriteCloser)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ch *ClientHandlers) Handle(rwc io.ReadWriteCloser, stopChan chan struct{}) {
|
func (ch *ClientHandlers) Handle(rwc io.ReadWriteCloser, stopChan chan struct{}) {
|
||||||
|
// no op
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ch *ClientHandlers) GetAddr() string {
|
func (ch *ClientHandlers) GetAddr() string {
|
||||||
return ch.Addr
|
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() {
|
func (ch *ClientHandlers) Validate() {
|
||||||
if ch.PendingRequests <= 0 {
|
if ch.PendingRequests <= 0 {
|
||||||
ch.PendingRequests = DefaultPendingMessages
|
ch.PendingRequests = DefaultPendingMessages
|
||||||
|
|
Loading…
Reference in New Issue
Block a user