Changeset 17
- Timestamp:
- 10/06/08 16:24:06 (6 weeks ago)
- Location:
- flashunity
- Files:
-
- 7 modified
-
libraries/Flashunity/Base.php (modified) (1 diff)
-
libraries/Flashunity/Cli/Daemon.php (modified) (4 diffs)
-
libraries/Flashunity/Cli/Daemon/Info/options.php (modified) (1 diff)
-
libraries/Flashunity/Cli/Help.php (modified) (1 diff)
-
libraries/Flashunity/Comm/Socket.php (modified) (4 diffs)
-
libraries/Flashunity/Transport/Xml.php (modified) (2 diffs)
-
script/flashunity.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
flashunity/libraries/Flashunity/Base.php
r12 r17 1 1 <?php 2 /** 3 * 4 * Extention to the Solar Cli library 5 * 6 * @category Main 7 * @package Flashunity 8 * @author Richard Thomas <richard@phpjack.com> 9 * @version $Id$ 10 * @copyright Copyright (c) 2008, Richard Thomas. All rights reserved. 11 * @license http://www.phpjack.com 12 * @link http://www.phpjack.com 13 */ 14 2 15 class Flashunity_Base extends Solar_Cli_Base { 3 16 protected $_Flashunity_Base = array( -
flashunity/libraries/Flashunity/Cli/Daemon.php
r11 r17 1 1 <?php 2 /** 3 * 4 * Main daemon used to run the server 5 * 6 * @category Main 7 * @package Flashunity 8 * @author Richard Thomas <richard@phpjack.com> 9 * @version $Id$ 10 * @copyright Copyright (c) 2008, Richard Thomas. All rights reserved. 11 * @license http://www.phpjack.com 12 * @link http://www.phpjack.com 13 */ 2 14 3 15 4 16 class Flashunity_Cli_Daemon extends Flashunity_Base { 5 17 private $_tbalance_time = null; 6 7 18 public function __construct($config = null) { 8 19 parent::__construct($config); … … 16 27 $config['transport'] = 'tcp'; 17 28 $config['port'] = '9997'; 18 $config['address'] = ' localhost';29 $config['address'] = '10.0.1.203'; 19 30 $config['buffer'] = 1024; 20 31 $this->_tbalance_time = microtime(1); … … 24 35 $this->server->build_pool(); 25 36 $this->server->check_pool(); 26 $this->server->check_new_conn(); 27 $this->server->check_new_data(); 37 if($new = $this->server->check_new_conn()) { 38 foreach($new as $value) { 39 // $value = key we can use to reference for writes and such 40 // We should record this and reference it 41 } 42 } 43 $data = $this->server->check_new_data(); 44 foreach($data as $key => $value) { 45 $test = array(); 46 $test[1] = 'Testing'; 47 $test[2] = 'Whats up'; 48 $test[3][1] = 'Go Go'; 49 $test[3][2] = 'On On'; 50 $this->server->write_all(json_encode($test)); 51 echo "Writing\n"; 52 } 28 53 $this->_tbalance(); 29 54 } … … 37 62 usleep($this->_config['Performance']['Min_Time'] - $dtime); 38 63 } else { 39 $this->log('Flashunity_Deamon',Flashunity_Base::NORMAL,'Ran past min performance time ');64 $this->log('Flashunity_Deamon',Flashunity_Base::NORMAL,'Ran past min performance time by '.$dtime.' microseconds'); 40 65 } 66 $this->_tbalance_time = microtime(1); 41 67 } 42 68 -
flashunity/libraries/Flashunity/Cli/Daemon/Info/options.php
r11 r17 1 1 <?php 2 2 3 return array( 3 4 ); -
flashunity/libraries/Flashunity/Cli/Help.php
r11 r17 1 1 <?php 2 /** 3 * 4 * Simple Help Files 5 * 6 * @category Main 7 * @package Flashunity 8 * @author Richard Thomas <richard@phpjack.com> 9 * @version $Id$ 10 * @copyright Copyright (c) 2008, Richard Thomas. All rights reserved. 11 * @license http://www.phpjack.com 12 * @link http://www.phpjack.com 13 */ 2 14 3 15 class Flashunity_Cli_Help extends Flashunity_Base { -
flashunity/libraries/Flashunity/Comm/Socket.php
r11 r17 1 1 <?php 2 2 /** 3 * 4 * @category Comm 5 * @package Main 6 * @author Richard Thomas <cyberlot[AT]cyberlot.net> 7 * @license http://www.cyberlot.net 8 * 3 * 4 * Extention to the Solar Cli library 5 * 6 * @category Main 7 * @package Flashunity 8 * @author Richard Thomas <richard@phpjack.com> 9 * @version $Id$ 10 * @copyright Copyright (c) 2008, Richard Thomas. All rights reserved. 11 * @license http://www.phpjack.com 12 * @link http://www.phpjack.com 9 13 */ 14 10 15 class Flashunity_Comm_Socket extends FlashUnity_Base { 11 16 private $resource = NULL; … … 28 33 29 34 public function check_new_data() { 35 $data = array(); 30 36 while(list($key, $client) = each($this->cpool)) { 31 37 if(!is_object($client) OR !$client->resource) { … … 39 45 $rtval = $this->_read($client); 40 46 if($rtval) { 41 $this->_write_all($rtval); 47 $data[$key] = $rtval; 48 // $this->_write_all($rtval); 42 49 } 43 50 } 44 51 } 52 return $data; 53 } 54 55 public function write($ckey, $string) { 56 $this->_write($this->cpool[$ckey], $string); 57 } 58 59 public function write_all($string) { 60 $this->_write_all($string); 45 61 } 46 62 … … 78 94 $this->cpool[$key]->key = $key; 79 95 } 96 return $key; 80 97 } 81 98 82 99 public function check_new_conn() { 100 $new = NULL; 83 101 if(in_array($this->resource, $this->current)) { 84 $ this->_accept_conn();102 $new[] = $this->_accept_conn(); 85 103 } 104 return $new; 86 105 } 87 106 -
flashunity/libraries/Flashunity/Transport/Xml.php
r16 r17 1 1 <?php 2 2 /** 3 * 4 * @category Transport 5 * @package Main 6 * @author Richard Thomas <cyberlot[AT]cyberlot.net> 7 * @license http://www.cyberlot.net 8 * 3 * 4 * Extention to the Solar Cli library 5 * 6 * @category Main 7 * @package Flashunity 8 * @author Richard Thomas <richard@phpjack.com> 9 * @version $Id$ 10 * @copyright Copyright (c) 2008, Richard Thomas. All rights reserved. 11 * @license http://www.phpjack.com 12 * @link http://www.phpjack.com 9 13 */ 14 10 15 class Flashunity_Transport_XML extends Solar_Cli_Base { 11 16 … … 19 24 20 25 public function read($client, $string) { 21 return $string;26 return trim($string); 22 27 } 23 28 } -
flashunity/script/flashunity.php
r14 r17 1 1 #!/usr/bin/php 2 2 <?php 3 /** 4 * 5 * @category Main 6 * @package Flashunity 7 * @author Richard Thomas <richard@phpjack.com> 8 * @version $Id$ 9 * @copyright Copyright (c) 2008, Richard Thomas. All rights reserved. 10 * @license http://www.phpjack.com 11 * @link http://www.phpjack.com 12 */ 13 3 14 error_reporting(E_ALL); 4 15 // system trunk directory
