Closed
Description
diff --git a/Core/Lib/Checker.php b/Core/Lib/Checker.php
index 0018413..7489b6f 100755
--- a/Core/Lib/Checker.php
+++ b/Core/Lib/Checker.php
@@ -272,7 +272,7 @@ class Checker
public static function checkPidFile()
{
// 已经有进程pid可能server已经启动
- if(@file_get_contents(WORKERMAN_PID_FILE))
+ if(is_file(WORKERMAN_PID_FILE) && file_get_contents(WORKERMAN_PID_FILE))
{
\Man\Core\Master::notice("\033[33;40mWorkerman already started\033[0m", true);
exit;
diff --git a/Core/Master.php b/Core/Master.php
index da0e084..e4c4423 100755
--- a/Core/Master.php
+++ b/Core/Master.php
@@ -344,6 +344,7 @@ class Master
if(self::createOneWorker($worker_name) == 0)
{
self::notice("Worker exit unexpected");
+ sleep(5);
exit(500);
}
}
diff --git a/Core/SocketWorker.php b/Core/SocketWorker.php
index d469096..51d3691 100755
--- a/Core/SocketWorker.php
+++ b/Core/SocketWorker.php
@@ -201,7 +201,7 @@ abstract class SocketWorker extends AbstractWorker
$this->installSignal();
// 触发该worker进程onStart事件,该进程整个生命周期只触发一次
- if($this->onStart())
+ if(!$this->onStart())
{
return;
}
@@ -230,7 +230,7 @@ abstract class SocketWorker extends AbstractWorker
public function stop()
{
// 触发该worker进程onStop事件
- if($this->onStop())
+ if(!$this->onStop())
{
return;
}
diff --git a/bin/workermand b/bin/workermand
index 9a687f5..43fa9a5 100755
--- a/bin/workermand
+++ b/bin/workermand
@@ -172,7 +172,8 @@ function force_kill()
function stop_and_wait($wait_time = 6)
{
- $pid = @file_get_contents(WORKERMAN_PID_FILE);
+ $pid = "";
+ if(is_file(WORKERMAN_PID_FILE)) $pid = file_get_contents(WORKERMAN_PID_FILE);
if(empty($pid))
{
//exit("server not running?\n");