ing
This commit is contained in:
parent
acbc1b22be
commit
94951d541a
|
@ -343,7 +343,7 @@ func (c *Client) Dial() (*server.Conn, *http.Response, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) Validate() error {
|
func (c *Client) Validate() error {
|
||||||
if err := c.ClientConnectionHandlers.Validate(); nil != err {
|
if err := c.ClientConnHandlers.Validate(); nil != err {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err := c.ReadWriteHandlers.Validate(); nil != err {
|
if err := c.ReadWriteHandlers.Validate(); nil != err {
|
||||||
|
|
|
@ -19,7 +19,7 @@ type Server struct {
|
||||||
stopChan chan struct{}
|
stopChan chan struct{}
|
||||||
stopWg sync.WaitGroup
|
stopWg sync.WaitGroup
|
||||||
|
|
||||||
srwch server.ServerRWCHandler
|
srw server.ServerReadWriter
|
||||||
|
|
||||||
hs *fasthttp.Server
|
hs *fasthttp.Server
|
||||||
upgrader *Upgrader
|
upgrader *Upgrader
|
||||||
|
@ -73,9 +73,9 @@ func (s *Server) ListenAndServe() error {
|
||||||
|
|
||||||
s.stopChan = make(chan struct{})
|
s.stopChan = make(chan struct{})
|
||||||
|
|
||||||
s.srwch.ReadwriteHandler = s.ServerHandler
|
s.srw.ReadwriteHandler = s.ServerHandler
|
||||||
s.srwch.ServerStopChan = s.stopChan
|
s.srw.ServerStopChan = s.stopChan
|
||||||
s.srwch.ServerStopWg = &s.stopWg
|
s.srw.ServerStopWg = &s.stopWg
|
||||||
|
|
||||||
s.stopWg.Add(1)
|
s.stopWg.Add(1)
|
||||||
return s.handleServer(listener)
|
return s.handleServer(listener)
|
||||||
|
@ -157,7 +157,7 @@ func (s *Server) httpHandler(ctx *fasthttp.RequestCtx) {
|
||||||
)
|
)
|
||||||
|
|
||||||
if 0 < s.ServerHandler.GetConcurrency() {
|
if 0 < s.ServerHandler.GetConcurrency() {
|
||||||
sz := s.srwch.ConnectionSize()
|
sz := s.srw.ConnectionSize()
|
||||||
if sz >= s.ServerHandler.GetConcurrency() {
|
if sz >= s.ServerHandler.GetConcurrency() {
|
||||||
logging.Logger().Warnf(s.serverMessage(fmt.Sprintf("max connections size %d, refuse", sz)))
|
logging.Logger().Warnf(s.serverMessage(fmt.Sprintf("max connections size %d, refuse", sz)))
|
||||||
s.onError(ctx, fasthttp.StatusServiceUnavailable, err)
|
s.onError(ctx, fasthttp.StatusServiceUnavailable, err)
|
||||||
|
@ -185,7 +185,7 @@ func (s *Server) httpHandler(ctx *fasthttp.RequestCtx) {
|
||||||
}
|
}
|
||||||
|
|
||||||
s.stopWg.Add(1)
|
s.stopWg.Add(1)
|
||||||
go s.srwch.HandleConnection(servlet, servletCtx, conn)
|
go s.srw.HandleConnection(servlet, servletCtx, conn)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -142,7 +142,7 @@ func (c *Client) Dial() (net.Conn, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) Validate() error {
|
func (c *Client) Validate() error {
|
||||||
if err := c.ClientConnectionHandlers.Validate(); nil != err {
|
if err := c.ClientConnHandlers.Validate(); nil != err {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err := c.ReadWriteHandlers.Validate(); nil != err {
|
if err := c.ReadWriteHandlers.Validate(); nil != err {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user