walkor il y a 10 ans
Parent
commit
19188d1e92

+ 12 - 0
Applications/SimpleChat/start_web_server.php

@@ -1,4 +1,16 @@
 <?php 
+/**
+ * This file is part of workerman.
+ *
+ * Licensed under The MIT License
+ * For full copyright and license information, please see the MIT-LICENSE.txt
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @author walkor<walkor@workerman.net>
+ * @copyright walkor<walkor@workerman.net>
+ * @link http://www.workerman.net/
+ * @license http://www.opensource.org/licenses/mit-license.php MIT License
+ */
 use \Workerman\Worker;
 use \Workerman\WebServer;
 use \Workerman\Autoloader;

+ 12 - 0
Applications/SimpleChat/start_websocket_server.php

@@ -1,4 +1,16 @@
 <?php 
+/**
+ * This file is part of workerman.
+ *
+ * Licensed under The MIT License
+ * For full copyright and license information, please see the MIT-LICENSE.txt
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @author walkor<walkor@workerman.net>
+ * @copyright walkor<walkor@workerman.net>
+ * @link http://www.workerman.net/
+ * @license http://www.opensource.org/licenses/mit-license.php MIT License
+ */
 use \Workerman\Worker;
 use \Workerman\Autoloader;
 

+ 12 - 0
GatewayWorker/BusinessWorker.php

@@ -1,4 +1,16 @@
 <?php
+/**
+ * This file is part of workerman.
+ *
+ * Licensed under The MIT License
+ * For full copyright and license information, please see the MIT-LICENSE.txt
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @author walkor<walkor@workerman.net>
+ * @copyright walkor<walkor@workerman.net>
+ * @link http://www.workerman.net/
+ * @license http://www.opensource.org/licenses/mit-license.php MIT License
+ */
 namespace GatewayWorker;
 
 use Workerman\Connection\TcpConnection;

+ 12 - 0
GatewayWorker/Gateway.php

@@ -1,4 +1,16 @@
 <?php 
+/**
+ * This file is part of workerman.
+ *
+ * Licensed under The MIT License
+ * For full copyright and license information, please see the MIT-LICENSE.txt
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @author walkor<walkor@workerman.net>
+ * @copyright walkor<walkor@workerman.net>
+ * @link http://www.workerman.net/
+ * @license http://www.opensource.org/licenses/mit-license.php MIT License
+ */
 namespace GatewayWorker;
 
 use Workerman\Connection\TcpConnection;

+ 13 - 1
GatewayWorker/Lib/Context.php

@@ -1,8 +1,20 @@
 <?php
+/**
+ * This file is part of workerman.
+ *
+ * Licensed under The MIT License
+ * For full copyright and license information, please see the MIT-LICENSE.txt
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @author walkor<walkor@workerman.net>
+ * @copyright walkor<walkor@workerman.net>
+ * @link http://www.workerman.net/
+ * @license http://www.opensource.org/licenses/mit-license.php MIT License
+ */
 namespace GatewayWorker\Lib;
