Skip to content

Commit 2b80d89

Browse files
committed
Add return to onMessage callback
1 parent 053087a commit 2b80d89

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/Ubiquity/servers/workerman/WorkermanServer.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,34 +113,34 @@ public function run($host, $port, $options = []) {
113113
$this->server=new Worker("http://$host:$port",$this->options);
114114
$this->server->count=$this->wCount??4;
115115
$this->server->onMessage =function($connection,$datas){
116-
$this->handle($connection,$datas);
116+
return $this->handle($connection,$datas);
117117
};
118118
Worker::runAll();
119119
}
120120

121121

122122
protected function handle(ConnectionInterface $connection,$datas) {
123-
$_REQUEST['REQUEST_TIME_FLOAT']=\microtime(true);
124-
Http::header('Date: '.gmdate('D, d M Y H:i:s').' GMT');
123+
//$_REQUEST['REQUEST_TIME_FLOAT']=\microtime(true);
124+
//Http::header('Date: '.gmdate('D, d M Y H:i:s').' GMT');
125125
$_GET['c'] = '';
126126
$uri = \ltrim(\urldecode(\parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)), '/');
127127
if (($uri == null || ! ($fe=\file_exists($this->basedir . '/../' . $uri))) && ($uri!='favicon.ico')) {
128128
$_GET['c'] = $uri;
129129
} else {
130130
if($fe){
131131
Http::header('Content-Type: '. HttpCache::$header['Accept'] ?? 'text/html; charset=utf-8',true);
132-
$connection->send(\file_get_contents($this->basedir . '/../' . $uri));
132+
return $connection->send(\file_get_contents($this->basedir . '/../' . $uri));
133133
}else{
134134
Http::header('Content-Type: '. HttpCache::$header['Accept'] ?? 'text/html; charset=utf-8',true,404);
135-
$connection->send($uri.' not found!');
135+
return $connection->send($uri.' not found!');
136136
}
137137
return;
138138
}
139139

140140
$this->httpInstance->setDatas($datas);
141141
\ob_start();
142142
\Ubiquity\controllers\Startup::forward($_GET['c']);
143-
$connection->send(\ob_get_clean());
143+
return $connection->send(\ob_get_clean());
144144
}
145145
/**
146146
* Sets the worker count

0 commit comments

Comments
 (0)