Explorar el Código

Merge pull request #4 from walkor/master

merge Update
Leonardo hace 8 años
padre
commit
053bb4bc32
Se han modificado 6 ficheros con 17 adiciones y 11 borrados
  1. 3 2
      Connection/AsyncTcpConnection.php
  2. 2 2
      Connection/TcpConnection.php
  3. 6 1
      Lib/Constants.php
  4. 1 1
      README.md
  5. 1 1
      WebServer.php
  6. 4 4
      Worker.php

+ 3 - 2
Connection/AsyncTcpConnection.php

@@ -277,8 +277,9 @@ class AsyncTcpConnection extends TcpConnection
             if ($this->_sendBuffer) {
                 Worker::$globalEvent->add($socket, EventInterface::EV_WRITE, array($this, 'baseWrite'));
             }
-            $this->_status        = self::STATUS_ESTABLISH;
-            $this->_remoteAddress = $address;
+            $this->_status                = self::STATUS_ESTABLISH;
+            $this->_remoteAddress         = $address;
+            $this->_sslHandshakeCompleted = true;
 
             // Try to emit onConnect callback.
             if ($this->onConnect) {

+ 2 - 2
Connection/TcpConnection.php

@@ -403,10 +403,10 @@ class TcpConnection extends ConnectionInterface
                 try {
                     call_user_func($this->onSslHandshake, $this);
                 } catch (\Exception $e) {
-                    self::log($e);
+                    Worker::log($e);
                     exit(250);
                 } catch (\Error $e) {
-                    self::log($e);
+                    Worker::log($e);
                     exit(250);
                 }
             }

+ 6 - 1
Lib/Constants.php

@@ -21,6 +21,11 @@ ini_set('display_errors', 'on');
 // Reporting all.
 error_reporting(E_ALL);
 
+// Reset opcache.
+if (function_exists('opcache_reset')) {
+    opcache_reset();
+}
+
 // For onError callback.
 define('WORKERMAN_CONNECT_FAIL', 1);
 // For onError callback.
@@ -32,4 +37,4 @@ if(!class_exists('Error'))
     class Error extends Exception
     {
     }
-}
+}

+ 1 - 1
README.md

@@ -2,7 +2,7 @@
 [![Gitter](https://badges.gitter.im/walkor/Workerman.svg)](https://gitter.im/walkor/Workerman?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=body_badge)
 
 ## What is it
-Workerman is an asynchronous event driven PHP framework with high performance for easily building fast, scalable network applications.Supports HTTP, Websocket and other custom protocols. Supports libevent, HHVM, [ReactPHP](https://github.com/reactphp/react).
+Workerman is an asynchronous event driven PHP framework with high performance for easily building fast, scalable network applications. Supports HTTP, Websocket and other custom protocols. Supports libevent, HHVM, [ReactPHP](https://github.com/reactphp/react).
 
 ## Requires
 

+ 1 - 1
WebServer.php

@@ -232,7 +232,7 @@ class WebServer extends Worker
     {
         // Check 304.
         $info = stat($file_path);
-        $modified_time = $info ? date('D, d M Y H:i:s', $info['mtime']) . ' GMT' : '';
+        $modified_time = $info ? date('D, d M Y H:i:s', $info['mtime']) . ' ' . date_default_timezone_get() : '';
         if (!empty($_SERVER['HTTP_IF_MODIFIED_SINCE']) && $info) {
             // Http 304.
             if ($modified_time === $_SERVER['HTTP_IF_MODIFIED_SINCE']) {

+ 4 - 4
Worker.php

@@ -33,7 +33,7 @@ class Worker
      *
      * @var string
      */
-    const VERSION = '3.4.0';
+    const VERSION = '3.4.1';
 
     /**
      * Status starting.
@@ -606,7 +606,7 @@ class Worker
         if (self::$daemonize) {
             global $argv;
             $start_file = $argv[0];
-            self::safeEcho("Input \"php $start_file stop\" to quit. Start success.\n");
+            self::safeEcho("Input \"php $start_file stop\" to quit. Start success.\n\n");
         } else {
             self::safeEcho("Press Ctrl-C to quit. Start success.\n");
         }
@@ -811,7 +811,7 @@ class Worker
      *
      * @throws Exception
      */
-    protected static function resetStd()
+    public static function resetStd()
     {
         if (!self::$daemonize) {
             return;
@@ -878,7 +878,7 @@ class Worker
                 self::$eventLoopClass = self::$_availableEventLoops[$loop_name];
             }
         } else {
-            self::$eventLoopClass = '\Workerman\Events\Select';
+            self::$eventLoopClass = interface_exists('\React\EventLoop\LoopInterface')? '\Workerman\Events\React\StreamSelectLoop':'\Workerman\Events\Select';
         }
         return self::$eventLoopClass;
     }