@@ -36,7 +36,7 @@ public class Gateway : IDisposable
3636
3737 public const int URL_FILTER_ERROR = 593 ;
3838
39- public const int IP_LIMITS_ERROR = 594 ;
39+ public const int IP_LIMITS_ERROR = 509 ;
4040
4141 public const int URL_LIMITS_ERROR = 595 ;
4242
@@ -58,7 +58,7 @@ public class Gateway : IDisposable
5858
5959 public int BufferSize { get ; set ; } = 1024 * 4 ;
6060
61- public int PoolMaxSize { get ; set ; } = 1024 * 50 ;
61+ public int PoolMaxSize { get ; set ; } = 1024 * 500 ;
6262
6363 static Gateway ( )
6464 {
@@ -76,14 +76,15 @@ public Gateway()
7676 Statistics . Server = "Gateway" ;
7777 AgentMaxSocketError = 3 ;
7878 MaxStatsUrls = 20000 ;
79- AgentMaxConnection = 200 ;
79+ AgentMaxConnection = 500 ;
8080 AgentRequestQueueSize = 500 ;
8181 ThreadQueues = ( Environment . ProcessorCount / 2 ) ;
8282 if ( ThreadQueues == 0 )
8383 ThreadQueues = 1 ;
8484 GatewayQueueSize = Environment . ProcessorCount * 100 ;
8585 InstanceID = Guid . NewGuid ( ) . ToString ( "N" ) ;
86- GATEWAY_VERSION = $ "beetlex.io[{ typeof ( BeetleX . BXException ) . Assembly . GetName ( ) . Version } /{ HttpServer . GetType ( ) . Assembly . GetName ( ) . Version } /{ GetType ( ) . Assembly . GetName ( ) . Version } ]";
86+ GATEWAY_VERSION = $ "beetlex.io";
87+ TimeoutFactory = new TimeoutFactory ( this ) ;
8788
8889 }
8990
@@ -170,6 +171,8 @@ private void OnVerifyTimer(Object state)
170171
171172 public Servers . ServerCenter Agents { get ; private set ; }
172173
174+ internal Servers . TimeoutFactory TimeoutFactory { get ; private set ; }
175+
173176 public Statistics Statistics { get ; private set ; } = new Statistics ( ) ;
174177
175178 public Servers . ServerAgent SetServer ( string host , string category , string remark , int maxConnections = 200 )
@@ -359,19 +362,19 @@ internal void OnResponseError(EventResponseErrorArgs e)
359362 ) ;
360363 Pluginer . Requested ( se ) ;
361364 }
362- RequestIncrementCompleted ( e . Request , e . ErrorCode , 1 , null ) ;
363365 this . Pluginer . ResponseError ( e ) ;
364366 if ( e . Result != null )
365367 {
366368 e . Response . Result ( e . Result ) ;
367369 }
370+ RequestIncrementCompleted ( e . Request , e . ErrorCode , 1 , null ) ;
368371 }
369372
370373 internal void OnRequestCompleted ( Servers . RequestAgent success )
371374 {
372375 try
373376 {
374- ServerHttpRequested . Invoke ( this , success ) ;
377+ ServerHttpRequested ? . Invoke ( this , success ) ;
375378 }
376379 catch ( Exception e_ )
377380 {
@@ -381,6 +384,7 @@ internal void OnRequestCompleted(Servers.RequestAgent success)
381384 $ "Gateway { success . Request . ID } { success . Request . RemoteIPAddress } { success . Request . Method } { success . Request . Url } error { e_ . Message } @{ e_ . StackTrace } ") ;
382385 }
383386 }
387+ HttpServer . IncrementResponsed ( success . Request , null , success . Time , success . Code , success . Message ) ;
384388 RequestIncrementCompleted ( success . Request , success . Code , success . Time , success . Server ) ;
385389 if ( Pluginer . RequestedEnabled )
386390 Pluginer . Requested ( success . GetEventRequestCompletedArgs ( ) ) ;
@@ -405,7 +409,6 @@ internal void OnResponding(RequestAgent request, ArraySegment<byte> data, bool c
405409
406410 public void RequestIncrementCompleted ( HttpRequest request , int code , long time , Servers . ServerAgent server = null )
407411 {
408- HttpServer . IncrementResponsed ( request , null , time , code , null ) ;
409412 if ( StatisticsEnabled )
410413 {
411414 Statistics . Add ( code , time ) ;
@@ -487,11 +490,21 @@ public void Open()
487490
488491 private void OutputLogo ( )
489492 {
490- AssemblyCopyrightAttribute productAttr = typeof ( BeetleX . BXException ) . Assembly . GetCustomAttribute < AssemblyCopyrightAttribute > ( ) ;
493+ AssemblyCopyrightAttribute productAttr = typeof ( Gateway ) . Assembly . GetCustomAttribute < AssemblyCopyrightAttribute > ( ) ;
491494 var logo = "\r \n " ;
492- logo += "*******************************************************************************\r \n " ;
493- logo += " BeetleX http and websocket gateway framework \r \n " ;
495+ logo += " -----------------------------------------------------------------------------\r \n " ;
496+ logo +=
497+ @" ____ _ _ __ __
498+ | _ \ | | | | \ \ / /
499+ | |_) | ___ ___ | |_ | | ___ \ V /
500+ | _ < / _ \ / _ \ | __| | | / _ \ > <
501+ | |_) | | __/ | __/ | |_ | | | __/ / . \
502+ |____/ \___| \___| \__| |_| \___| /_/ \_\
494503
504+ http and websocket gateway framework
505+
506+ " ;
507+ logo += " -----------------------------------------------------------------------------\r \n " ;
495508 logo += $ " { productAttr . Copyright } \r \n ";
496509 logo += $ " ServerGC [{ GCSettings . IsServerGC } ]\r \n ";
497510 logo += $ " BeetleX Version [{ typeof ( BeetleX . BXException ) . Assembly . GetName ( ) . Version } ]\r \n ";
@@ -502,7 +515,7 @@ private void OutputLogo()
502515 {
503516 logo += $ " { item } \r \n ";
504517 }
505- logo += "******************************************************************************* \r \n " ;
518+ logo += " ----------------------------------------------------------------------------- \r \n " ;
506519
507520 HttpServer . Log ( LogType . Info , logo ) ;
508521
0 commit comments