|
|
@@ -874,6 +874,19 @@ class TcpConnection extends ConnectionInterface
|
|
|
*/
|
|
|
public function __destruct()
|
|
|
{
|
|
|
+ static $mod;
|
|
|
self::$statistics['connection_count']--;
|
|
|
+ if(Worker::getGracefulStop() && Worker::getStatus() === Worker::STATUS_SHUTDOWN){
|
|
|
+ if(!isset($mod)){
|
|
|
+ $mod=round((self::$statistics['connection_count']+1)/3);
|
|
|
+ }
|
|
|
+ if(0 === self::$statistics['connection_count']%$mod){
|
|
|
+ Worker::log('worker('.posix_getpid().') remains '.self::$statistics['connection_count'].' connection(s)'."\r");
|
|
|
+ }
|
|
|
+ if(0 === self::$statistics['connection_count']){
|
|
|
+ Worker::$globalEvent->destroy();
|
|
|
+ exit(0);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|