This commit is contained in:
crusader 2018-04-06 20:47:32 +09:00
parent fc21d7dfa2
commit ac4646131b
3 changed files with 8 additions and 10 deletions

View File

@ -1,6 +1,8 @@
package server
type ServerHandler interface {
ConnectionHandler
GetName() string
ServerCtx() ServerCtx
@ -13,6 +15,8 @@ type ServerHandler interface {
}
type ServerHandlers struct {
ConnectionHandlers
// Server name for sending in response headers.
//
// Default server name is used if left blank.
@ -44,6 +48,10 @@ func (sh *ServerHandlers) GetName() string {
}
func (sh *ServerHandlers) Validate() error {
if err := sh.ConnectionHandlers.Validate(); nil != err {
return err
}
if "" == sh.Name {
sh.Name = "Server"
}

View File

@ -6,13 +6,11 @@ import (
type ServerHandler interface {
server.ServerHandler
server.ConnectionHandler
ReadWriteHandler
}
type ServerHandlers struct {
server.ServerHandlers
server.ConnectionHandlers
ReadWriteHandlers
}
@ -20,9 +18,6 @@ func (sh *ServerHandlers) Validate() error {
if err := sh.ServerHandlers.Validate(); nil != err {
return err
}
if err := sh.ConnectionHandlers.Validate(); nil != err {
return err
}
if err := sh.ReadWriteHandlers.Validate(); nil != err {
return err
}

View File

@ -6,13 +6,11 @@ import (
type ServerHandler interface {
server.ServerHandler
server.ConnectionHandler
server.ReadWriteHandler
}
type ServerHandlers struct {
server.ServerHandlers
server.ConnectionHandlers
server.ReadWriteHandlers
}
@ -20,9 +18,6 @@ func (sh *ServerHandlers) Validate() error {
if err := sh.ServerHandlers.Validate(); nil != err {
return err
}
if err := sh.ConnectionHandlers.Validate(); nil != err {
return err
}
if err := sh.ReadWriteHandlers.Validate(); nil != err {
return err
}