+
 /**
  * 上下文 包含当前用户uid, 内部通信local_ip local_port socket_id ,以及客户端client_ip client_port
- * @author walkor
  */
 class Context
 {

+ 13 - 1
GatewayWorker/Lib/Db.php

@@ -1,8 +1,20 @@
 <?php
+/**
+ * This file is part of workerman.
+ *
+ * Licensed under The MIT License
+ * For full copyright and license information, please see the MIT-LICENSE.txt
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @author walkor<walkor@workerman.net>
+ * @copyright walkor<walkor@workerman.net>
+ * @link http://www.workerman.net/
+ * @license http://www.opensource.org/licenses/mit-license.php MIT License
+ */
 namespace GatewayWorker\Lib;
+
 /**
  * 数据库类
- * @author walkor <walkor@workerman.net>
  */
 class Db
 {

+ 13 - 3
GatewayWorker/Lib/Gateway.php

@@ -1,10 +1,20 @@
 <?php
+/**
+ * This file is part of workerman.
+ *
+ * Licensed under The MIT License
+ * For full copyright and license information, please see the MIT-LICENSE.txt
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @author walkor<walkor@workerman.net>
+ * @copyright walkor<walkor@workerman.net>
+ * @link http://www.workerman.net/
+ * @license http://www.opensource.org/licenses/mit-license.php MIT License
+ */
 namespace GatewayWorker\Lib;
+
 /**
- * 
  * 数据发送相关
- * @author walkor <walkor@workerman.net>
- * 
  */
 use \Workerman\Protocols\GatewayProtocol;
 use \GatewayWorker\Lib\Store;

+ 12 - 0
GatewayWorker/Lib/Lock.php

@@ -1,4 +1,16 @@
 <?php
+/**
+ * This file is part of workerman.
+ *
+ * Licensed under The MIT License
+ * For full copyright and license information, please see the MIT-LICENSE.txt
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @author walkor<walkor@workerman.net>
+ * @copyright walkor<walkor@workerman.net>
+ * @link http://www.workerman.net/
+ * @license http://www.opensource.org/licenses/mit-license.php MIT License
+ */
 namespace GatewayWorker\Lib;
 /**
  * 锁

+ 13 - 1
GatewayWorker/Lib/Store.php

@@ -1,9 +1,21 @@
 <?php
+/**
+ * This file is part of workerman.
+ *
+ * Licensed under The MIT License
+ * For full copyright and license information, please see the MIT-LICENSE.txt
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @author walkor<walkor@workerman.net>
+ * @copyright walkor<walkor@workerman.net>
+ * @link http://www.workerman.net/
+ * @license http://www.opensource.org/licenses/mit-license.php MIT License
+ */
 namespace GatewayWorker\Lib;
+
 /**
  * 存储类
  * 这里用memcache实现
- * @author walkor <walkor@workerman.net>
  */
 class Store
 {

+ 12 - 3
GatewayWorker/Lib/StoreDriver/File.php

@@ -1,12 +1,21 @@
 <?php
+/**
+ * This file is part of workerman.
+ *
+ * Licensed under The MIT License
+ * For full copyright and license information, please see the MIT-LICENSE.txt
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @author walkor<walkor@workerman.net>
+ * @copyright walkor<walkor@workerman.net>
+ * @link http://www.workerman.net/
+ * @license http://www.opensource.org/licenses/mit-license.php MIT License
+ */
 namespace GatewayWorker\Lib\StoreDriver;
 
 /**
- * 
  * 这里用php数组文件来存储数据,
  * 为了获取高性能需要用类似memcache的存储
- * @author walkor <walkor@workerman.net>
- * 
  */
 
 class File

+ 12 - 1
GatewayWorker/Lib/StoreDriver/Redis.php

@@ -1,8 +1,19 @@
 <?php
+/**
+ * This file is part of workerman.
+ *
+ * Licensed under The MIT License
+ * For full copyright and license information, please see the MIT-LICENSE.txt
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @author walkor<walkor@workerman.net>
+ * @copyright walkor<walkor@workerman.net>
+ * @link http://www.workerman.net/
+ * @license http://www.opensource.org/licenses/mit-license.php MIT License
+ */
 namespace GatewayWorker\Lib\StoreDriver;
 
 /**
- * 
  * Redis
  */
 

+ 12 - 0
Workerman/Autoloader.php

@@ -1,4 +1,16 @@
 <?php
+/**
+ * This file is part of workerman.
+ *
+ * Licensed under The MIT License
+ * For full copyright and license information, please see the MIT-LICENSE.txt
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @author walkor<walkor@workerman.net>
+ * @copyright walkor<walkor@workerman.net>
+ * @link http://www.workerman.net/
+ * @license http://www.opensource.org/licenses/mit-license.php MIT License
+ */
 namespace Workerman;
 
 // 定义Workerman根目录

+ 12 - 1
Workerman/Connection/AsyncTcpConnection.php

@@ -1,4 +1,16 @@
 <?php
+/**
+ * This file is part of workerman.
+ *
+ * Licensed under The MIT License
+ * For full copyright and license information, please see the MIT-LICENSE.txt
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @author walkor<walkor@workerman.net>
+ * @copyright walkor<walkor@workerman.net>
+ * @link http://www.workerman.net/
+ * @license http://www.opensource.org/licenses/mit-license.php MIT License
+ */
 namespace Workerman\Connection;
 
 use Workerman\Events\Libevent;
@@ -9,7 +21,6 @@ use \Exception;
 
 /**
  * 异步tcp连接类 
- * @author walkor<walkor@workerman.net>
  */
 class AsyncTcpConnection extends TcpConnection
 {

+ 13 - 1
Workerman/Connection/ConnectionInterface.php

@@ -1,5 +1,18 @@
 <?php
+/**
+ * This file is part of workerman.
+ *
+ * Licensed under The MIT License
+ * For full copyright and license information, please see the MIT-LICENSE.txt
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @author walkor<walkor@workerman.net>
+ * @copyright walkor<walkor@workerman.net>
+ * @link http://www.workerman.net/
+ * @license http://www.opensource.org/licenses/mit-license.php MIT License
+ */
 namespace Workerman\Connection;
+
 use Workerman\Events\Libevent;
 use Workerman\Events\Select;
 use Workerman\Events\EventInterface;
@@ -8,7 +21,6 @@ use \Exception;
 
 /**
  * connection类的接口 
- * @author walkor<walkor@workerman.net>
  */
 abstract class  ConnectionInterface
 {

+ 12 - 1
Workerman/Connection/TcpConnection.php

@@ -1,4 +1,16 @@
 <?php
+/**
+ * This file is part of workerman.
+ *
+ * Licensed under The MIT License
+ * For full copyright and license information, please see the MIT-LICENSE.txt
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @author walkor<walkor@workerman.net>
+ * @copyright walkor<walkor@workerman.net>
+ * @link http://www.workerman.net/
+ * @license http://www.opensource.org/licenses/mit-license.php MIT License
+ */
 namespace Workerman\Connection;
 
 use Workerman\Events\Libevent;
@@ -9,7 +21,6 @@ use \Exception;
 
 /**
  * Tcp连接类 
- * @author walkor<walkor@workerman.net>
  */
 class TcpConnection extends ConnectionInterface
 {

+ 12 - 1
Workerman/Connection/UdpConnection.php

@@ -1,4 +1,16 @@
 <?php
+/**
+ * This file is part of workerman.
+ *
+ * Licensed under The MIT License
+ * For full copyright and license information, please see the MIT-LICENSE.txt
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @author walkor<walkor@workerman.net>
+ * @copyright walkor<walkor@workerman.net>
+ * @link http://www.workerman.net/
+ * @license http://www.opensource.org/licenses/mit-license.php MIT License
+ */
 namespace Workerman\Connection;
 
 use Workerman\Events\Libevent;
@@ -9,7 +21,6 @@ use \Exception;
 
 /**
  * udp连接类(udp实际上是无连接的,这里是为了保持与TCP接口一致) 
- * @author walkor<walkor@workerman.net>
  */
 class UdpConnection extends ConnectionInterface
 {

+ 12 - 0
Workerman/Events/EventInterface.php

@@ -1,4 +1,16 @@
 <?php
+/**
+ * This file is part of workerman.
+ *
+ * Licensed under The MIT License
+ * For full copyright and license information, please see the MIT-LICENSE.txt
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @author walkor<walkor@workerman.net>
+ * @copyright walkor<walkor@workerman.net>
+ * @link http://www.workerman.net/
+ * @license http://www.opensource.org/licenses/mit-license.php MIT License
+ */
 namespace Workerman\Events;
 
 interface EventInterface

+ 14 - 2
Workerman/Events/Libevent.php

@@ -1,8 +1,20 @@
 <?php 
+/**
+ * This file is part of workerman.
+ *
+ * Licensed under The MIT License
+ * For full copyright and license information, please see the MIT-LICENSE.txt
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @author walkor<walkor@workerman.net>
+ * @copyright walkor<walkor@workerman.net>
+ * @link http://www.workerman.net/
+ * @license http://www.opensource.org/licenses/mit-license.php MIT License
+ */
 namespace Workerman\Events;
+
 /**
- * libevent
- * @author walkor <walkor@workerman.net>
+ * libevent eventloop
  */
 class Libevent implements EventInterface
 {

+ 15 - 0
Workerman/Events/Select.php

@@ -1,6 +1,21 @@
 <?php
+/**
+ * This file is part of workerman.
+ *
+ * Licensed under The MIT License
+ * For full copyright and license information, please see the MIT-LICENSE.txt
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @author walkor<walkor@workerman.net>
+ * @copyright walkor<walkor@workerman.net>
+ * @link http://www.workerman.net/
+ * @license http://www.opensource.org/licenses/mit-license.php MIT License
+ */
 namespace Workerman\Events;
 
+/**
+ * select eventloop
+ */
 class Select implements EventInterface
 {
     /**

+ 13 - 0
Workerman/Lib/Constants.php

@@ -1,4 +1,17 @@
 <?php
+/**
+ * This file is part of workerman.
+ *
+ * Licensed under The MIT License
+ * For full copyright and license information, please see the MIT-LICENSE.txt
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @author walkor<walkor@workerman.net>
+ * @copyright walkor<walkor@workerman.net>
+ * @link http://www.workerman.net/
+ * @license http://www.opensource.org/licenses/mit-license.php MIT License
+ */
+
 // 如果ini没设置时区,则设置一个默认的
 if(!ini_get('date.timezone') )
 {

+ 13 - 8
Workerman/Lib/Timer.php

@@ -1,20 +1,25 @@
 <?php
+/**
+ * This file is part of workerman.
+ *
+ * Licensed under The MIT License
+ * For full copyright and license information, please see the MIT-LICENSE.txt
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @author walkor<walkor@workerman.net>
+ * @copyright walkor<walkor@workerman.net>
+ * @link http://www.workerman.net/
+ * @license http://www.opensource.org/licenses/mit-license.php MIT License
+ */
 namespace Workerman\Lib;
 use \Workerman\Events\EventInterface;
 use \Exception;
 
 /**
- * 
  * 定时器
  * 
- * <b>example:</b>
- * <pre>
- * <code>
- * Workerman\Lib\Timer::init();
+ * example:
  * Workerman\Lib\Timer::add($time_interval, callback, array($arg1, $arg2..));
- * <code>
- * </pre>
-* @author walkor <walkor@workerman.net>
  */
 class Timer 
 {

+ 13 - 3
Workerman/Protocols/GatewayProtocol.php

@@ -1,5 +1,18 @@
 <?php 
+/**
+ * This file is part of workerman.
+ *
+ * Licensed under The MIT License
+ * For full copyright and license information, please see the MIT-LICENSE.txt
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @author walkor<walkor@workerman.net>
+ * @copyright walkor<walkor@workerman.net>
+ * @link http://www.workerman.net/
+ * @license http://www.opensource.org/licenses/mit-license.php MIT License
+ */
 namespace Workerman\Protocols;
+
 /**
  * Gateway与Worker间通讯的二进制协议
  * 
@@ -18,10 +31,7 @@ namespace Workerman\Protocols;
  *     char[pack_length-HEAD_LEN] body//包体
  * }
  * 
- * 
- * @author walkor <walkor@workerman.net>
  */
-
 class GatewayProtocol
 {
     // 发给worker,gateway有一个新的连接

+ 12 - 1
Workerman/Protocols/Http.php

@@ -1,11 +1,22 @@
 <?php 
+/**
+ * This file is part of workerman.
+ *
+ * Licensed under The MIT License
+ * For full copyright and license information, please see the MIT-LICENSE.txt
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @author walkor<walkor@workerman.net>
+ * @copyright walkor<walkor@workerman.net>
+ * @link http://www.workerman.net/
+ * @license http://www.opensource.org/licenses/mit-license.php MIT License
+ */
 namespace  Workerman\Protocols;
 
 use Workerman\Connection\TcpConnection;
 
 /**
  * http protocol
- * @author walkor<walkor@workerman.net>
  */
 class Http
 {

+ 12 - 1
Workerman/Protocols/ProtocolInterface.php

@@ -1,11 +1,22 @@
 <?php
+/**
+ * This file is part of workerman.
+ *
+ * Licensed under The MIT License
+ * For full copyright and license information, please see the MIT-LICENSE.txt
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @author walkor<walkor@workerman.net>
+ * @copyright walkor<walkor@workerman.net>
+ * @link http://www.workerman.net/
+ * @license http://www.opensource.org/licenses/mit-license.php MIT License
+ */
 namespace Workerman\Protocols;
 
 use \Workerman\Connection\ConnectionInterface;
 
 /**
  * Protocol interface
-* @author walkor <walkor@workerman.net>
  */
 interface ProtocolInterface
 {

+ 12 - 1
Workerman/Protocols/Text.php

@@ -1,4 +1,16 @@
 <?php 
+/**
+ * This file is part of workerman.
+ *
+ * Licensed under The MIT License
+ * For full copyright and license information, please see the MIT-LICENSE.txt
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @author walkor<walkor@workerman.net>
+ * @copyright walkor<walkor@workerman.net>
+ * @link http://www.workerman.net/
+ * @license http://www.opensource.org/licenses/mit-license.php MIT License
+ */
 namespace Workerman\Protocols;
 use \Workerman\Connection\TcpConnection;
 
@@ -7,7 +19,6 @@ use \Workerman\Connection\TcpConnection;
  * 以换行为请求结束标记
  * @author walkor <walkor@workerman.net>
  */
-
 class Text
 {
     /**

+ 14 - 3
Workerman/Protocols/Websocket.php

@@ -1,12 +1,23 @@
 <?php 
-namespace Workerman\Protocols;
 /**
- * WebSocket 协议服务端解包和打包
- * @author walkor <walkor@workerman.net>
+ * This file is part of workerman.
+ *
+ * Licensed under The MIT License
+ * For full copyright and license information, please see the MIT-LICENSE.txt
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @author walkor<walkor@workerman.net>
+ * @copyright walkor<walkor@workerman.net>
+ * @link http://www.workerman.net/
+ * @license http://www.opensource.org/licenses/mit-license.php MIT License
  */
+namespace Workerman\Protocols;
 
 use Workerman\Connection\ConnectionInterface;
 
+/**
+ * WebSocket 协议服务端解包和打包
+ */
 class Websocket implements \Workerman\Protocols\ProtocolInterface
 {
     /**

+ 12 - 2
Workerman/WebServer.php

@@ -1,4 +1,16 @@
 <?php
+/**
+ * This file is part of workerman.
+ *
+ * Licensed under The MIT License
+ * For full copyright and license information, please see the MIT-LICENSE.txt
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @author walkor<walkor@workerman.net>
+ * @copyright walkor<walkor@workerman.net>
+ * @link http://www.workerman.net/
+ * @license http://www.opensource.org/licenses/mit-license.php MIT License
+ */
 namespace Workerman;
 
 use \Workerman\Worker;
@@ -10,8 +22,6 @@ use \Workerman\Protocols\HttpCache;
  *  基于Worker实现的一个简单的WebServer
  *  支持静态文件、支持文件上传、支持POST
  *  HTTP协议
- *  
- * @author walkor <walkor@workerman.net>
  */
 class WebServer extends Worker
 {

+ 15 - 3
Workerman/Worker.php

@@ -1,4 +1,16 @@
 <?php
+/**
+ * This file is part of workerman.
+ *
+ * Licensed under The MIT License
+ * For full copyright and license information, please see the MIT-LICENSE.txt
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @author walkor<walkor@workerman.net>
+ * @copyright walkor<walkor@workerman.net>
+ * @link http://www.workerman.net/
+ * @license http://www.opensource.org/licenses/mit-license.php MIT License
+ */
 namespace Workerman;
 
 use \Workerman\Events\Libevent;
@@ -12,8 +24,8 @@ use \Workerman\Autoloader;
 use \Exception;
 
 /**
- * 
- * @author walkor<walkor@workerman.net>
+ * Worker 类
+ * 是一个容器,用于监听端口,维持客户端连接
  */
 class Worker
 {
@@ -1008,7 +1020,7 @@ class Worker
         
         // 子进程部分
         $worker = current(self::$_workers);
-        $wrker_status_str = posix_getpid()."\t".str_pad(round(memory_get_usage()/(1024*1024),2)."M", 7)." " .str_pad($worker->getSocketName(), self::$_maxSocketNameLength) ." ".str_pad(($worker->name === $worker->getSocketName() ? 'none' : $worker->name), self::$_maxWorkerNameLength)." ";
+        $wrker_status_str = posix_getpid()."\t".str_pad(round(memory_get_usage(true)/(1024*1024),2)."M", 7)." " .str_pad($worker->getSocketName(), self::$_maxSocketNameLength) ." ".str_pad(($worker->name === $worker->getSocketName() ? 'none' : $worker->name), self::$_maxWorkerNameLength)." ";
         $wrker_status_str .= str_pad(ConnectionInterface::$statistics['connection_count'], 11)." ".str_pad(ConnectionInterface::$statistics['total_request'], 14)." ".str_pad(ConnectionInterface::$statistics['send_fail'],9)." ".str_pad(ConnectionInterface::$statistics['throw_exception'],15)."\n";
         file_put_contents(self::$_statisticsFile, $wrker_status_str, FILE_APPEND);
     }