Permalink
Browse files

Docs, refactoring

  • Loading branch information...
1 parent 7ee7b85 commit d2bb8162ff191644f4e3cc63054d6d1d6da386b5 @kakserpom committed Mar 20, 2013
Showing with 65 additions and 13 deletions.
  1. +1 −1 lib/Daemon_IPCThread.php
  2. +63 −11 lib/NetworkClient.php
  3. +1 −1 lib/PPPDeflate.php
View
@@ -185,7 +185,7 @@ protected function update() {
}
/**
- * @todo description?
+ * Shutdown thread
* @param boolean - Hard? If hard, we shouldn't wait for graceful shutdown of the running applications.
* @return boolean - Ready?
*/
View
@@ -25,16 +25,38 @@ class NetworkClient extends ConnectionPool {
* @return array|false
*/
protected function getConfigDefaults() {
- return array(
- // @todo add description strings
+ return [
+ /**
+ * Expose?
+ * @var boolean
+ */
'expose' => 1,
+
+ /**
+ * Default servers
+ * @var boolean
+ */
'servers' => '127.0.0.1',
+
+ /**
+ * Default server
+ * @var boolean
+ */
'server' => '127.0.0.1',
+
+ /**
+ * Maximum connections per server
+ * @var boolean
+ */
'maxconnperserv' => 32
- );
+ ];
}
- public function applyConfig() {
+ /**
+ * Applies config
+ * @return void
+ */
+ protected function applyConfig() {
parent::applyConfig();
if (isset($this->config->servers)) {
$servers = array_filter(array_map('trim',explode(',', $this->config->servers->value)), 'strlen');
@@ -118,37 +140,67 @@ public function getConnection($url = null, $cb = null, $pri = 0) {
return true;
}
- public function detachConn($conn) {
- parent::detachConn($conn);
+ /**
+ * Detach Connection
+ * @param Connection
+ * @param [mixed Info]
+ * @return void
+ */
+ public function detach($conn) {
+ parent::detach($conn);
$this->touchPending($conn->url);
}
- public function markConnFree($conn, $url) {
+ /**
+ * Mark connection as free
+ * @param Connection
+ * @param URL
+ * @return void
+ */
+ public function markConnFree(NetworkClientConnection $conn, $url) {
if (!isset($this->servConnFree[$url])) {
return;
}
$this->servConnFree[$url]->attach($conn);
}
- public function markConnBusy($conn, $url) {
+
+ /**
+ * Mark connection as busy
+ * @param Connection
+ * @param URL
+ * @return void
+ */
+ public function markConnBusy(NetworkClientConnection $conn, $url) {
if (!isset($this->servConnFree[$url])) {
return;
}
$this->servConnFree[$url]->detach($conn);
}
- public function detachConnFromUrl($conn, $url) {
+ /**
+ * Detaches connection from URL
+ * @param Connection
+ * @param URL
+ * @return void
+ */
+ public function detachConnFromUrl(NetworkClientConnection $conn, $url) {
if (!isset($this->servConnFree[$url]) || !isset($this->servConn[$url])) {
return;
}
$this->servConnFree[$url]->detach($conn);
$this->servConn[$url]->detach($conn);
}
+
+ /**
+ * Touch pending "requests for connection"
+ * @param URL
+ * @return void
+ */
public function touchPending($url) {
while (isset($this->pending[$url]) && !$this->pending[$url]->isEmpty()) {
- $r = $this->getConnection($url, $this->pending[$url]->dequeue());
- if ($r === true) {
+ if (true === $this->getConnection($url, $this->pending[$url]->dequeue())) {
return;
}
}
View
@@ -1,2 +1,2 @@
<?php
-// todo RFC 1979
+// @TODO: RFC 1979

0 comments on commit d2bb816

Please sign in to comment.