]> git.mxchange.org Git - hub.git/commitdiff
Added experimental registration of sockets which have just appeared with a fake array
authorRoland Häder <roland@mxchange.org>
Sat, 19 May 2012 14:07:11 +0000 (14:07 +0000)
committerRoland Häder <roland@mxchange.org>
Sat, 19 May 2012 14:07:11 +0000 (14:07 +0000)
application/hub/main/package/class_NetworkPackage.php
application/hub/main/pools/peer/class_DefaultPeerPool.php

index 3a5b5caeb00f2a085f5150f237ceaf33bfa2cd34..9fa8cdd6725bf7c431e651a32c40259d434763a9 100644 (file)
@@ -108,6 +108,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R
        const PACKAGE_STATUS_NEW     = 'new';
        const PACKAGE_STATUS_FAILED  = 'failed';
        const PACKAGE_STATUS_DECODED = 'decoded';
+       const PACKAGE_STATUS_FAKED   = 'faked';
 
        /**
         * Constants for message data array
index 67b02b89c5ae1a518a656e1b8aa5a9edfbe1ee1e..6968fc2a902fd1a65861e63487c9a7d6aeecf9c8 100644 (file)
@@ -119,6 +119,20 @@ class DefaultPeerPool extends BasePool implements PoolablePeer {
                // Debug message
                $this->debugOutput('POOL: Adding peer ' . $peerName . ',socketResource=' . $socketResource);
 
+               // Create the fake array
+               $packageData = array(
+                       NetworkPackage::PACKAGE_DATA_SENDER    => $peerName . ':0',
+                       NetworkPackage::PACKAGE_DATA_RECIPIENT => $this->getSessionId(),
+                       NetworkPackage::PACKAGE_DATA_PROTOCOL  => $this->getListenerInstance()->getProtocol(),
+                       NetworkPackage::PACKAGE_DATA_STATUS    => NetworkPackage::PACKAGE_STATUS_FAKED
+               );
+
+               // Get a socket registry
+               $registryInstance = SocketRegistryFactory::createSocketRegistryInstance();
+
+               // Register the socket with the registry and with a half-fake array
+               $registryInstance->registerSocket($this->getListenerInstane(), $socketResource, $packageData);
+
                // Add it finally to the pool
                $this->addPoolEntry($socketResource);
        }