@@ -31,8 +31,6 @@ type Server struct {
3131 Network string // tcp/udp/unix
3232 Address string
3333 Options []gnet.Option
34- SoftLimit uint64
35- HardLimit uint64
3634 Status config.Status
3735 TickInterval time.Duration
3836}
@@ -106,22 +104,6 @@ func (s *Server) OnOpen(gconn gnet.Conn) ([]byte, gnet.Action) {
106104 }
107105 span .AddEvent ("Ran the OnOpening hooks" )
108106
109- // Check if the server is at the soft or hard limit.
110- // TODO: Get rid the hard/soft limit.
111- if s .SoftLimit > 0 && uint64 (s .engine .CountConnections ()) >= s .SoftLimit {
112- s .logger .Warn ().Msg ("Soft limit reached" )
113- }
114-
115- if s .HardLimit > 0 && uint64 (s .engine .CountConnections ()) >= s .HardLimit {
116- s .logger .Error ().Msg ("Hard limit reached" )
117- _ , err := gconn .Write ([]byte ("Hard limit reached\n " ))
118- if err != nil {
119- s .logger .Error ().Err (err ).Msg ("Failed to write to connection" )
120- span .RecordError (err )
121- }
122- return nil , gnet .Close
123- }
124-
125107 // Use the proxy to connect to the backend. Close the connection if the pool is exhausted.
126108 // This effectively get a connection from the pool and puts both the incoming and the server
127109 // connections in the pool of the busy connections.
@@ -417,7 +399,6 @@ func (s *Server) IsRunning() bool {
417399func NewServer (
418400 ctx context.Context ,
419401 network , address string ,
420- softLimit , hardLimit uint64 ,
421402 tickInterval time.Duration ,
422403 options []gnet.Option ,
423404 proxy IProxy ,
@@ -436,8 +417,6 @@ func NewServer(
436417 Options : options ,
437418 TickInterval : tickInterval ,
438419 Status : config .Stopped ,
439- HardLimit : hardLimit ,
440- SoftLimit : softLimit ,
441420 proxy : proxy ,
442421 logger : logger ,
443422 pluginRegistry : pluginRegistry ,
0 commit comments