From 1f1e44aa3c9987756b7c16eb2b8ddd13c901b3ce Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Tue, 2 Jan 2018 23:49:06 +0100 Subject: [PATCH] Continued: - updated core framework to latest commit - ported main application to new framework with Tld\Domain\ namespace added and many many more - updated .gitignore - updated .gitattributes MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .gitattributes | 35 +- .gitignore | 1 + application/hub/class_ApplicationHelper.php | 25 +- application/hub/classes/apt-proxy/class_ | 4 +- .../apt-proxy/class_BaseNodeAptProxy.php | 4 +- .../console/class_NodeConsoleAptProxy.php | 8 +- .../hub/classes/blocks/class_BaseBlock.php | 4 +- .../chains/class_PackageFilterChain.php | 4 +- application/hub/classes/chat/class_ | 4 +- .../hub/classes/chat/class_BaseNodeChat.php | 4 +- .../chat/console/class_NodeConsoleChat.php | 8 +- .../hub/classes/class_BaseHubSystem.php | 33 +- .../classes/client/http/class_HttpClient.php | 2 +- .../class_HubConsoleAptProxyCommand.php | 18 +- .../console/class_HubConsoleChatCommand.php | 18 +- .../class_HubConsoleCrawlerCommand.php | 18 +- .../class_HubConsoleCruncherCommand.php | 18 +- .../console/class_HubConsoleMainCommand.php | 20 +- .../console/class_HubConsoleMinerCommand.php | 18 +- .../html/class_HubHtmlIndexCommand.php | 16 +- .../communicator/class_BaseCommunicator.php | 9 +- .../crawler/class_CrawlerNodeCommunicator.php | 4 +- .../miner/class_MinerNodeCommunicator.php | 4 +- ...lass_NetworkPackageCompressorDecorator.php | 6 +- .../container/class_BaseHubContainer.php | 23 +- .../socket/class_SocketContainer.php | 83 +++-- .../class_HubConsoleAptProxyController.php | 14 +- .../class_HubConsoleChatController.php | 14 +- .../class_HubConsoleCrawlerController.php | 14 +- .../class_HubConsoleCruncherController.php | 14 +- .../class_HubConsoleDefaultNewsController.php | 16 +- .../class_HubConsoleFuseController.php | 14 +- .../class_HubConsoleMinerController.php | 14 +- application/hub/classes/crawler/class_ | 2 +- .../classes/crawler/class_BaseNodeCrawler.php | 8 +- .../console/class_NodeConsoleCrawler.php | 8 +- application/hub/classes/cruncher/class_ | 2 +- .../cruncher/class_BaseHubCruncher.php | 10 +- .../mcrypt/class_HubMcryptCruncher.php | 10 +- .../frontend/class_BaseHubDatabaseWrapper.php | 21 +- .../class_CruncherUnitDatabaseWrapper.php | 8 +- ...odeDistributedHashTableDatabaseWrapper.php | 24 +- .../class_NodeInformationDatabaseWrapper.php | 20 +- .../class_PeerStateLookupDatabaseWrapper.php | 42 +-- .../hub/classes/decoder/class_BaseDecoder.php | 4 +- .../decoder/package/class_PackageDecoder.php | 18 +- application/hub/classes/dht/class_BaseDht.php | 12 +- .../classes/dht/node/class_NodeDhtFacade.php | 16 +- .../discovery/class_BaseNodeDiscovery.php | 12 +- .../class_UniversalNodeLocatorDiscovery.php | 10 +- .../protocol/class_ProtocolDiscovery.php | 10 +- .../class_BaseRecipientDiscovery.php | 8 +- .../dht/class_DhtRecipientDiscovery.php | 8 +- .../class_PackageRecipientDiscovery.php | 20 +- .../socket/class_PackageSocketDiscovery.php | 52 +-- .../chain/class_PackageFilterChainFactory.php | 6 +- .../chunks/class_ChunkHandlerFactory.php | 6 +- application/hub/classes/factories/class_ | 4 +- .../factories/client/class_ClientFactory.php | 10 +- .../class_CommunicatorFactory.php | 6 +- .../decoder/class_DecoderFactory.php | 10 +- .../factories/dht/class_DhtObjectFactory.php | 6 +- .../class_PackageDiscoveryFactory.php | 6 +- .../class_SocketDiscoveryFactory.php | 6 +- .../class_MessageTypeHandlerFactory.php | 6 +- .../handler/class_ProtocolHandlerFactory.php | 10 +- .../info/class_ConnectionInfoFactory.php | 20 +- .../lists/class_RecipientListFactory.php | 6 +- .../class_UniversalNodeLocatorFactory.php | 6 +- .../node/class_NodeObjectFactory.php | 12 +- .../class_PackageAssemblerFactory.php | 8 +- .../package/class_NetworkPackageFactory.php | 6 +- .../fragmenter/class_FragmenterFactory.php | 6 +- .../producer/class_ProducerFactory.php | 6 +- .../class_ObjectTypeRegistryFactory.php | 6 +- .../class_ProtocolResolverFactory.php | 10 +- .../scanner/class_ScannerObjectFactory.php | 8 +- .../factories/socket/class_SocketFactory.php | 38 ++- .../source/units/class_UnitSourceFactory.php | 6 +- .../url/class_UrlSourceObjectFactory.php | 8 +- .../class_CommunicatorStateFactory.php | 4 +- .../crawler/class_CrawlerStateFactory.php | 6 +- .../cruncher/class_CruncherStateFactory.php | 6 +- .../states/dht/class_DhtStateFactory.php | 8 +- .../states/miner/class_MinerStateFactory.php | 6 +- .../states/node/class_NodeStateFactory.php | 8 +- .../states/peer/class_PeerStateFactory.php | 10 +- .../tags/class_PackageTagsFactory.php | 6 +- .../class_HubcoinRewardFeature.php | 8 +- .../activation/node/class_NodeActivation | 6 +- ...class_NodeActivationAnnouncementFilter.php | 14 +- .../class_AptProxyInitializationFilter.php | 12 +- .../class_AptProxyPhpRequirementsFilter.php | 8 +- .../class_AptProxyWelcomeTeaserFilter.php | 10 +- .../apt-proxy/class_AptProxyBootstrap | 8 +- ...ProxyBootstrapExtraBootstrappingFilter.php | 10 +- ...tProxyBootstrapGenericActivationFilter.php | 10 +- .../filter/bootstrap/chat/class_ChatBootstrap | 8 +- ..._ChatBootstrapExtraBootstrappingFilter.php | 10 +- ...s_ChatBootstrapGenericActivationFilter.php | 10 +- .../bootstrap/crawler/class_CrawlerBootstrap | 8 +- ...awlerBootstrapExtraBootstrappingFilter.php | 10 +- ...rawlerBootstrapGenericActivationFilter.php | 10 +- .../cruncher/class_CruncherBootstrap | 8 +- ...rBootstrapBufferQueueInitializerFilter.php | 10 +- ...ncherBootstrapExtraBootstrappingFilter.php | 10 +- ...uncherBootstrapGenericActivationFilter.php | 10 +- .../bootstrap/miner/class_MinerBootstrap | 8 +- ...rBootstrapBufferQueueInitializerFilter.php | 10 +- ...MinerBootstrapExtraBootstrappingFilter.php | 10 +- ..._MinerBootstrapGenericActivationFilter.php | 10 +- .../filter/bootstrap/node/class_NodeBootstrap | 6 +- ..._NodeBootstrapExtraBootstrappingFilter.php | 12 +- ...lass_NodeBootstrapGenerateNodeIdFilter.php | 12 +- ..._NodeBootstrapGeneratePrivateKeyFilter.php | 12 +- ...s_NodeBootstrapGenerateSessionIdFilter.php | 12 +- .../class_NodeBootstrapListenerPoolFilter.php | 12 +- .../hub/classes/filter/chat/class_Chat | 6 +- .../chat/class_ChatInitializationFilter.php | 12 +- .../chat/class_ChatPhpRequirementsFilter.php | 8 +- .../chat/class_ChatWelcomeTeaserFilter.php | 10 +- application/hub/classes/filter/class_ | 6 +- .../filter/class_BaseAptProxyFilter.php | 4 +- .../classes/filter/class_BaseChatFilter.php | 4 +- .../filter/class_BaseCrawlerFilter.php | 4 +- .../filter/class_BaseCruncherFilter.php | 4 +- .../classes/filter/class_BaseHubFilter.php | 10 +- .../classes/filter/class_BaseMinerFilter.php | 4 +- .../classes/filter/class_BaseNodeFilter.php | 4 +- .../class_CrawlerInitializationFilter.php | 12 +- .../class_CrawlerPhpRequirementsFilter.php | 8 +- .../class_CrawlerWelcomeTeaserFilter.php | 10 +- .../classes/filter/cruncher/class_Cruncher | 6 +- .../class_CruncherInitializationFilter.php | 12 +- .../class_CruncherPhpRequirementsFilter.php | 8 +- .../class_CruncherWelcomeTeaserFilter.php | 10 +- .../hub/classes/filter/miner/class_Miner | 6 +- .../miner/class_MinerInitializationFilter.php | 12 +- .../class_MinerPhpRequirementsFilter.php | 8 +- .../miner/class_MinerWelcomeTeaserFilter.php | 10 +- .../hub/classes/filter/node/class_Node | 6 +- .../node/class_NodeInitializationFilter.php | 12 +- .../node/class_NodePhpRequirementsFilter.php | 10 +- .../node/class_NodeWelcomeTeaserFilter.php | 12 +- .../class_AptProxyShutdownFilter.php | 10 +- .../chat/class_ChatShutdownFilter.php | 10 +- .../crawler/class_CrawlerShutdownFilter.php | 10 +- .../cruncher/class_CruncherShutdownFilter.php | 10 +- .../miner/class_MinerShutdownFilter.php | 10 +- .../filter/shutdown/node/class_NodeShutdown | 6 +- .../class_NodeShutdownFlushNodeListFilter.php | 12 +- .../node/class_NodeShutdownNodeFilter.php | 12 +- .../class_NodeShutdownTaskHandlerFilter.php | 12 +- ...ass_PackageAnnouncementAnswerTagFilter.php | 16 +- ...ass_PackageDhtBootstrapAnswerTagFilter.php | 16 +- ..._PackageRequestNodeListAnswerTagFilter.php | 16 +- .../class_PackageAnnouncementTagFilter.php | 12 +- .../class_PackageDhtBootstrapTagFilter.php | 16 +- .../class_PackageRequestNodeListTagFilter.php | 14 +- .../class_PackageSelfConnectTagFilter.php | 16 +- ...s_AptProxyTaskHandlerInitializerFilter.php | 12 +- ...class_ChatTaskHandlerInitializerFilter.php | 12 +- ...ss_CrawlerTaskHandlerInitializerFilter.php | 12 +- ...s_CruncherTaskHandlerInitializerFilter.php | 12 +- ...lass_MinerTaskHandlerInitializerFilter.php | 12 +- ...class_NodeTaskHandlerInitializerFilter.php | 16 +- .../handler/chunks/class_ChunkHandler.php | 12 +- .../classes/handler/class_BaseHubHandler.php | 25 +- ...lass_NodeAnnouncementAnswerOkayHandler.php | 16 +- ...class_RequestNodeListAnswerOkayHandler.php | 8 +- .../handler/data/class_BaseDataHandler.php | 14 +- .../class_NodeMessageAnnouncementHandler.php | 14 +- ...s_NodeMessageAnnouncementAnswerHandler.php | 14 +- ...s_NodeMessageDhtBootstrapAnswerHandler.php | 16 +- ...odeMessageRequestNodeListAnswerHandler.php | 14 +- .../classes/handler/data/message-types/class_ | 2 +- .../class_BaseMessageHandler.php | 10 +- .../class_NodeMessageDhtBootstrapHandler.php | 16 +- ...lass_NodeMessageRequestNodeListHandler.php | 16 +- .../class_NodeMessageSelfConnectHandler.php | 12 +- .../hub/classes/handler/protocol/class_ | 2 +- .../protocol/class_BaseProtocolHandler.php | 8 +- .../ipv4/class_BaseIpV4ProtocolHandler.php | 10 +- .../ipv4/tcp/class_TcpProtocolHandler.php | 8 +- .../raw_data/class_BaseRawDataHandler.php | 48 +-- .../socket/class_SocketRawDataHandler.php | 13 +- .../hub/classes/handler/raw_data/tcp/class_ | 2 +- .../raw_data/tcp/class_TcpRawDataHandler.php | 134 ++++---- .../raw_data/udp/class_UdpRawDataHandler.php | 29 +- .../helper/class_BaseHubSystemHelper.php | 4 +- .../connection/class_BaseConnectionHelper.php | 83 ++--- .../ipv4/class_BaseIpV4ConnectionHelper.php | 8 +- .../ipv4/tcp/class_TcpConnectionHelper.php | 18 +- .../ipv4/udp/class_UdpConnectionHelper.php | 8 +- .../helper/dht/class_DhtBootstrapHelper.php | 16 +- .../dht/class_DhtPublishEntryHelper.php | 16 +- .../messages/class_BaseMessageHelper.php | 4 +- .../class_CryptoRandomUnitMessageHelper.php | 4 +- .../class_NodeAnnouncementHelper.php | 14 +- ...ss_NodeAnnouncementMessageAnswerHelper.php | 10 +- .../node/answer/class_BaseHubAnswerHelper.php | 2 +- ...ss_NodeDhtBootstrapMessageAnswerHelper.php | 12 +- ...NodeRequestNodeListMessageAnswerHelper.php | 10 +- .../helper/node/class_BaseNodeHelper.php | 6 +- .../class_NodeSelfConnectHelper.php | 16 +- .../class_NodeRequestNodeListHelper.php | 14 +- .../work_units/class_BaseWorkUnitHelper.php | 4 +- .../hub/classes/info/class_BaseInfo.php | 4 +- .../info/connection/class_ConnectionInfo.php | 48 ++- .../network/class_NetworkListenIterator.php | 6 +- .../iterator/node/class_NodePingIterator.php | 4 +- .../iterator/pool/handler/class_Handler | 2 +- .../handler/class_HandlerPoolIterator.php | 6 +- .../monitor/class_MonitorPoolIterator.php | 8 +- .../iterator/pool/shutdown/class_Shutdown | 2 +- .../shutdown/class_ShutdownPoolIterator.php | 6 +- .../pool/tasks/class_TaskPoolIterator.php | 8 +- .../class_TestUnitKeyProducerIterator.php | 6 +- .../classes/listener/class_BaseListener.php | 199 ++++++----- .../listener/class_BaseListenerDecorator.php | 60 ++-- .../socket/class_SocketFileListener.php | 16 +- .../class_SocketFileListenerDecorator.php | 10 +- application/hub/classes/listener/tcp/class_ | 2 +- .../listener/tcp/class_TcpListener.php | 14 +- .../class_ClientTcpListenerDecorator.php | 10 +- .../class_HubTcpListenerDecorator.php | 10 +- .../listener/udp/class_UdpListener.php | 14 +- .../class_ClientUdpListenerDecorator.php | 10 +- .../class_HubUdpListenerDecorator.php | 10 +- .../hub/classes/lists/hub/class_HubList.php | 6 +- .../lists/pool/class_PoolEntriesList.php | 8 +- .../lists/recipient/class_RecipientList.php | 8 +- .../locator/class_UniversalNodeLocator.php | 8 +- .../miner/chash/class_HubCoinMiner.php | 10 +- application/hub/classes/miner/class_ | 2 +- .../hub/classes/miner/class_BaseHubMiner.php | 10 +- .../classes/nodes/boot/class_HubBootNode.php | 16 +- application/hub/classes/nodes/class_ | 2 +- .../hub/classes/nodes/class_BaseHubNode.php | 53 +-- .../classes/nodes/list/class_HubListNode.php | 14 +- .../nodes/master/class_HubMasterNode.php | 14 +- .../nodes/regular/class_HubRegularNode.php | 14 +- .../assembler/class_PackageAssembler.php | 62 ++-- .../classes/package/class_NetworkPackage.php | 112 ++++--- .../fragmenter/class_PackageFragmenter.php | 12 +- .../hub/classes/pools/class_BasePool.php | 14 +- .../listener/class_DefaultListenerPool.php | 10 +- .../pools/peer/class_DefaultPeerPool.php | 22 +- .../classes/producer/class_BaseProducer.php | 8 +- .../keys/class_CruncherKeyProducer.php | 11 +- .../class_CruncherTestUnitProducer.php | 15 +- .../class_MinerRealGenesisBlockProducer.php | 8 +- .../class_MinerTestGenesisBlockProducer.php | 3 - application/hub/classes/recipient/class_ | 2 +- .../classes/recipient/class_BaseRecipient.php | 4 +- .../recipient/dht/class_DhtRecipient.php | 14 +- .../direct/class_DirectRecipient.php | 12 +- .../recipient/self/class_SelfRecipient.php | 12 +- .../recipient/upper/class_UpperRecipient.php | 12 +- .../objects/class_ObjectTypeRegistry.php | 6 +- .../registry/socket/class_SocketRegistry.php | 52 ++- .../class_HubConsoleCommandResolver.php | 12 +- .../html/class_HubHtmlCommandResolver.php | 12 +- .../class_HubConsoleControllerResolver.php | 14 +- .../html/class_HubHtmlControllerResolver.php | 14 +- .../protocol/class_BaseProtocolResolver.php | 4 +- .../tcp/class_TcpProtocolResolver.php | 18 +- .../state/class_BaseStateResolver.php | 6 +- .../state/peer/class_PeerStateResolver.php | 14 +- .../hub/classes/scanner/class_BaseScanner.php | 4 +- .../class_CrawlerUploadedListScanner.php | 4 +- .../hub/classes/source/class_BaseSource.php | 4 +- .../source/units/class_TestUnitSource.php | 6 +- .../urls/class_CrawlerFoundRssUrlSource.php | 4 +- .../urls/class_CrawlerLocalStartUrlSource.php | 4 +- .../urls/class_CrawlerRssStartUrlSource.php | 4 +- .../class_CrawlerUploadedListUrlSource.php | 8 +- .../active/class_CommunicatorActiveState.php | 4 +- .../class_BaseCommunicatorState.php | 4 +- .../states/communicator/class_Communicator | 2 +- .../init/class_CommunicatorInitState.php | 8 +- .../active/class_CrawlerActiveState.php | 8 +- .../booting/class_CrawlerBootingState.php | 8 +- .../states/crawler/class_BaseCrawlerState.php | 4 +- .../hub/classes/states/crawler/class_Crawler | 2 +- .../crawler/init/class_CrawlerInitState.php | 8 +- .../cruncher/class_BaseCruncherState.php | 4 +- .../classes/states/cruncher/class_Cruncher | 3 +- .../cruncher/init/class_CruncherInitState.php | 8 +- .../virgin/class_CruncherVirginState.php | 8 +- .../dht/active/class_DhtActiveState.php | 6 +- .../dht/booting/class_DhtBootingState.php | 8 +- .../classes/states/dht/class_BaseDhtState.php | 4 +- application/hub/classes/states/dht/class_Dht | 2 +- .../states/dht/init/class_DhtInitState.php | 10 +- .../dht/virgin/class_DhtVirginState.php | 10 +- .../miner/booting/class_MinerBootingState.php | 5 +- .../states/miner/class_BaseMinerState.php | 4 +- .../hub/classes/states/miner/class_Miner | 3 +- .../miner/init/class_MinerInitState.php | 8 +- .../miner/virgin/class_MinerVirginState.php | 8 +- .../node/active/class_NodeActiveState.php | 8 +- .../class_NodeAnnouncementCompletedState.php | 4 +- .../announced/class_NodeAnnouncingState.php | 6 +- .../states/node/class_BaseNodeState.php | 4 +- .../hub/classes/states/node/class_Node | 2 +- .../states/node/init/class_NodeInitState.php | 6 +- .../node/seniors/class_NodeReachableState.php | 6 +- .../node/virgin/class_NodeVirginState.php | 6 +- application/hub/classes/states/peer/class_ | 2 +- .../states/peer/class_BasePeerState.php | 4 +- .../connected/class_ConnectedPeerState.php | 8 +- .../class_ConnectionRefusedPeerState.php | 8 +- .../class_ConnectionTimedOutPeerState.php | 8 +- .../errors/class_NoRouteToHostPeerState.php | 8 +- ...lass_OperationAlreadyProgressPeerState.php | 8 +- .../peer/errors/class_ProblemPeerState.php | 8 +- .../class_TransportEndpointGonePeerState.php | 8 +- .../states/peer/init/class_InitPeerState.php | 4 +- .../class_ConnectionStatisticsHelper.php | 6 +- .../input/class_RawDataInputStream.php | 15 +- .../output/class_RawDataOutputStream.php | 22 +- .../hub/classes/tags/class_BaseTag.php | 6 +- .../tags/package/class_PackageTags.php | 24 +- .../hub/classes/tasks/apt-proxy/class_ | 8 +- .../apt-proxy/class_AptProxyListenerTask.php | 10 +- application/hub/classes/tasks/chat/class_ | 8 +- .../chat/class_ChatTelnetListenerTask.php | 10 +- .../tasks/crawler/class_BaseUrlSourceTask.php | 6 +- .../hub/classes/tasks/crawler/class_Crawler | 8 +- .../class_CrawlerNodeCommunicatorTask.php | 12 +- .../class_CrawlerDocumentParserTask.php | 10 +- .../class_CrawlerMimeSnifferTask.php | 10 +- .../crawler/ping/class_CrawlerPingTask.php | 10 +- .../class_CrawlerRemoteJobPublisherTask.php | 10 +- .../tasks/crawler/scanner/class_Crawler | 8 +- .../class_CrawlerUploadedListScannerTask.php | 12 +- .../class_CrawlerSnippetExtractorTask.php | 10 +- .../class_CrawlerStructureAnalyzerTask.php | 10 +- .../class_CrawlerLocalUrlCrawlerTask.php | 10 +- .../class_CrawlerRemoteUrlCrawlerTask.php | 10 +- .../crawler/url_source/class_CrawlerUrlSource | 6 +- .../class_CrawlerUrlSourceFoundRssTask.php | 8 +- .../class_CrawlerUrlSourceLocalStartTask.php | 8 +- .../class_CrawlerUrlSourceRssStartTask.php | 8 +- ...class_CrawlerUrlSourceUploadedListTask.php | 8 +- .../hub/classes/tasks/cruncher/class_Cruncher | 8 +- .../class_CruncherKeyProducerTask.php | 10 +- .../class_CruncherTestUnitProducerTask.php | 10 +- .../class_CruncherWorkUnitFetcherTask.php | 12 +- .../class_MinerBlockFetcherTask.php | 12 +- ...lass_MinerRealGenesisBlockProducerTask.php | 12 +- ...lass_MinerTestGenesisBlockProducerTask.php | 10 +- .../hub/classes/tasks/miner/class_Miner | 8 +- .../class_MinerNodeCommunicatorTask.php | 10 +- .../tasks/network/class_NetworkPackage | 8 +- .../class_NetworkPackageReaderTask.php | 12 +- .../class_NetworkPackageWriterTask.php | 20 +- .../class_NodeAnnouncementTask.php | 12 +- .../chunks/class_NodeChunkAssemblerTask.php | 12 +- application/hub/classes/tasks/node/class_Node | 8 +- .../decoder/class_NodePackageDecoderTask.php | 12 +- .../hub/classes/tasks/node/dht/class_NodeDht | 8 +- .../node/dht/class_NodeDhtBootstrapTask.php | 12 +- .../dht/class_NodeDhtInitializationTask.php | 12 +- .../dht/class_NodeDhtLateBootstrapTask.php | 12 +- .../dht/class_NodeDhtPublicationCheckTask.php | 12 +- .../node/dht/class_NodeDhtPublicationTask.php | 12 +- .../tasks/node/dht/class_NodeDhtQueryTask.php | 12 +- .../listener/class_NodeSocketListenerTask.php | 12 +- .../tasks/node/ping/class_NodePingTask.php | 12 +- .../class_NodeSelfConnectTask.php | 12 +- .../tags/class_NodePackageTagsInitTask.php | 12 +- .../node/update/class_NodeUpdateCheckTask.php | 10 +- .../class_XmlAnnouncementTemplateEngine.php | 8 +- ...ss_XmlAnnouncementAnswerTemplateEngine.php | 8 +- .../hub/classes/template/answer/class_ | 4 +- .../class_BaseXmlAnswerTemplateEngine.php | 8 +- ...ss_XmlDhtBootstrapAnswerTemplateEngine.php | 8 +- ...XmlRequestNodeListAnswerTemplateEngine.php | 10 +- application/hub/classes/template/class_ | 4 +- .../template/class_BaseXmlTemplateEngine.php | 12 +- .../class_XmlSelfConnectTemplateEngine.php | 10 +- .../class_XmlDhtBootstrapTemplateEngine.php | 8 +- ..._XmlRequestNodeListEntryTemplateEngine.php | 8 +- .../class_XmlObjectRegistryTemplateEngine.php | 12 +- ...lass_XmlCruncherTestUnitTemplateEngine.php | 8 +- ...class_XmlDhtPublishEntryTemplateEngine.php | 8 +- ...class_XmlRequestNodeListTemplateEngine.php | 8 +- .../hub/classes/tools/class_HubTools.php | 28 +- application/hub/classes/visitor/pool/class_ | 4 +- .../visitor/pool/handler/class_Handler | 2 +- .../class_RawDataPoolMonitorVisitor.php | 35 +- .../visitor/pool/shutdown/class_Shutdown | 2 +- .../class_ShutdownListenerPoolVisitor.php | 10 +- .../class_HalfShutdownSocketVisitor.php | 12 +- .../socket/class_ShutdownSocketVisitor.php | 14 +- .../visitor/tasks/class_ActiveTaskVisitor.php | 20 +- .../tasks/class_ShutdownTaskVisitor.php | 20 +- application/hub/config-local.php-dist | 4 +- application/hub/config.php | 315 +++++++++--------- application/hub/exceptions.php | 4 +- ...class_AnnouncementNotAcceptedException.php | 4 +- ...class_NoAnnouncementAttemptedException.php | 4 +- .../class_InvalidConnectionTypeException.php | 4 +- ...class_DhtBootstrapNotAcceptedException.php | 8 +- ...class_NoDhtBootstrapAttemptedException.php | 6 +- ...lass_FactoryRequiredParameterException.php | 6 +- .../ids/class_InvalidSessionIdException.php | 4 +- .../class_NodeAlreadyAnnouncedException.php | 4 +- ...lass_NodeSessionIdVerficationException.php | 4 +- .../class_FinalChunkVerificationException.php | 6 +- .../class_InvalidDataChecksumException.php | 6 +- .../class_InvalidPrivateKeyHashException.php | 4 +- ...class_UnexpectedPackageStatusException.php | 6 +- ...UnsupportedPackageCodeHandlerException.php | 8 +- .../class_PeerAlreadyRegisteredException.php | 6 +- ...ss_NoRequestNodeListAttemptedException.php | 4 +- .../class_RequestNotAcceptedException.php | 4 +- .../class_NoSocketRegisteredException.php | 6 +- .../socket/class_SocketShutdownException.php | 6 +- .../class_MultipleMessageSentException.php | 4 +- .../tags/class_InvalidTagException.php | 4 +- .../tasks/class_InvalidTaskException.php | 4 +- .../unl/class_InvalidUnlException.php | 6 +- .../class_NodeAlreadyRegisteredException.php | 6 +- .../class_NodeDataMissingException.php | 6 +- .../interfaces/apt-proxy/class_AptProxy.php | 8 +- .../hub/interfaces/blocks/class_Minable.php | 4 +- .../hub/interfaces/chat/class_Chatter.php | 8 +- .../hub/interfaces/class_HubInterface.php | 6 +- .../communicator/class_Communicator.php | 9 +- .../interfaces/consumer/class_Consumer.php | 4 +- .../container/socket/class_StorableSocket.php | 15 +- .../hub/interfaces/crawler/class_Crawler.php | 10 +- .../cruncher/class_CruncherHelper.php | 8 +- .../frontend/class_NodeDhtWrapper.php | 8 +- .../frontend/class_NodeInformationWrapper.php | 10 +- .../frontend/class_UnitDatabaseWrapper.php | 4 +- .../interfaces/decoder/class_Decodeable.php | 4 +- .../interfaces/discovery/class_Discoverable | 2 +- .../protocol/class_DiscoverableProtocol.php | 4 +- .../recipient/class_DiscoverableRecipient.php | 4 +- .../dht/class_DiscoverableDhtRecipient.php | 4 +- .../node/class_DiscoverableNodeRecipient.php | 4 +- .../socket/class_DiscoverableSocket.php | 8 +- ...class_DiscoverableUniversalNodeLocator.php | 6 +- .../distributable/class_Distributable.php | 4 +- .../node/class_DistributableNode.php | 6 +- .../interfaces/executor/class_Executor.php | 43 --- .../filter/class_FilterablePackage.php | 6 +- .../class_HandleableAnswerStatus.php | 10 +- .../handler/chunks/class_HandleableChunks.php | 6 +- .../message-types/class_HandleableMessage.php | 8 +- .../handler/network/class_Networkable.php | 13 +- .../protocol/class_HandleableProtocol.php | 6 +- .../{executor => handler/raw-data}/.htaccess | 0 .../raw-data/class_HandleableRawData.php | 80 +++++ .../connections/class_ConnectionHelper.php | 6 +- .../helper/dht/class_HelpableDht.php | 6 +- .../interfaces/helper/hub/class_HubHelper.php | 6 +- .../helper/messages/class_MessageHelper.php | 4 +- .../helper/node/class_HelpableNode.php | 6 +- .../helper/nodes/class_NodeHelper.php | 16 +- .../interfaces/listener/class_Listenable.php | 4 +- .../locator/class_LocateableNode.php | 4 +- .../interfaces/lookup/class_Lookupable.php | 4 +- .../node_states/class_LookupableNodeState.php | 4 +- .../peer_states/class_LookupablePeerState.php | 12 +- .../interfaces/miner/class_MinerHelper.php | 8 +- .../package/assembler/class_Assembler.php | 4 +- .../interfaces/package/class_Deliverable.php | 6 +- .../interfaces/package/class_Receivable.php | 6 +- .../package/fragmenter/class_Fragmentable.php | 6 +- .../hub/interfaces/pool/class_Poolable.php | 4 +- .../pool/listener/class_PoolableListener.php | 6 +- .../pool/peer/class_PoolablePeer.php | 8 +- .../producer/block/class_BlockProducer.php | 8 +- .../interfaces/producer/class_Producer.php | 4 +- .../producer/keys/class_KeyProducer.php | 8 +- .../work_units/class_UnitProducer.php | 8 +- .../interfaces/recipient/class_Recipient.php | 6 +- .../socket/class_RegisterableSocket.php | 17 +- .../resolver/class_ProtocolResolver.php | 6 +- .../resolver/state/class_StateResolver.php | 8 +- .../hub/interfaces/scanner/class_Scanner.php | 4 +- .../shareable/info/class_ShareableInfo.php | 17 +- .../hub/interfaces/socket/class_SocketTag.php | 4 +- .../hub/interfaces/source/class_Source.php | 4 +- .../states/client/class_ClientStateable.php | 4 +- .../states/hub/class_HubStateable.php | 4 +- .../states/peer/class_PeerStateable.php | 4 +- .../hub/interfaces/tags/class_Tagable.php | 6 +- .../listener/class_ListenerVisitor.php | 6 +- .../visitor/pool/class_PoolVisitor.php | 6 +- .../listener/class_ListenerPoolVisitor.php | 6 +- .../work_units/class_UnitHelper.php | 4 +- core | 2 +- index.php | 44 ++- 499 files changed, 3060 insertions(+), 2813 deletions(-) delete mode 100644 application/hub/interfaces/executor/class_Executor.php rename application/hub/interfaces/{executor => handler/raw-data}/.htaccess (100%) create mode 100644 application/hub/interfaces/handler/raw-data/class_HandleableRawData.php diff --git a/.gitattributes b/.gitattributes index 17cdcd537..72184ce6e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,33 @@ -# Use Linux/Uni* line-feed for new lines (prevents converting) -* text=lf +# +### Distribute this file on all GIT projects! +# +# Autodetect text files +* text=auto + +# Force the following filetypes to have unix eols, so Windows does not break them +*.* text eol=lf + +# Force images/fonts to be handled as binaries +*.jpg binary +*.jpeg binary +*.gif binary +*.png binary +*.t3x binary +*.t3d binary +*.exe binary +*.data binary +*.ttf binary +*.eof binary +*.eot binary +*.swf binary +*.mov binary +*.mp4 binary +*.mp3 binary +*.ogg binary +*.flv binary +*.jar binary +*.pdf binary +*.woff* binary +*.otf binary +*.z binary +*.docx binary diff --git a/.gitignore b/.gitignore index 3dc43e248..98ed1ba47 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ docs/warn.log /nbproject data/stacks/*.stack* data/url_lists/*.* +/*.log diff --git a/application/hub/class_ApplicationHelper.php b/application/hub/class_ApplicationHelper.php index 56c008135..e61d84e5a 100644 --- a/application/hub/class_ApplicationHelper.php +++ b/application/hub/class_ApplicationHelper.php @@ -1,20 +1,19 @@ getAppShortName(), diff --git a/application/hub/classes/apt-proxy/class_ b/application/hub/classes/apt-proxy/class_ index f9605703e..4ecf08f34 100644 --- a/application/hub/classes/apt-proxy/class_ +++ b/application/hub/classes/apt-proxy/class_ @@ -3,8 +3,8 @@ namespace Hub\AptProxy; // Import framework stuff -use CoreFramework\Controller\Controller; -use CoreFramework\Response\Responseable; +use Org\Mxchange\CoreFramework\Controller\Controller; +use Org\Mxchange\CoreFramework\Response\Responseable; /** * A node ??? apt-proxy diff --git a/application/hub/classes/apt-proxy/class_BaseNodeAptProxy.php b/application/hub/classes/apt-proxy/class_BaseNodeAptProxy.php index babe4473d..8b883b035 100644 --- a/application/hub/classes/apt-proxy/class_BaseNodeAptProxy.php +++ b/application/hub/classes/apt-proxy/class_BaseNodeAptProxy.php @@ -1,9 +1,9 @@ debugOutput(sprintf('HUB-SYSTEM: data()=%d - CALLED!', strlen($data))); + // Determine it - $isset = ((substr($data, 0, strlen(BaseRawDataHandler::STREAM_START_MARKER)) == BaseRawDataHandler::STREAM_START_MARKER) && (substr($data, -1 * strlen(BaseRawDataHandler::STREAM_END_MARKER), strlen(BaseRawDataHandler::STREAM_END_MARKER)) == BaseRawDataHandler::STREAM_END_MARKER)); + $isset = ((substr($data, 0, strlen(HandleableRawData::STREAM_START_MARKER)) == HandleableRawData::STREAM_START_MARKER) && (substr($data, -1 * strlen(HandleableRawData::STREAM_END_MARKER), strlen(HandleableRawData::STREAM_END_MARKER)) == HandleableRawData::STREAM_END_MARKER)); // ... and return it return $isset; diff --git a/application/hub/classes/client/http/class_HttpClient.php b/application/hub/classes/client/http/class_HttpClient.php index 44ce083b7..8a3bf632e 100644 --- a/application/hub/classes/client/http/class_HttpClient.php +++ b/application/hub/classes/client/http/class_HttpClient.php @@ -1,6 +1,6 @@ communicatorHasInitialized(); } } - -// [EOF] -?> diff --git a/application/hub/classes/communicator/crawler/class_CrawlerNodeCommunicator.php b/application/hub/classes/communicator/crawler/class_CrawlerNodeCommunicator.php index 699af2d9f..9f9583e95 100644 --- a/application/hub/classes/communicator/crawler/class_CrawlerNodeCommunicator.php +++ b/application/hub/classes/communicator/crawler/class_CrawlerNodeCommunicator.php @@ -1,9 +1,9 @@ node communicator class diff --git a/application/hub/classes/communicator/miner/class_MinerNodeCommunicator.php b/application/hub/classes/communicator/miner/class_MinerNodeCommunicator.php index 839e3ad54..e392d6676 100644 --- a/application/hub/classes/communicator/miner/class_MinerNodeCommunicator.php +++ b/application/hub/classes/communicator/miner/class_MinerNodeCommunicator.php @@ -1,9 +1,9 @@ node communicator class diff --git a/application/hub/classes/compressor/decorator/class_NetworkPackageCompressorDecorator.php b/application/hub/classes/compressor/decorator/class_NetworkPackageCompressorDecorator.php index a382772b8..1d621750a 100644 --- a/application/hub/classes/compressor/decorator/class_NetworkPackageCompressorDecorator.php +++ b/application/hub/classes/compressor/decorator/class_NetworkPackageCompressorDecorator.php @@ -1,12 +1,12 @@ debugOutput(sprintf('HUB-CONTAINER: data()=%d - CALLED!', strlen($data))); + // Determine it - $isset = ((substr($data, 0, strlen(BaseRawDataHandler::STREAM_START_MARKER)) == BaseRawDataHandler::STREAM_START_MARKER) && (substr($data, -1 * strlen(BaseRawDataHandler::STREAM_END_MARKER), strlen(BaseRawDataHandler::STREAM_END_MARKER)) == BaseRawDataHandler::STREAM_END_MARKER)); + $isset = ((substr($data, 0, strlen(HandleableRawData::STREAM_START_MARKER)) == HandleableRawData::STREAM_START_MARKER) && (substr($data, -1 * strlen(HandleableRawData::STREAM_END_MARKER), strlen(HandleableRawData::STREAM_END_MARKER)) == HandleableRawData::STREAM_END_MARKER)); // ... and return it return $isset; diff --git a/application/hub/classes/container/socket/class_SocketContainer.php b/application/hub/classes/container/socket/class_SocketContainer.php index 2d7a90160..ada6d8e14 100644 --- a/application/hub/classes/container/socket/class_SocketContainer.php +++ b/application/hub/classes/container/socket/class_SocketContainer.php @@ -1,30 +1,29 @@ debugOutput(sprintf('SOCKET: socketResource=%s,socketProtocol=%s,packageData()=%d - CALLED!', $socketResource, $socketProtocol, count($packageData))); - /* DEBUG-PRINT: */ printf('[%s:%d]: packageData=%s', __METHOD__, __LINE__, print_r($packageData, TRUE)); + //* DEBUG-PRINT: */ printf('[%s:%d]: packageData=%s', __METHOD__, __LINE__, print_r($packageData, TRUE)); + + // Socket type must always be there + if (!isset($packageData[StorableSocket::SOCKET_ARRAY_INDEX_TYPE])) { + // Abort here + throw new InvalidArgumentException(sprintf('Array packageData does not contain "%s".', StorableSocket::SOCKET_ARRAY_INDEX_TYPE)); + } // END - if // Get a new instance $socketInstance = new SocketContainer(); @@ -774,6 +780,39 @@ class SocketContainer extends BaseHubContainer implements StorableSocket, Visita return $socketInstance; } + /** + * Reads (binary) data from socket instance + * + * @return $rawData Raw data being read + * @throws InvalidSocketException If the stored socket is not valid + */ + public function readDataFromSocket () { + // Trace message + /* EXTREME-NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: CALLED!', strtoupper($this->getSocketProtocol()))); + + // Should be valid socket + if (!$this->isValidSocket()) { + // Throw exception + throw new InvalidSocketException(array($this, $this->getSocketResource()), self::EXCEPTION_INVALID_SOCKET); + } // END - if + + // Debug message + /* EXTREME-NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: this->socketResource=%s', strtoupper($this->getSocketProtocol()), $this->getSocketResource())); + + /* + * Read raw data from socket. If you change PHP_BINARY_READ to + * PHP_NORMAL_READ, this line will endless block. This script does only + * provide simultanous or faked threads, not real. + */ + $rawData = socket_read($this->getSocketResource(), $this->getConfigInstance()->getConfigEntry('tcp_buffer_length'), PHP_BINARY_READ); + + // Trace message + /* EXTREME-NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: rawData[%s]()=%d - EXIT!', strtoupper($this->getSocketProtocol()), gettype($rawData), strlen($rawData))); + + // Return it + return $rawData; + } + /** * Tries to identify the socket peer by calling socket_getpeer() and stores * it in package data array. diff --git a/application/hub/classes/controller/console/class_HubConsoleAptProxyController.php b/application/hub/classes/controller/console/class_HubConsoleAptProxyController.php index 70b4f7267..af2ea7832 100644 --- a/application/hub/classes/controller/console/class_HubConsoleAptProxyController.php +++ b/application/hub/classes/controller/console/class_HubConsoleAptProxyController.php @@ -1,14 +1,14 @@ debugOutput(sprintf('HUB-DATABASE-WRAPPER: data()=%d - CALLED!', strlen($data))); + // Determine it - $isset = ((substr($data, 0, strlen(BaseRawDataHandler::STREAM_START_MARKER)) == BaseRawDataHandler::STREAM_START_MARKER) && (substr($data, -1 * strlen(BaseRawDataHandler::STREAM_END_MARKER), strlen(BaseRawDataHandler::STREAM_END_MARKER)) == BaseRawDataHandler::STREAM_END_MARKER)); + $isset = ((substr($data, 0, strlen(HandleableRawData::STREAM_START_MARKER)) == HandleableRawData::STREAM_START_MARKER) && (substr($data, -1 * strlen(HandleableRawData::STREAM_END_MARKER), strlen(HandleableRawData::STREAM_END_MARKER)) == HandleableRawData::STREAM_END_MARKER)); // ... and return it return $isset; diff --git a/application/hub/classes/database/frontend/cruncher/class_CruncherUnitDatabaseWrapper.php b/application/hub/classes/database/frontend/cruncher/class_CruncherUnitDatabaseWrapper.php index f48f6e4a2..594d4217b 100644 --- a/application/hub/classes/database/frontend/cruncher/class_CruncherUnitDatabaseWrapper.php +++ b/application/hub/classes/database/frontend/cruncher/class_CruncherUnitDatabaseWrapper.php @@ -1,13 +1,13 @@ debugOutput('PEER-STATE-DATABASE-WRAPPER: Searching for sender ' . $packageData[NetworkPackage::PACKAGE_DATA_SENDER_ADDRESS]); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PEER-STATE-DATABASE-WRAPPER: Searching for sender ' . $packageData[NetworkPackage::PACKAGE_DATA_SENDER_ADDRESS]); $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class'); // Add 'sender' as the peer's IP address @@ -108,7 +108,7 @@ class PeerStateLookupDatabaseWrapper extends BaseHubDatabaseWrapper implements L */ public function isSenderNewPeer (array $packageData, StoreableCriteria $dataSetInstance = NULL) { // Debug message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PEER-STATE-DATABASE-WRAPPER: packageData()=' . count($packageData) . ' - CALLED!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PEER-STATE-DATABASE-WRAPPER: packageData()=' . count($packageData) . ' - CALLED!'); // Is the package valid? if (!isset($packageData[NetworkPackage::PACKAGE_DATA_SENDER_ADDRESS])) { @@ -129,11 +129,11 @@ class PeerStateLookupDatabaseWrapper extends BaseHubDatabaseWrapper implements L $entries = $this->doSelectCountByCriteria($searchInstance, array(self::DB_COLUMN_PEER_SESSION_ID => TRUE)); // Is it there? - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PEER-STATE-DATABASE-WRAPPER: entries=' . $entries); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PEER-STATE-DATABASE-WRAPPER: entries=' . $entries); $isNewPeer = ($entries != 1); // Return the result - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PEER-STATE-DATABASE-WRAPPER: isNewPeer=' . intval($isNewPeer) . ' - EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PEER-STATE-DATABASE-WRAPPER: isNewPeer=' . intval($isNewPeer) . ' - EXIT!'); return $isNewPeer; } @@ -180,7 +180,7 @@ class PeerStateLookupDatabaseWrapper extends BaseHubDatabaseWrapper implements L $this->queryInsertDataSet($dataSetInstance, array(self::DB_COLUMN_PEER_SESSION_ID => TRUE)); // Debug message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PEER-STATE-DATABASE-WRAPPER: Peer ' . $packageData[NetworkPackage::PACKAGE_DATA_SENDER_ADDRESS] . ' has been registered.'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PEER-STATE-DATABASE-WRAPPER: Peer ' . $packageData[NetworkPackage::PACKAGE_DATA_SENDER_ADDRESS] . ' has been registered.'); } /** @@ -223,7 +223,7 @@ class PeerStateLookupDatabaseWrapper extends BaseHubDatabaseWrapper implements L } // Debug message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PEER-STATE-DATABASE-WRAPPER: Peer ' . $packageData[NetworkPackage::PACKAGE_DATA_SENDER_ADDRESS] . ' has been registered/updated with state ' . $stateInstance->getStateName()); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PEER-STATE-DATABASE-WRAPPER: Peer ' . $packageData[NetworkPackage::PACKAGE_DATA_SENDER_ADDRESS] . ' has been registered/updated with state ' . $stateInstance->getStateName()); } /** @@ -247,7 +247,7 @@ class PeerStateLookupDatabaseWrapper extends BaseHubDatabaseWrapper implements L */ public function isSamePeerState (ConnectionHelper $helperInstance, array $packageData) { // Debug message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PEER-STATE-DATABASE-WRAPPER: State ' . $helperInstance->getPrintableState() . ' needs to be checked it has changed ...'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PEER-STATE-DATABASE-WRAPPER: State ' . $helperInstance->getPrintableState() . ' needs to be checked it has changed ...'); // Now get the search instance from given package data $searchInstance = $this->getSenderSearchInstanceFromPackageData($packageData); @@ -262,7 +262,7 @@ class PeerStateLookupDatabaseWrapper extends BaseHubDatabaseWrapper implements L $rowData = $resultInstance->current(); // Debug message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PEER-STATE-DATABASE-WRAPPER: rowData[' . gettype($rowData) . ']=' . print_r($rowData, TRUE)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PEER-STATE-DATABASE-WRAPPER: rowData[' . gettype($rowData) . ']=' . print_r($rowData, TRUE)); // Assert on important elements assert(isset($rowData[self::DB_COLUMN_PEER_STATE])); @@ -271,7 +271,7 @@ class PeerStateLookupDatabaseWrapper extends BaseHubDatabaseWrapper implements L $isSamePeerState = ($rowData[self::DB_COLUMN_PEER_STATE] == $helperInstance->getPrintableState()); // Debug message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PEER-STATE-DATABASE-WRAPPER: state in database: ' . $rowData[self::DB_COLUMN_PEER_STATE] . ', new state: ' . $helperInstance->getPrintableState() . ',isSamePeerState=' . intval($isSamePeerState)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PEER-STATE-DATABASE-WRAPPER: state in database: ' . $rowData[self::DB_COLUMN_PEER_STATE] . ', new state: ' . $helperInstance->getPrintableState() . ',isSamePeerState=' . intval($isSamePeerState)); // Return it return $isSamePeerState; diff --git a/application/hub/classes/decoder/class_BaseDecoder.php b/application/hub/classes/decoder/class_BaseDecoder.php index bb2263cce..f6d801b35 100644 --- a/application/hub/classes/decoder/class_BaseDecoder.php +++ b/application/hub/classes/decoder/class_BaseDecoder.php @@ -1,9 +1,9 @@ debugOutput('PACKAGE-SOCKET-DISOVERY: connectionType=' . $connectionType . ' - CALLED!'); - // Assert on type and recipient - assert($connectionType != StorableSocket::CONNECTION_TYPE_SERVER); - assert(isset($packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT])); + // Make sure all parameters are valid + if (!isset($packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT])) { + // Abort here + throw new InvalidArgumentException(sprintf('Array packageData(%d) does not contain field "%s".', count($packageData), NetworkPackage::PACKAGE_DATA_RECIPIENT)); + } elseif (($connectionType != StorableSocket::CONNECTION_TYPE_INCOMING) && ($connectionType != StorableSocket::CONNECTION_TYPE_OUTGOING)) { + // Abort here + throw new InvalidArgumentException(sprintf('connectionType=%s is whether "%s" nor "%s".', $connectionType, StorableSocket::CONNECTION_TYPE_INCOMING, StorableSocket::CONNECTION_TYPE_OUTGOING)); + } // Determine protocol instance $protocolInstance = ProtocolDiscovery::determineProtocolByPackageData($packageData); // Debug message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('protocolInstance=' . $protocolInstance . ',packageData=' . print_r($packageData, TRUE)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('protocolInstance=' . $protocolInstance . ',packageData=' . print_r($packageData, TRUE)); // Is it valid? assert($protocolInstance instanceof HandleableProtocol); @@ -175,7 +181,7 @@ class PackageSocketDiscovery extends BaseRecipientDiscovery implements Discovera $listenerInstance = $this->discoverListenerInstance($protocolInstance, $packageData); // Debug message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-SOCKET-DISCOVERY: listenerInstance=' . $listenerInstance . ',packageData=' . print_r($packageData, TRUE)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-SOCKET-DISCOVERY: listenerInstance=' . $listenerInstance . ',packageData=' . print_r($packageData, TRUE)); // If there is no listener who wants to have that package, we simply drop it here if (is_null($listenerInstance)) { @@ -231,7 +237,7 @@ class PackageSocketDiscovery extends BaseRecipientDiscovery implements Discovera } // And return it - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-SOCKET-DISCOVERY: socketResource=' . $socketInstance->getSocketResource() . ',packageData=' . print_r($packageData, TRUE)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-SOCKET-DISCOVERY: socketResource=' . $socketInstance->getSocketResource() . ',packageData=' . print_r($packageData, TRUE)); return $socketInstance; } diff --git a/application/hub/classes/factories/chain/class_PackageFilterChainFactory.php b/application/hub/classes/factories/chain/class_PackageFilterChainFactory.php index 989d38b21..a944c6070 100644 --- a/application/hub/classes/factories/chain/class_PackageFilterChainFactory.php +++ b/application/hub/classes/factories/chain/class_PackageFilterChainFactory.php @@ -1,10 +1,10 @@ debugOutput(sprintf('CONNECTION-INFO-FACTORY: protocolName=%s,type=%s - CALLED!', $protocolName, $type)); + // Generate key - $key = 'connection_info_' . $protocolName . '_' . $type; + $key = sprintf('connection_info_%s_%s', $protocolName, $type); // If there is no info? if (Registry::getRegistry()->instanceExists($key)) { @@ -56,16 +59,17 @@ class ConnectionInfoFactory extends ObjectFactory { $infoInstance = Registry::getRegistry()->getInstance($key); } else { // Get the info instance - $infoInstance = self::createObjectByConfiguredName('connection_info_class'); + $infoInstance = self::createObjectByConfiguredName('connection_info_class', array($type)); // Add it to the registry Registry::getRegistry()->addInstance($key, $infoInstance); } + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CONNECTION-INFO-FACTORY: infoInstance=%s - EXIT!', $infoInstance->__toString())); + // Return the instance return $infoInstance; } -} -// [EOF] -?> +} diff --git a/application/hub/classes/factories/lists/class_RecipientListFactory.php b/application/hub/classes/factories/lists/class_RecipientListFactory.php index 3ecd4e097..f94169689 100644 --- a/application/hub/classes/factories/lists/class_RecipientListFactory.php +++ b/application/hub/classes/factories/lists/class_RecipientListFactory.php @@ -1,10 +1,10 @@ convertToClassName($nodeMode), $factoryInstance->convertToClassName($nodeMode) ); diff --git a/application/hub/classes/factories/package/assembler/class_PackageAssemblerFactory.php b/application/hub/classes/factories/package/assembler/class_PackageAssemblerFactory.php index 904837f8b..addaf6ea9 100644 --- a/application/hub/classes/factories/package/assembler/class_PackageAssemblerFactory.php +++ b/application/hub/classes/factories/package/assembler/class_PackageAssemblerFactory.php @@ -1,13 +1,13 @@ getConfigEntry('hub_communication_protocol_type'); + $protocolName = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('hub_communication_protocol_type'); // If there is no handler? if (Registry::getRegistry()->instanceExists($protocolName . '_protocol_resolver')) { diff --git a/application/hub/classes/factories/scanner/class_ScannerObjectFactory.php b/application/hub/classes/factories/scanner/class_ScannerObjectFactory.php index 21cd7fffb..2112dbe78 100644 --- a/application/hub/classes/factories/scanner/class_ScannerObjectFactory.php +++ b/application/hub/classes/factories/scanner/class_ScannerObjectFactory.php @@ -1,11 +1,11 @@ debugOutput('SOCKET-FACTORY: Using socket ' . $socketInstance->getSocketResource() . '(' . gettype($socketInstance->getSocketResource()) . ') from registry.'); } else { // Construct configuration entry for object factory and get it - $className = FrameworkConfiguration::getSelfInstance()->getConfigEntry($protocolInstance->getProtocolName() . '_connection_helper_class'); + $className = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry($protocolInstance->getProtocolName() . '_connection_helper_class'); // Debug message //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-FACTORY: Going to use class ' . $className . ' for creating a socket resource ...'); @@ -110,8 +110,11 @@ class SocketFactory extends ObjectFactory { * @throws InvalidSocketException If the socket cannot be completed */ public static final function createListenFileSocket (Listenable $listenerInstance) { + // Create SplFileInfo + $fileInfo = new SplFileInfo($listenerInstance->getConfigInstance()->getConfigEntry('ipc_socket_file_name')); + // Create file name - $socketFile = self::createTempPathForFile($listenerInstance->getConfigInstance()->getConfigEntry('ipc_socket_file_name')); + $socketFile = self::createTempPathForFile($fileInfo); // Debug message self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-FACTORY: socketFile=' . $socketFile . ' ...'); @@ -123,6 +126,7 @@ class SocketFactory extends ObjectFactory { $packageData = array( StorableSocket::SOCKET_ARRAY_INDEX_FILE => $socketFile, '__fake_port' => '0', + StorableSocket::SOCKET_ARRAY_INDEX_TYPE => StorableSocket::CONNECTION_TYPE_SERVER, ); // Init main socket @@ -204,6 +208,9 @@ class SocketFactory extends ObjectFactory { // Debug message //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-FACTORY: Created socket[' . gettype($socketResource) . ']=' . $socketResource . '.'); + // Add socket type 'outgoing' to package data + $packageData[StorableSocket::SOCKET_ARRAY_INDEX_TYPE] = StorableSocket::CONNECTION_TYPE_SERVER; + // Construct container class, this won't be reached if an exception is thrown $socketInstance = ObjectFactory::createObjectByConfiguredName('socket_container_class', array($socketResource, StorableSocket::SOCKET_PROTOCOL_TCP, $packageData)); @@ -266,6 +273,7 @@ class SocketFactory extends ObjectFactory { $packageData = array( StorableSocket::SOCKET_ARRAY_INDEX_ADDRESS => $listenerInstance->getListenAddress(), StorableSocket::SOCKET_ARRAY_INDEX_PORT => $listenerInstance->getListenPort(), + StorableSocket::SOCKET_ARRAY_INDEX_TYPE => StorableSocket::CONNECTION_TYPE_SERVER, ); // Create socket instance @@ -340,6 +348,7 @@ class SocketFactory extends ObjectFactory { $packageData = array( StorableSocket::SOCKET_ARRAY_INDEX_ADDRESS => $listenerInstance->getListenAddress(), StorableSocket::SOCKET_ARRAY_INDEX_PORT => $listenerInstance->getListenPort(), + StorableSocket::SOCKET_ARRAY_INDEX_TYPE => StorableSocket::CONNECTION_TYPE_SERVER, ); // Create socket instance @@ -464,6 +473,7 @@ class SocketFactory extends ObjectFactory { $packageData = array( StorableSocket::SOCKET_ARRAY_INDEX_ADDRESS => 'invalid', StorableSocket::SOCKET_ARRAY_INDEX_PORT => '0', + StorableSocket::SOCKET_ARRAY_INDEX_TYPE => StorableSocket::CONNECTION_TYPE_INCOMING, ); // Create socket instance diff --git a/application/hub/classes/factories/source/units/class_UnitSourceFactory.php b/application/hub/classes/factories/source/units/class_UnitSourceFactory.php index ea46c2943..6a6eff462 100644 --- a/application/hub/classes/factories/source/units/class_UnitSourceFactory.php +++ b/application/hub/classes/factories/source/units/class_UnitSourceFactory.php @@ -1,10 +1,10 @@ debugOutput(sprintf('HUB-HANDLER: data()=%d - CALLED!', strlen($data))); + // Determine it - $isset = ((substr($data, 0, strlen(BaseRawDataHandler::STREAM_START_MARKER)) == BaseRawDataHandler::STREAM_START_MARKER) && (substr($data, -1 * strlen(BaseRawDataHandler::STREAM_END_MARKER), strlen(BaseRawDataHandler::STREAM_END_MARKER)) == BaseRawDataHandler::STREAM_END_MARKER)); + $isset = ((substr($data, 0, strlen(HandleableRawData::STREAM_START_MARKER)) == HandleableRawData::STREAM_START_MARKER) && (substr($data, -1 * strlen(HandleableRawData::STREAM_END_MARKER), strlen(HandleableRawData::STREAM_END_MARKER)) == HandleableRawData::STREAM_END_MARKER)); // ... and return it return $isset; diff --git a/application/hub/classes/handler/data/answer-status/announcement/class_NodeAnnouncementAnswerOkayHandler.php b/application/hub/classes/handler/data/answer-status/announcement/class_NodeAnnouncementAnswerOkayHandler.php index fae30321d..ad0686576 100644 --- a/application/hub/classes/handler/data/answer-status/announcement/class_NodeAnnouncementAnswerOkayHandler.php +++ b/application/hub/classes/handler/data/answer-status/announcement/class_NodeAnnouncementAnswerOkayHandler.php @@ -1,17 +1,17 @@ . */ -class BaseRawDataHandler extends BaseHubHandler implements HubInterface { - // - Package errors - const PACKAGE_ERROR_INVALID_DATA = 'invalid_data'; // Invalid data in package found - const PACKAGE_ERROR_INCOMPLETE_DATA = 'incomplete_data'; // Incomplete data sent (e.g. field is missing) - const PACKAGE_ERROR_INVALID_CONTENT = 'invalid_content'; // Content is invalid (e.g. not well-formed) - const PACKAGE_ERROR_RECIPIENT_MISMATCH = 'recipient_error'; // Recipient is not us - const PACKAGE_LEVEL_CHECK_OKAY = 'checked_package'; // Package is fine - - // Package data - const PACKAGE_RAW_DATA = 'raw_data'; - const PACKAGE_ERROR_CODE = 'error_code'; - - // Start/end marker - const STREAM_START_MARKER = '[[S]]'; - const STREAM_END_MARKER = '[[E]]'; - - /** - * Stacker for raw data - */ - const STACKER_NAME_RAW_DATA = 'raw_data'; - +class BaseRawDataHandler extends BaseHubHandler implements HandleableRawData { /** * Error code from socket */ @@ -103,24 +83,24 @@ class BaseRawDataHandler extends BaseHubHandler implements HubInterface { /** * Adds given raw data to the raw data stacker * - * @param $rawData raw data from the socket resource + * @param $rawData Raw data from the socket resource * @return void */ protected function addRawDataToStacker ($rawData) { // Trace message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('RAW-DATA-HANDLER: rawData()=%d - CALLED!', strlen($rawData))); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('RAW-DATA-HANDLER: rawData(%d)=%s - CALLED!', strlen($rawData), $rawData)); /* * Add the deocoded data and error code to the stacker so other classes * (e.g. NetworkPackage) can "pop" it from the stacker. */ $this->getStackInstance()->pushNamed(self::STACKER_NAME_RAW_DATA, array( - self::PACKAGE_RAW_DATA => $rawData, - self::PACKAGE_ERROR_CODE => $this->getErrorCode() + HandleableRawData::PACKAGE_RAW_DATA => $rawData, + HandleableRawData::PACKAGE_ERROR_CODE => $this->getErrorCode() )); // Trace message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('RAW-DATA-HANDLER: EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('RAW-DATA-HANDLER: EXIT!'); } /** diff --git a/application/hub/classes/handler/raw_data/socket/class_SocketRawDataHandler.php b/application/hub/classes/handler/raw_data/socket/class_SocketRawDataHandler.php index 17905bfe1..00f402be2 100644 --- a/application/hub/classes/handler/raw_data/socket/class_SocketRawDataHandler.php +++ b/application/hub/classes/handler/raw_data/socket/class_SocketRawDataHandler.php @@ -1,10 +1,11 @@ partialStub('socketArray=' . print_r($socketArray, TRUE)); + public function processRawDataFromSocketInstance (StorableSocket $socketInstance) { + $this->partialStub('socketInstance=' . print_r($socketInstance, TRUE)); } } diff --git a/application/hub/classes/handler/raw_data/tcp/class_ b/application/hub/classes/handler/raw_data/tcp/class_ index c09a61e2a..d233f3260 100644 --- a/application/hub/classes/handler/raw_data/tcp/class_ +++ b/application/hub/classes/handler/raw_data/tcp/class_ @@ -142,7 +142,7 @@ use Hub\Listener\BaseListener; use Hub\Listener\Listenable; // Import framework stuff -use CoreFramework\Visitor\Visitable; +use Org\Mxchange\CoreFramework\Visitor\Visitable; . */ class TcpRawDataHandler extends BaseRawDataHandler implements Networkable { + /** + * Last socket error (default: Success) + */ + private $lastSocketError = 0; + /** * Protected constructor * @@ -69,76 +74,69 @@ class TcpRawDataHandler extends BaseRawDataHandler implements Networkable { * * @param $resource A valid socket resource array * @return void - * @throws InvalidArgumentException If the socket instance is not set */ - public function processRawDataFromSocketArray (array $socketArray) { + public function processRawDataFromSocketInstance (StorableSocket $socketInstance) { // Trace message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('TCP-RAWDATA-HANDLER: socketArray()=%d - CALLED!', count($socketArray))); - - // Check the resource - if ((!isset($socketArray[Poolable::SOCKET_ARRAY_INSTANCE])) || (!($socketArray[Poolable::SOCKET_ARRAY_INSTANCE] instanceof StorableSocket))) { - // Throw an exception - throw new InvalidArgumentException(sprintf('socketArray[%s] is not set or invalid.', Poolable::SOCKET_ARRAY_INSTANCE)); - } // END - if + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('TCP-RAW-DATA-HANDLER: socketInstance=%s - CALLED!', $socketInstance->__toString())); // Reset error code to unhandled - $this->setErrorCode(self::SOCKET_ERROR_UNHANDLED); + $this->setErrorCode(StorableSocket::SOCKET_ERROR_UNHANDLED); // Debug message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-RAWDATA-HANDLER: Handling TCP package from resource=' . $socketArray[Poolable::SOCKET_ARRAY_INSTANCE] . ',type=' . $socketArray[Poolable::SOCKET_ARRAY_CONN_TYPE] . ',last error=' . socket_strerror($this->lastSocketError)); - $this->partialStub('Please rewrite this part.'); - return; - - /* - * Read the raw data from socket. If you change PHP_BINARY_READ to - * PHP_NORMAL_READ, this line will endless block. This script does only - * provide simultanous or faked threads, not real. - */ - $rawData = socket_read($socketArray[Poolable::SOCKET_ARRAY_INSTANCE], $this->getConfigInstance()->getConfigEntry('tcp_buffer_length'), PHP_BINARY_READ); - - // Get socket error code back - $this->lastSocketError = $socketArray[Poolable::SOCKET_ARRAY_INSTANCE]->getSocketLastErrorCode(); - - // Debug output of read data length - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-RAWDATA-HANDLER: rawData[' . gettype($rawData) . ']=' . strlen($rawData) . ',MD5=' . md5($rawData) . ',resource=' . $socketArray[Poolable::SOCKET_ARRAY_INSTANCE] . ',this->lastSocketError=' . socket_strerror($this->lastSocketError)); - /* NOISY-DEBUG: */ if ($rawData !== FALSE) self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-RAWDATA-HANDLER: rawData=' . $rawData); - - // Is it valid? - if ($this->lastSocketError == 11) { - // Debug message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-RAWDATA-HANDLER: Ignoring error 11 (Resource temporary unavailable) from socket resource=' . $socketArray[Poolable::SOCKET_ARRAY_INSTANCE]); - - /* - * Error code 11 (Resource temporary unavailable) can be safely - * ignored on non-blocking sockets. The socket is currently not - * sending any data. - */ - $socketArray[Poolable::SOCKET_ARRAY_INSTANCE]->clearLastSocketError(); - - // Skip any further processing - return; - } elseif (($rawData === FALSE) || ($this->lastSocketError > 0)) { - // Network error or connection lost - $this->setErrorCode($this->lastSocketError); - } elseif (empty($rawData)) { - // Trace message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-RAWDATA-HANDLER: No raw data pending. - EXIT!'); - - // The peer did send nothing to us which is now being ignored - return; - } else { - /* - * All is fine at this point. So it is okay to add the raw data to - * the stacker. Here it doesn't matter if the raw data is a - * well-formed BASE64-encoded message with start and markers. This - * will be checked later on. - */ - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-RAWDATA-HANDLER: Adding ' . strlen($rawData) . ' bytes to stacker ...'); - $this->addRawDataToStacker($rawData); - } + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-RAW-DATA-HANDLER: Handling TCP package from resource=' . $socketInstance->getSocketResource() . ',last error=' . $socketInstance->getLastSocketErrorMessage()); + + // Read the raw data from socket in a loop + while ($rawData = $socketInstance->readDataFromSocket()) { + // Get socket error code back + $this->lastSocketError = $socketInstance->getLastSocketErrorCode(); + + // Debug output of read data length + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-RAW-DATA-HANDLER: rawData[' . gettype($rawData) . ']=' . strlen($rawData) . ',MD5=' . md5($rawData) . ',resource=' . $socketInstance . ',this->lastSocketError=' . socket_strerror($this->lastSocketError)); + + // Is not FALSE? + if ($rawData !== FALSE) { + // Output raw data + /* NOISY-DEBUG: */self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-RAW-DATA-HANDLER: rawData=' . $rawData); + } // END - if + + // Is it valid? + if ($this->lastSocketError == 11) { + // Debug message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-RAW-DATA-HANDLER: Ignoring error 11 (Resource temporary unavailable) from socket resource=' . $socketInstance); + + /* + * Error code 11 (Resource temporary unavailable) can be safely + * ignored on non-blocking sockets. The socket is currently not + * sending any data. + */ + $socketInstance->clearLastSocketError(); + + // Skip any further processing + continue; + } elseif (($rawData === FALSE) || ($this->lastSocketError > 0)) { + // Network error or connection lost + $this->setErrorCode($this->lastSocketError); + break; + } elseif (empty($rawData)) { + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-RAW-DATA-HANDLER: No raw data pending. - EXIT!'); + + // The peer did send nothing to us which is now being ignored + continue; + } else { + /* + * All is fine at this point. So it is okay to add the raw data to + * the stacker. Here it doesn't matter if the raw data is a + * well-formed BASE64-encoded message with start and markers. This + * will be checked later on. + */ + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-RAW-DATA-HANDLER: Adding ' . strlen($rawData) . ' bytes to stacker ...'); + $this->addRawDataToStacker($rawData); + } + } // END - while // Trace message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-RAWDATA-HANDLER: EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-RAW-DATA-HANDLER: EXIT!'); } diff --git a/application/hub/classes/handler/raw_data/udp/class_UdpRawDataHandler.php b/application/hub/classes/handler/raw_data/udp/class_UdpRawDataHandler.php index a8e193b07..221099b35 100644 --- a/application/hub/classes/handler/raw_data/udp/class_UdpRawDataHandler.php +++ b/application/hub/classes/handler/raw_data/udp/class_UdpRawDataHandler.php @@ -1,11 +1,12 @@ debugOutput(sprintf('UDP-HANDLER: socketArray()=%d - CALLED!', count($socketArray))); - - // Check the resource - if ((!isset($socketArray[Poolable::SOCKET_ARRAY_INSTANCE])) || (!($socketArray[Poolable::SOCKET_ARRAY_INSTANCE] instanceof StorableSocket))) { - // Throw an exception - throw new InvalidArgumentException(sprintf('socketArray[%s] is not set or invalid.', Poolable::SOCKET_ARRAY_INSTANCE)); - } // END - if - + public function processRawDataFromSocketInstance (StorableSocket $socketInstance) { // Reset error code to unhandled - $this->setErrorCode(self::SOCKET_ERROR_UNHANDLED); + $this->setErrorCode(StorableSocket::SOCKET_ERROR_UNHANDLED); // Debug message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('UDP-HANDLER: Handling UDP package from resource=' . $socketArray[Poolable::SOCKET_ARRAY_INSTANCE] . ',type=' . $socketArray[Poolable::SOCKET_ARRAY_CONN_TYPE] . ',last error=' . socket_strerror($this->lastSocketError)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('UDP-HANDLER: Handling UDP package from resource=' . $socketInstance->getSocketResource() . ',last error=' . $socketInstance->getLastSocketErrorMessage()); $this->partialStub('Please rewrite this part.'); return; } diff --git a/application/hub/classes/helper/class_BaseHubSystemHelper.php b/application/hub/classes/helper/class_BaseHubSystemHelper.php index 482a99d08..f18be2ab4 100644 --- a/application/hub/classes/helper/class_BaseHubSystemHelper.php +++ b/application/hub/classes/helper/class_BaseHubSystemHelper.php @@ -1,9 +1,9 @@ getFragmenterInstance()->getNextRawDataChunk($this->currentFinalHash); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: rawDataChunk=' . print_r($rawDataChunk, TRUE)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: rawDataChunk=' . print_r($rawDataChunk, TRUE)); // Get chunk hashes and chunk data $chunkHashes = array_keys($rawDataChunk); $chunkData = array_values($rawDataChunk); + // Default is empty raw data + $rawData = ''; + // Is the required data there? - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: chunkHashes[]=' . count($chunkHashes) . ',chunkData[]=' . count($chunkData)); - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('chunkData='.print_r($chunkData, TRUE)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: chunkHashes[]=' . count($chunkHashes) . ',chunkData[]=' . count($chunkData)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('chunkData='.print_r($chunkData, TRUE)); if ((isset($chunkHashes[0])) && (isset($chunkData[0]))) { // Remember this chunk as queued $this->queuedChunks[$chunkHashes[0]] = $chunkData[0]; // Return the raw data - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: Returning ' . strlen($chunkData[0]) . ' bytes from ' . __METHOD__ . ' ...'); - return $chunkData[0]; - } else { - // Return zero string - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: Returning zero bytes from ' . __METHOD__ . '!'); - return ''; - } + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: rawData()=' . strlen($chunkData[0]) . ' bytes.'); + $rawData = $chunkData[0]; + } // END - if + + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CONNECTION-HELPER: rawData()=%d - EXIT!', strlen($rawData))); + + // Return raw data + return $rawData; } /** @@ -237,7 +242,7 @@ class BaseConnectionHelper extends BaseHubSystemHelper implements Visitable, Reg */ public function sendRawPackageData (array $packageData) { // Trace message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CONNECTION-HELPER: packageData()=%d - CALLED!', count($packageData))); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CONNECTION-HELPER: packageData()=%d - CALLED!', count($packageData))); // The helper's state must be 'connected' $this->getStateInstance()->validatePeerStateConnected(); @@ -246,12 +251,12 @@ class BaseConnectionHelper extends BaseHubSystemHelper implements Visitable, Reg $finalHash = $this->getFragmenterInstance()->fragmentPackageArray($packageData, $this); // Trace message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CONNECTION-HELPER: finalHash[%s]=%s', gettype($finalHash), $finalHash)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CONNECTION-HELPER: finalHash[%s]=%s', gettype($finalHash), $finalHash)); // Is the final hash set? if ($finalHash !== TRUE) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: Setting finalHash=' . $finalHash . ',currentFinalHash[' . gettype($this->currentFinalHash) . ']=' . $this->currentFinalHash); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: Setting finalHash=' . $finalHash . ',currentFinalHash[' . gettype($this->currentFinalHash) . ']=' . $this->currentFinalHash); // Set final hash $this->currentFinalHash = $finalHash; @@ -267,26 +272,32 @@ class BaseConnectionHelper extends BaseHubSystemHelper implements Visitable, Reg // Fill sending buffer with data while (TRUE) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CONNECTION-HELPER: dataStream()=%d', strlen($dataStream))); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CONNECTION-HELPER: dataStream()=%d - BEFORE!', strlen($dataStream))); // Convert the package data array to a raw data stream $dataStream = $this->getRawDataFromPackageArray($packageData); + // Debug message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CONNECTION-HELPER: dataStream()=%d - AFTER!', strlen($dataStream))); + // Is it empty? if (strlen($dataStream) == 0) { + // Debug message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: dataStream is now empty, exiting loop ...'); + // Abort here break; } // END - if // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: Adding ' . strlen($dataStream) . ' bytes to the sending buffer ...'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: Adding ' . strlen($dataStream) . ' bytes to the sending buffer ...'); // Add raw data $rawData .= $dataStream; } // END - while // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CONNECTION-HELPER: rawData()=%d', strlen($rawData))); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CONNECTION-HELPER: rawData()=%d - after loop ...', strlen($rawData))); // Nothing to sent is bad news, so assert on it assert(strlen($rawData) > 0); @@ -295,13 +306,13 @@ class BaseConnectionHelper extends BaseHubSystemHelper implements Visitable, Reg $bufferSize = $this->getConfigInstance()->getConfigEntry($this->getProtocolName() . '_buffer_length'); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CONNECTION-HELPER: bufferSize=%d', $bufferSize)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CONNECTION-HELPER: bufferSize=%d', $bufferSize)); // Encode the raw data with our output-stream $encodedData = $this->getOutputStreamInstance()->streamData($rawData); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: socketResource[]=' . gettype($this->getSocketInstance()->getSocketResource())); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CONNECTION-HELPER: socketResource[%s]=%s', gettype($this->getSocketInstance()->getSocketResource()), $this->getSocketInstance()->getSocketResource())); // Init array $encodedDataArray = array( @@ -310,20 +321,14 @@ class BaseConnectionHelper extends BaseHubSystemHelper implements Visitable, Reg NetworkPackage::RAW_INDEX_SENT_BYTES => 0, NetworkPackage::RAW_INDEX_SOCKET_INSTANCE => $this->getSocketInstance(), NetworkPackage::RAW_INDEX_BUFFER_SIZE => $bufferSize, - NetworkPackage::RAW_INDEX_DIFF => 0 + NetworkPackage::RAW_INDEX_DIFF => ($bufferSize - strlen($encodedData)), ); - // Calculate difference - $diff = $encodedDataArray[NetworkPackage::RAW_INDEX_BUFFER_SIZE] - strlen($encodedDataArray[NetworkPackage::RAW_INDEX_ENCODED_DATA]); - - // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: diff=' . $diff); - // Push raw data to the package's outgoing stack $this->getPackageInstance()->getStackInstance()->pushNamed(NetworkPackage::STACKER_NAME_OUTGOING_STREAM, $encodedDataArray); // Trace message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: EXIT!'); } /** diff --git a/application/hub/classes/helper/connection/ipv4/class_BaseIpV4ConnectionHelper.php b/application/hub/classes/helper/connection/ipv4/class_BaseIpV4ConnectionHelper.php index 877f08556..37cf5057d 100644 --- a/application/hub/classes/helper/connection/ipv4/class_BaseIpV4ConnectionHelper.php +++ b/application/hub/classes/helper/connection/ipv4/class_BaseIpV4ConnectionHelper.php @@ -1,11 +1,11 @@ . */ class ConnectionInfo extends BaseInfo implements ShareableInfo, Registerable { + /** + * Connection type: 'incoming', 'outgoing', 'server' + */ + private $connectionType = 'invalid'; + /** * Protected constructor * @@ -50,16 +55,39 @@ class ConnectionInfo extends BaseInfo implements ShareableInfo, Registerable { /** * Creates an instance of this class * + * @param $connectionType Connection type (valid: 'incoming', 'outgoing', 'server') * @return $infoInstance An instance of a ShareableInfo class */ - public final static function createConnectionInfo () { + public final static function createConnectionInfo ($connectionType) { // Get new instance $infoInstance = new ConnectionInfo(); + // Set connection type here + $infoInstance->setConnectionType($connectionType); + // Return the prepared instance return $infoInstance; } + /** + * Setter for connection type + * + * @param $connectionType Connection type + * @return void + */ + private function setConnectionType ($connectionType) { + $this->connectionType = $connectionType; + } + + /** + * Getter for connection type + * + * @return $connectionType Connection type + */ + public final function getConnectionType () { + return $this->connectionType; + } + /** * Fills the information class with data from a Listenable instance * diff --git a/application/hub/classes/iterator/network/class_NetworkListenIterator.php b/application/hub/classes/iterator/network/class_NetworkListenIterator.php index c871039f6..5ed7daa46 100644 --- a/application/hub/classes/iterator/network/class_NetworkListenIterator.php +++ b/application/hub/classes/iterator/network/class_NetworkListenIterator.php @@ -1,10 +1,10 @@ setRegistryInstance($registryInstance); } /** @@ -174,7 +180,7 @@ class BaseListener extends BaseHubSystem implements Visitable { */ protected function registerServerSocketInstance (StorableSocket $socketInstance) { // Trace message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('LISTENER: socketInstance=%s - CALLED!', $socketInstance->__toString())); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: socketInstance=%s - CALLED!', strtoupper($this->getProtocolName()), $socketInstance->__toString())); // First check if it is valid if ($this->isServerSocketRegistered($socketInstance)) { @@ -182,11 +188,8 @@ class BaseListener extends BaseHubSystem implements Visitable { throw new SocketAlreadyRegisteredException(array($this, $socketInstance->getSocketResource()), self::EXCEPTION_SOCKET_ALREADY_REGISTERED); } // END - if - // Get a socket registry instance (singleton) - $registryInstance = SocketRegistryFactory::createSocketRegistryInstance(); - // Get a connection info instance - $infoInstance = ConnectionInfoFactory::createConnectionInfoInstance($this->getProtocolName(), 'listener'); + $infoInstance = ConnectionInfoFactory::createConnectionInfoInstance($this->getProtocolName(), StorableSocket::CONNECTION_TYPE_SERVER); // Is the instance set? if (!($infoInstance instanceof ShareableInfo)) { @@ -198,16 +201,16 @@ class BaseListener extends BaseHubSystem implements Visitable { $infoInstance->fillWithListenerInformation($this); // Register the socket - $registryInstance->registerSocketInstance($infoInstance, $socketInstance); + $this->getRegistryInstance()->registerSocketInstance($infoInstance, $socketInstance); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('LISTENER: Setting socketInstance ... (socketResource=%s)', $socketInstance->getSocketResource())); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: Setting socketInstance ... (socketResource=%s)', strtoupper($this->getProtocolName()), $socketInstance->getSocketResource())); // And set it here $this->setSocketInstance($socketInstance); // Trace message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('LISTENER: EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: EXIT!', strtoupper($this->getProtocolName()))); } /** @@ -219,16 +222,13 @@ class BaseListener extends BaseHubSystem implements Visitable { */ protected function isServerSocketRegistered (StorableSocket $socketInstance) { // Trace message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('LISTENER: socketInstance=%s - CALLED!', $socketInstance->__toString())); - - // Get a socket registry instance (singleton) - $registryInstance = SocketRegistryFactory::createSocketRegistryInstance(); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: socketInstance=%s - CALLED!', strtoupper($this->getProtocolName()), $socketInstance->__toString())); // Get a connection info instance - $infoInstance = ConnectionInfoFactory::createConnectionInfoInstance($this->getProtocolName(), 'listener'); + $infoInstance = ConnectionInfoFactory::createConnectionInfoInstance($this->getProtocolName(), StorableSocket::CONNECTION_TYPE_SERVER); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('LISTENER: infoInstance[]=%s', gettype($infoInstance))); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: infoInstance[]=%s', strtoupper($this->getProtocolName()), gettype($infoInstance))); // Is the instance set? if (!($infoInstance instanceof ShareableInfo)) { @@ -240,13 +240,13 @@ class BaseListener extends BaseHubSystem implements Visitable { $infoInstance->fillWithListenerInformation($this); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('LISTENER: Checking socketInstance ... (socketResource=%s)', $socketInstance->getSocketResource())); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: Checking socketInstance ... (socketResource=%s)', strtoupper($this->getProtocolName()), $socketInstance->getSocketResource())); // Check it - $isRegistered = $registryInstance->isSocketRegistered($infoInstance, $socketInstance); + $isRegistered = $this->getRegistryInstance()->isSocketRegistered($infoInstance, $socketInstance); // Trace message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('LISTENER: isRegistered=%d - EXIT!', intval($isRegistered))); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: isRegistered=%d - EXIT!', strtoupper($this->getProtocolName()), intval($isRegistered))); // Return result return $isRegistered; @@ -260,30 +260,81 @@ class BaseListener extends BaseHubSystem implements Visitable { */ public function accept (Visitor $visitorInstance) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($this->getProtocolName()) . '-LISTENER: ' . $visitorInstance->__toString() . ' has visited ' . $this->__toString() . ' - CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($this->getProtocolName()) . '-LISTENER: ' . $visitorInstance->__toString() . ' has visited ' . $this->__toString() . ' - CALLED!'); // Visit this listener $visitorInstance->visitListener($this); // Visit the pool if set if ($this->getPoolInstance() instanceof Poolable) { + // Visit pool instance $this->getPoolInstance()->accept($visitorInstance); } // END - if // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($this->getProtocolName()) . '-LISTENER: ' . $visitorInstance->__toString() . ' has visited ' . $this->__toString() . ' - EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($this->getProtocolName()) . '-LISTENER: ' . $visitorInstance->__toString() . ' has visited ' . $this->__toString() . ' - EXIT!'); } /** - * Monitors incoming raw data from the handler and transfers it to the - * given receiver instance. This method should not be called, please call - * the decorator's version instead to separator node/client traffic. + * Monitors incoming raw data from all registered sockets and if found, + * processRawDataFromSocketInstance() is being called. * * @return void - * @throws UnsupportedOperatorException If this method is called by a mistake */ public function monitorIncomingRawData () { - throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION); + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: CALLED!', strtoupper($this->getProtocolName()))); + + // Check if an incoming socket is registered + if (!$this->getRegistryInstance()->isIncomingSocketRegistered()) { + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: No socket of type "%s" registered. - EXIT!', strtoupper($this->getProtocolName()), StorableSocket::CONNECTION_TYPE_INCOMING)); + + // Skip further processing + return; + } // END - if + + // Debugging: + /* DEBUG-DIE: */ $this->getRegistryInstance()->debugInstance(); + + // Get iterator from registry instance + $iteratorInstance = $this->getRegistryInstance()->getIterator(); + + // Debug message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: iteratorInstance[]=%s', strtoupper($this->getProtocolName()), gettype($iteratorInstance))); + + // Should be valid instance + if (is_null($iteratorInstance)) { + // Throw NPE + throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); + } // END - if + + // Is it valid? + if (!$iteratorInstance->valid()) { + // Then rewind it + $iteratorInstance->rewind(); + } // END - if + + // Get current instance + $socketInstance = $iteratorInstance->current(); + + // Debug message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: socketInstance[]=%s', strtoupper($this->getProtocolName()), gettype($socketInstance))); + + // Is NULL returned? + if (is_null($socketInstance)) { + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: socketInstance=NULL - EXIT!', strtoupper($this->getProtocolName()))); + + // Then abort here + return; + } // END - if + + // Advance to next + $iteratorInstance->next(); + + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: EXIT!', strtoupper($this->getProtocolName()))); } /** @@ -295,7 +346,7 @@ class BaseListener extends BaseHubSystem implements Visitable { */ protected function doListenSocketSelect ($peerSuffix) { // Trace message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('LISTENER: peerSuffix=%s - CALLED!', $peerSuffix)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: peerSuffix=%s - CALLED!', strtoupper($this->getProtocolName()), $peerSuffix)); // Check on all instances assert($this->getPoolInstance() instanceof Poolable); @@ -305,19 +356,19 @@ class BaseListener extends BaseHubSystem implements Visitable { $socketInstance = SocketFactory::createNextAcceptedSocketFromPool($this->getPoolInstance(), $this->getSocketInstance()); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('LISTENER: socketInstance[]=%s accepted.', gettype($socketInstance))); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: socketInstance[]=%s accepted.', strtoupper($this->getProtocolName()), gettype($socketInstance))); // Is socket instance set? if (!($socketInstance instanceof StorableSocket)) { // Trace message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('LISTENER: No new connection on listener ... - EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: No new connection on listener ... - EXIT!', strtoupper($this->getProtocolName()))); // Nothing has changed on the listener return; } // END - if // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('LISTENER: socketInstance.socketResource=%s accepted.', $socketInstance->getSocketResource())); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: socketInstance.socketResource=%s accepted.', strtoupper($this->getProtocolName()), $socketInstance->getSocketResource())); // Init peer address/port $peerAddress = '0.0.0.0'; @@ -332,16 +383,11 @@ class BaseListener extends BaseHubSystem implements Visitable { // Get node instance $nodeInstance = NodeObjectFactory::createNodeInstance(); - // Create a faked package data array - $packageData = array( - NetworkPackage::PACKAGE_DATA_SENDER_ADDRESS => $peerAddress . $peerSuffix, - NetworkPackage::PACKAGE_DATA_SENDER_PORT => $peerPort, - NetworkPackage::PACKAGE_DATA_RECIPIENT => $nodeInstance->getSessionId(), - NetworkPackage::PACKAGE_DATA_STATUS => NetworkPackage::PACKAGE_STATUS_FAKED - ); - // Get a connection info instance - $infoInstance = ConnectionInfoFactory::createConnectionInfoInstance($this->getProtocolName(), 'listener'); + $infoInstance = ConnectionInfoFactory::createConnectionInfoInstance($this->getProtocolName(), StorableSocket::CONNECTION_TYPE_INCOMING); + + // Debug message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: infoInstance[]=%s', strtoupper($this->getProtocolName()), gettype($infoInstance))); // Is the instance set? if (!($infoInstance instanceof ShareableInfo)) { @@ -352,35 +398,28 @@ class BaseListener extends BaseHubSystem implements Visitable { // Will the info instance with listener data $infoInstance->fillWithSocketPeerInformation($socketInstance); - // Get a socket registry - $registryInstance = SocketRegistryFactory::createSocketRegistryInstance(); - - // Register the socket with the registry and with the faked array - $registryInstance->registerSocketInstance($infoInstance, $socketInstance, $packageData); + // Debugging: + //* DEBUG-DIE: */ $infoInstance->debugInstance(); - // Do we have to rewind? - if (!$this->getIteratorInstance()->valid()) { - // Rewind the list - $this->getIteratorInstance()->rewind(); - } // END - if + // Create a faked package data array + $packageData = array( + NetworkPackage::PACKAGE_DATA_SENDER_ADDRESS => $peerAddress . $peerSuffix, + NetworkPackage::PACKAGE_DATA_SENDER_PORT => $peerPort, + NetworkPackage::PACKAGE_DATA_RECIPIENT => $nodeInstance->getSessionId(), + NetworkPackage::PACKAGE_DATA_STATUS => NetworkPackage::PACKAGE_STATUS_FAKED + ); - // Get the current value - $currentSocketData = $this->getIteratorInstance()->current(); + // Register the socket with the registry and with the faked array + $this->getRegistryInstance()->registerSocketInstance($infoInstance, $socketInstance, $packageData); - // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('LISTENER: currentSocketData=' . $currentSocketData[Poolable::SOCKET_ARRAY_INSTANCE] . ',type=' . $currentSocketData[Poolable::SOCKET_ARRAY_CONN_TYPE] . ',serverSocket=' . $this->getSocketInstance()->getSocketResource()); + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: Calling this.handlerInstance.processRawDataFromSocketInstance(resource=%s) ...', strtoupper($this->getProtocolName()), $socketInstance->getSocketResource())); // Handle it here, if not main server socket - if (($currentSocketData[Poolable::SOCKET_ARRAY_CONN_TYPE] != StorableSocket::CONNECTION_TYPE_SERVER) && (!$currentSocketData[Poolable::SOCKET_ARRAY_INSTANCE]->equals($this->getSocketInstance()))) { - // ... or else it will raise warnings like 'Transport endpoint is not connected' - $this->getHandlerInstance()->processRawDataFromSocketArray($currentSocketData); - } // END - if - - // Advance to next entry. This should be the last line. - $this->getIteratorInstance()->next(); + $this->getHandlerInstance()->processRawDataFromSocketInstance($socketInstance); // Trace message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('LISTENER: EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: EXIT!', strtoupper($this->getProtocolName()))); } /** @@ -391,7 +430,7 @@ class BaseListener extends BaseHubSystem implements Visitable { */ public function ifListenerAcceptsPackageData (array $packageData) { // Trace message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('LISTENER: packageData()=%d - CALLED!', count($packageData))); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: packageData()=%d - CALLED!', strtoupper($this->getProtocolName()), count($packageData))); // Check if same socket protocol $socketProtocol = $this->getSocketInstance()->getSocketProtocol(); @@ -403,13 +442,13 @@ class BaseListener extends BaseHubSystem implements Visitable { $unlProtocol = $unlInstance->getUnlProtocol(); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('LISTENER: unlInstance.unlProtocol=%s,socketProtocol=%s', $unlProtocol, $socketProtocol)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: unlInstance.unlProtocol=%s,socketProtocol=%s', strtoupper($this->getProtocolName()), $unlProtocol, $socketProtocol)); // Is same protocol? $accepts = ($unlProtocol == $socketProtocol); // Trace message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('LISTENER: accepts=%d - EXIT!', $accepts)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: accepts=%d - EXIT!', strtoupper($this->getProtocolName()), $accepts)); // Return the result return $accepts; diff --git a/application/hub/classes/listener/class_BaseListenerDecorator.php b/application/hub/classes/listener/class_BaseListenerDecorator.php index 866c6d81b..50097c108 100644 --- a/application/hub/classes/listener/class_BaseListenerDecorator.php +++ b/application/hub/classes/listener/class_BaseListenerDecorator.php @@ -1,19 +1,23 @@ debugOutput(sprintf('LISTENER-DECORATOR: visitorInstance=%s - CALLED!', $visitorInstance->__toString())); + // Visit this decorator $visitorInstance->visitDecorator($this); + // Trace message + /* NOSY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('LISTENER-DECORATOR: Calling visitorInstance->visitListener(%s) ...', $this->getListenerInstance()->__toString())); + // Visit the covered class $visitorInstance->visitListener($this->getListenerInstance()); + + // Trace message + /* NOSY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('LISTENER-DECORATOR: EXIT!'); } /** @@ -137,32 +150,35 @@ class BaseListenerDecorator extends BaseDecorator implements Visitable { * given receiver instance. * * @return void + * @throws NullPointerException If no handler instance is set in listener instance + * @throws LogicException If the given handler instance is not implementing a required interface */ public function monitorIncomingRawData () { // Trace message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('LISTENER-DECORATOR: CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('LISTENER-DECORATOR: CALLED!'); // Get the handler instance $handlerInstance = $this->getListenerInstance()->getHandlerInstance(); /* * Does the deocorated listener (or even a decorator again) have a - * handler assigned? Remember that a handler will hold all incoming raw - * data and not a listener. + * handler assigned? This is now mandadory. */ - if (!$handlerInstance instanceof Networkable) { - // Skip this silently for now. Later on, this will become mandatory! - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('LISTENER-DECORATOR: No handler assigned to this listener decorator. this=' . $this->__toString() . ', listenerInstance=' . $this->getListenerInstance()->__toString()); - return; - } // END - if + if (is_null($handlerInstance)) { + // Should not happen anymore + throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); + } elseif (!$handlerInstance instanceof Networkable) { + // Bad, bad! + throw new LogicException(sprintf('listenerInstance.handlerInstance[]=%s is not imlementing Networkable.', gettype($handlerInstance))); + } // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('LISTENER-DECORATOR: handlerInstance=%s', $handlerInstance->__toString())); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('LISTENER-DECORATOR: handlerInstance=%s', $handlerInstance->__toString())); // Does the handler have some decoded data pending? if (!$handlerInstance->isRawDataPending()) { // No data is pending so skip further code silently - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('LISTENER-DECORATOR: No data pending on handlerInstance=' . $handlerInstance->__toString() . ' - EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('LISTENER-DECORATOR: No data pending on handlerInstance=' . $handlerInstance->__toString() . ' - EXIT!'); return; } // END - if @@ -176,11 +192,11 @@ class BaseListenerDecorator extends BaseDecorator implements Visitable { * know if the decoded data origins from a TCP or UDP connection so it * can just be passed over to the network package receiver. */ - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('LISTENER-DECORATOR: Going to handle over some raw data to receiverInstance=' . $receiverInstance->__toString() . ' ...'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('LISTENER-DECORATOR: Going to handle over some raw data to receiverInstance=' . $receiverInstance->__toString() . ' ...'); $receiverInstance->addRawDataToIncomingStack($handlerInstance); // Trace message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('LISTENER-DECORATOR: EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('LISTENER-DECORATOR: EXIT!'); } /** diff --git a/application/hub/classes/listener/socket/class_SocketFileListener.php b/application/hub/classes/listener/socket/class_SocketFileListener.php index 02b8fd252..f865ead7e 100644 --- a/application/hub/classes/listener/socket/class_SocketFileListener.php +++ b/application/hub/classes/listener/socket/class_SocketFileListener.php @@ -1,17 +1,17 @@ determineUniversalNodeLocator(); + // Is the instance valid? + if (NULL == $unlInstance) { + // Throw NPE + throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); + } // END - if + // There are 2 UNLs, internal and external. if ($this->getConfigInstance()->getConfigEntry('allow_publish_internal_address') == 'N') { // Public "external" UNL address diff --git a/application/hub/classes/nodes/list/class_HubListNode.php b/application/hub/classes/nodes/list/class_HubListNode.php index e7d0587b9..42bfee0ed 100644 --- a/application/hub/classes/nodes/list/class_HubListNode.php +++ b/application/hub/classes/nodes/list/class_HubListNode.php @@ -1,16 +1,16 @@ ifStartEndMarkersSet($packageContent[BaseRawDataHandler::PACKAGE_RAW_DATA]); + $isCompleted = $this->ifStartEndMarkersSet($packageContent[HandleableRawData::PACKAGE_RAW_DATA]); // Return status return $isCompleted; @@ -154,21 +154,21 @@ class PackageAssembler extends BaseHubSystem implements Assembler, Registerable, public function chunkPackageContent (array $packageContent) { // Validate the package content array again assert( - (isset($packageContent[BaseRawDataHandler::PACKAGE_RAW_DATA])) && - (isset($packageContent[BaseRawDataHandler::PACKAGE_ERROR_CODE])) + (isset($packageContent[HandleableRawData::PACKAGE_RAW_DATA])) && + (isset($packageContent[HandleableRawData::PACKAGE_ERROR_CODE])) ); // Construct call-back name from package error code - $this->callbacks[$packageContent[BaseRawDataHandler::PACKAGE_ERROR_CODE]] = 'handlePackageBy' . self::convertToClassName($packageContent[BaseRawDataHandler::PACKAGE_ERROR_CODE]); + $this->callbacks[$packageContent[HandleableRawData::PACKAGE_ERROR_CODE]] = 'handlePackageBy' . self::convertToClassName($packageContent[HandleableRawData::PACKAGE_ERROR_CODE]); // Abort if the call-back method is not there - if (!method_exists($this, $this->callbacks[$packageContent[BaseRawDataHandler::PACKAGE_ERROR_CODE]])) { + if (!method_exists($this, $this->callbacks[$packageContent[HandleableRawData::PACKAGE_ERROR_CODE]])) { // Throw an exception - throw new UnsupportedPackageCodeHandlerException(array($this, $this->callbacks[$packageContent[BaseRawDataHandler::PACKAGE_ERROR_CODE]], $packageContent), self::EXCEPTION_UNSUPPORTED_PACKAGE_CODE_HANDLER); + throw new UnsupportedPackageCodeHandlerException(array($this, $this->callbacks[$packageContent[HandleableRawData::PACKAGE_ERROR_CODE]], $packageContent), self::EXCEPTION_UNSUPPORTED_PACKAGE_CODE_HANDLER); } // END - if // Call it back - call_user_func(array($this, $this->callbacks[$packageContent[BaseRawDataHandler::PACKAGE_ERROR_CODE]]), $packageContent); + call_user_func(array($this, $this->callbacks[$packageContent[HandleableRawData::PACKAGE_ERROR_CODE]]), $packageContent); } /************************************************************************** @@ -186,15 +186,15 @@ class PackageAssembler extends BaseHubSystem implements Assembler, Registerable, */ private function handlePackageByUnhandledPackage (array $packageContent) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-ASSEMBLER: packageData[' . BaseRawDataHandler::PACKAGE_RAW_DATA . ']=' . $packageContent[BaseRawDataHandler::PACKAGE_RAW_DATA]); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-ASSEMBLER: packageData[' . HandleableRawData::PACKAGE_RAW_DATA . ']=' . $packageContent[HandleableRawData::PACKAGE_RAW_DATA]); // Check for some conditions if ((!$this->ifInputBufferIsEmpty()) || (!$this->isPackageContentCompleted($packageContent))) { // Last chunk is not valid, so wait for more - $this->pendingData .= $packageContent[BaseRawDataHandler::PACKAGE_RAW_DATA]; + $this->pendingData .= $packageContent[HandleableRawData::PACKAGE_RAW_DATA]; // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-ASSEMBLER: Partial data received. Waiting for more ... ( ' . strlen($packageContent[BaseRawDataHandler::PACKAGE_RAW_DATA]) . ' bytes)'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-ASSEMBLER: Partial data received. Waiting for more ... ( ' . strlen($packageContent[HandleableRawData::PACKAGE_RAW_DATA]) . ' bytes)'); } else { // Debug message //* DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-ASSEMBLER: packageContent=' . print_r($packageContent, TRUE) . ',chunks='.print_r($chunks, TRUE)); @@ -249,14 +249,14 @@ class PackageAssembler extends BaseHubSystem implements Assembler, Registerable, //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-ASSEMBLER: Pending data of ' . strlen($this->pendingData) . ' Bytes are incomplete, waiting for more ...'); //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-ASSEMBLER: this->pendingData=' . $this->pendingData); return; - } elseif (substr_count($this->pendingData, BaseRawDataHandler::STREAM_START_MARKER) > 1) { + } elseif (substr_count($this->pendingData, HandleableRawData::STREAM_START_MARKER) > 1) { /* * Multiple messages found, so split off first message as the input * stream can only handle one message per time. */ - foreach (explode(BaseRawDataHandler::STREAM_START_MARKER, $this->pendingData) as $message) { + foreach (explode(HandleableRawData::STREAM_START_MARKER, $this->pendingData) as $message) { // Prepend start marker again as it is needed to decode the message. - $message = BaseRawDataHandler::STREAM_START_MARKER . $message; + $message = HandleableRawData::STREAM_START_MARKER . $message; // Push it on stack $this->getStackInstance()->pushNamed(self::STACKER_NAME_MULTIPLE_MESSAGE, $message); @@ -271,8 +271,8 @@ class PackageAssembler extends BaseHubSystem implements Assembler, Registerable, // Init fake array $packageContent = array( - BaseRawDataHandler::PACKAGE_RAW_DATA => $this->getInputStreamInstance()->streamData($this->pendingData), - BaseRawDataHandler::PACKAGE_ERROR_CODE => StorableSocket::SOCKET_ERROR_UNHANDLED + HandleableRawData::PACKAGE_RAW_DATA => $this->getInputStreamInstance()->streamData($this->pendingData), + HandleableRawData::PACKAGE_ERROR_CODE => StorableSocket::SOCKET_ERROR_UNHANDLED ); /* @@ -282,12 +282,12 @@ class PackageAssembler extends BaseHubSystem implements Assembler, Registerable, $this->clearPendingData(); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-ASSEMBLER: Last block of partial data received. A total of ' . strlen($packageContent[BaseRawDataHandler::PACKAGE_RAW_DATA]) . ' bytes has been received.'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-ASSEMBLER: Last block of partial data received. A total of ' . strlen($packageContent[HandleableRawData::PACKAGE_RAW_DATA]) . ' bytes has been received.'); // Make sure last CHUNK_SEPARATOR is not there - if (substr($packageContent[BaseRawDataHandler::PACKAGE_RAW_DATA], -1, 1) == PackageFragmenter::CHUNK_SEPARATOR) { + if (substr($packageContent[HandleableRawData::PACKAGE_RAW_DATA], -1, 1) == PackageFragmenter::CHUNK_SEPARATOR) { // Remove it - $packageContent[BaseRawDataHandler::PACKAGE_RAW_DATA] = substr($packageContent[BaseRawDataHandler::PACKAGE_RAW_DATA], 0, -1); + $packageContent[HandleableRawData::PACKAGE_RAW_DATA] = substr($packageContent[HandleableRawData::PACKAGE_RAW_DATA], 0, -1); } // END - if /* @@ -295,7 +295,7 @@ class PackageAssembler extends BaseHubSystem implements Assembler, Registerable, * array of chunks. These chunks must then be verified by their * checksums. Also the final chunk must be handled. */ - $chunks = explode(PackageFragmenter::CHUNK_SEPARATOR, $packageContent[BaseRawDataHandler::PACKAGE_RAW_DATA]); + $chunks = explode(PackageFragmenter::CHUNK_SEPARATOR, $packageContent[HandleableRawData::PACKAGE_RAW_DATA]); // Add all chunks because the last final chunk is found //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-ASSEMBLER: Going to add ' . count($chunks) . ' to chunk handler ...'); diff --git a/application/hub/classes/package/class_NetworkPackage.php b/application/hub/classes/package/class_NetworkPackage.php index a7a0b05b0..1933b8315 100644 --- a/application/hub/classes/package/class_NetworkPackage.php +++ b/application/hub/classes/package/class_NetworkPackage.php @@ -1,38 +1,38 @@ setRegistryInstance($registryInstance); } /** @@ -625,9 +631,6 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R // Debug message //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: Reached line ' . __LINE__ . ' after discoverSocket() has been called.'); - // The socket needs to be put in a special registry that can handle such data - $registryInstance = SocketRegistryFactory::createSocketRegistryInstance(); - // Get the connection helper from registry $helperInstance = Registry::getRegistry()->getInstance('connection'); @@ -647,12 +650,12 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: Reached line ' . __LINE__ . ' before isSocketRegistered() has been called.'); // Is it not there? - if (($socketInstance->isValidSocket()) && (!$registryInstance->isSocketRegistered($infoInstance, $socketInstance))) { + if (($socketInstance->isValidSocket()) && (!$this->getRegistryInstance()->isSocketRegistered($infoInstance, $socketInstance))) { // Debug message //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: Registering socket ' . $socketInstance . ' ...'); // Then register it - $registryInstance->registerSocketInstance($infoInstance, $socketInstance, $packageData); + $this->getRegistryInstance()->registerSocketInstance($infoInstance, $socketInstance, $packageData); } elseif (!$helperInstance->getStateInstance()->isPeerStateConnected()) { // Is not connected, then we cannot send self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: Unexpected peer state ' . $helperInstance->getStateInstance()->__toString() . ' detected.'); @@ -684,11 +687,14 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R * @return void */ private function sendOutgoingRawPackageData (array $packageData) { + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE: packageData()=%d - CALLED!', count($packageData))); + // Init sent bytes $sentBytes = 0; // Get the right connection instance - $infoInstance = SocketRegistryFactory::createSocketRegistryInstance()->getInfoInstanceFromPackageData($packageData); + $infoInstance = $this->getRegistryInstance()->getInfoInstanceFromPackageData($packageData); // Test helper instance assert($infoInstance instanceof ShareableInfo); @@ -710,6 +716,9 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R // Sent out package data $helperInstance->sendRawPackageData($packageData); + + // Debug message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: EXIT!'); } /** @@ -1049,24 +1058,27 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R } // END - if // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE: sentBytes[%s]=%d', gettype($sentBytes), $sentBytes)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE: sentBytes[%s]=%d', gettype($sentBytes), $sentBytes)); // If there was an error, don't continue here if (($sentBytes === 0) && (strlen($encodedDataArray[self::RAW_INDEX_ENCODED_DATA]) > 0)) { // Nothing sent means all data has been sent - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: All sent! (LINE=' . __LINE__ . ')'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: All sent! (LINE=' . __LINE__ . ')'); return; - } elseif (strlen($encodedDataArray[self::RAW_INDEX_ENCODED_DATA]) <= 0) { + } elseif (strlen($encodedDataArray[self::RAW_INDEX_ENCODED_DATA]) == 0) { // Abort here, all sent! - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: All sent! (LINE=' . __LINE__ . ')'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: All sent! (LINE=' . __LINE__ . ')'); return; } + // Debug message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: Pushing raw data back to stacker, as still some data is pending delivery.'); + // Push array back in stack $this->getStackInstance()->pushNamed(self::STACKER_NAME_OUTGOING_STREAM, $encodedDataArray); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: EXIT!'); } /////////////////////////////////////////////////////////////////////////// @@ -1138,25 +1150,25 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R // Make sure both array elements are there assert( (is_array($decodedData)) && - (isset($decodedData[BaseRawDataHandler::PACKAGE_RAW_DATA])) && - (isset($decodedData[BaseRawDataHandler::PACKAGE_ERROR_CODE])) + (isset($decodedData[HandleableRawData::PACKAGE_RAW_DATA])) && + (isset($decodedData[HandleableRawData::PACKAGE_ERROR_CODE])) ); /* * Also make sure the error code is SOCKET_ERROR_UNHANDLED because we * only want to handle unhandled packages here. */ - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: errorCode=' . $decodedData[BaseRawDataHandler::PACKAGE_ERROR_CODE] . '(' . StorableSocket::SOCKET_ERROR_UNHANDLED . ')'); - assert($decodedData[BaseRawDataHandler::PACKAGE_ERROR_CODE] == StorableSocket::SOCKET_ERROR_UNHANDLED); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: errorCode=' . $decodedData[HandleableRawData::PACKAGE_ERROR_CODE] . '(' . StorableSocket::SOCKET_ERROR_UNHANDLED . ')'); + assert($decodedData[HandleableRawData::PACKAGE_ERROR_CODE] == StorableSocket::SOCKET_ERROR_UNHANDLED); // Remove the last chunk SEPARATOR (because there is no need for it) - if (substr($decodedData[BaseRawDataHandler::PACKAGE_RAW_DATA], -1, 1) == PackageFragmenter::CHUNK_SEPARATOR) { + if (substr($decodedData[HandleableRawData::PACKAGE_RAW_DATA], -1, 1) == PackageFragmenter::CHUNK_SEPARATOR) { // It is there and should be removed - $decodedData[BaseRawDataHandler::PACKAGE_RAW_DATA] = substr($decodedData[BaseRawDataHandler::PACKAGE_RAW_DATA], 0, -1); + $decodedData[HandleableRawData::PACKAGE_RAW_DATA] = substr($decodedData[HandleableRawData::PACKAGE_RAW_DATA], 0, -1); } // END - if // This package is "handled" and can be pushed on the next stack - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: Pushing ' . strlen($decodedData[BaseRawDataHandler::PACKAGE_RAW_DATA]) . ' bytes to stack ' . self::STACKER_NAME_DECODED_HANDLED . ' ...'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: Pushing ' . strlen($decodedData[HandleableRawData::PACKAGE_RAW_DATA]) . ' bytes to stack ' . self::STACKER_NAME_DECODED_HANDLED . ' ...'); $this->getStackInstance()->pushNamed(self::STACKER_NAME_DECODED_HANDLED, $decodedData); } @@ -1257,8 +1269,8 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R // Assert on some elements assert( (is_array($packageContent)) && - (isset($packageContent[BaseRawDataHandler::PACKAGE_RAW_DATA])) && - (isset($packageContent[BaseRawDataHandler::PACKAGE_ERROR_CODE])) + (isset($packageContent[HandleableRawData::PACKAGE_RAW_DATA])) && + (isset($packageContent[HandleableRawData::PACKAGE_ERROR_CODE])) ); // Start assembling the raw package data array by chunking it @@ -1268,7 +1280,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R $this->getStackInstance()->popNamed(self::STACKER_NAME_DECODED_HANDLED); // ... and push it on the 'chunked' stacker - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: Pushing ' . strlen($packageContent[BaseRawDataHandler::PACKAGE_RAW_DATA]) . ' bytes on stack ' . self::STACKER_NAME_DECODED_CHUNKED . ',packageContent=' . print_r($packageContent, TRUE)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: Pushing ' . strlen($packageContent[HandleableRawData::PACKAGE_RAW_DATA]) . ' bytes on stack ' . self::STACKER_NAME_DECODED_CHUNKED . ',packageContent=' . print_r($packageContent, TRUE)); $this->getStackInstance()->pushNamed(self::STACKER_NAME_DECODED_CHUNKED, $packageContent); } diff --git a/application/hub/classes/package/fragmenter/class_PackageFragmenter.php b/application/hub/classes/package/fragmenter/class_PackageFragmenter.php index fd49cfe5a..8cfc6e71e 100644 --- a/application/hub/classes/package/fragmenter/class_PackageFragmenter.php +++ b/application/hub/classes/package/fragmenter/class_PackageFragmenter.php @@ -1,15 +1,15 @@ getIteratorInstance()->next(); } } - -// [EOF] -?> diff --git a/application/hub/classes/producer/cruncher/work_units/class_CruncherTestUnitProducer.php b/application/hub/classes/producer/cruncher/work_units/class_CruncherTestUnitProducer.php index 2c8d8bb74..a95841ad3 100644 --- a/application/hub/classes/producer/cruncher/work_units/class_CruncherTestUnitProducer.php +++ b/application/hub/classes/producer/cruncher/work_units/class_CruncherTestUnitProducer.php @@ -1,13 +1,13 @@ partialStub('Maybe implement this method?'); } } - -// [EOF] -?> diff --git a/application/hub/classes/producer/miner/blocks/class_MinerRealGenesisBlockProducer.php b/application/hub/classes/producer/miner/blocks/class_MinerRealGenesisBlockProducer.php index 97b7f8e5c..889a3ea5d 100644 --- a/application/hub/classes/producer/miner/blocks/class_MinerRealGenesisBlockProducer.php +++ b/application/hub/classes/producer/miner/blocks/class_MinerRealGenesisBlockProducer.php @@ -1,11 +1,11 @@ diff --git a/application/hub/classes/recipient/class_ b/application/hub/classes/recipient/class_ index e65c6558f..ca3b5b96b 100644 --- a/application/hub/classes/recipient/class_ +++ b/application/hub/classes/recipient/class_ @@ -6,7 +6,7 @@ namespace Hub\Network\Recipient\; use Hub\Network\Recipient\BaseRecipient; // Import framework stuff -use CoreFramework\Lists\Listable; +use Org\Mxchange\CoreFramework\Lists\Listable; /** * A ??? recipient diff --git a/application/hub/classes/recipient/class_BaseRecipient.php b/application/hub/classes/recipient/class_BaseRecipient.php index 5340d0e6a..c93976e91 100644 --- a/application/hub/classes/recipient/class_BaseRecipient.php +++ b/application/hub/classes/recipient/class_BaseRecipient.php @@ -1,9 +1,9 @@ registerInfoInstance($infoInstance); + + // Trace message + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: EXIT!'); } /** @@ -359,4 +363,24 @@ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocke return $infoInstance; } + /** + * Checks whether a socket of a connection type 'incoming' is registered. + * + * @return $isRegistered Whether such a socket is registered + * @todo 0% done + */ + public function isIncomingSocketRegistered () { + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: CALLED!'); + + // Default is not found + $isRegistered = FALSE; + + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-REGISTRY: isRegistered=%d - EXIT!', intval($isRegistered))); + + // Return status + return $isRegistered; + } + } diff --git a/application/hub/classes/resolver/command/console/class_HubConsoleCommandResolver.php b/application/hub/classes/resolver/command/console/class_HubConsoleCommandResolver.php index aa26c2764..ae0b61c97 100644 --- a/application/hub/classes/resolver/command/console/class_HubConsoleCommandResolver.php +++ b/application/hub/classes/resolver/command/console/class_HubConsoleCommandResolver.php @@ -1,11 +1,11 @@ isCommandValid('Hub\Command', $commandName) === FALSE) { + } elseif ($resolverInstance->isCommandValid('Org\Shipsimu\Hub\Command', $commandName) === FALSE) { // Invalid command found throw new InvalidCommandException(array($resolverInstance, $commandName), self::EXCEPTION_INVALID_COMMAND); } // Set namespace and application instance - $resolverInstance->setNamespace('Hub\Command'); + $resolverInstance->setNamespace('Org\Shipsimu\Hub\Command'); $resolverInstance->setApplicationInstance($applicationInstance); // Return the prepared instance diff --git a/application/hub/classes/resolver/command/html/class_HubHtmlCommandResolver.php b/application/hub/classes/resolver/command/html/class_HubHtmlCommandResolver.php index a71ad087d..9327834fc 100644 --- a/application/hub/classes/resolver/command/html/class_HubHtmlCommandResolver.php +++ b/application/hub/classes/resolver/command/html/class_HubHtmlCommandResolver.php @@ -1,11 +1,11 @@ isCommandValid('Hub\Command', $commandName) === FALSE) { + } elseif ($resolverInstance->isCommandValid('Org\Shipsimu\Hub\Command', $commandName) === FALSE) { // Invalid command found throw new InvalidCommandException(array($resolverInstance, $commandName), self::EXCEPTION_INVALID_COMMAND); } // Set namespace and application instance - $resolverInstance->setNamespace('Hub\Command'); + $resolverInstance->setNamespace('Org\Shipsimu\Hub\Command'); $resolverInstance->setApplicationInstance($applicationInstance); // Return the prepared instance diff --git a/application/hub/classes/resolver/controller/console/class_HubConsoleControllerResolver.php b/application/hub/classes/resolver/controller/console/class_HubConsoleControllerResolver.php index cab02d6e5..1433bb062 100644 --- a/application/hub/classes/resolver/controller/console/class_HubConsoleControllerResolver.php +++ b/application/hub/classes/resolver/controller/console/class_HubConsoleControllerResolver.php @@ -1,12 +1,12 @@ isControllerValid('Hub\Controller', $controllerName) === false) { + } elseif ($resolverInstance->isControllerValid('Org\Shipsimu\Hub\Controller', $controllerName) === false) { // Invalid command found throw new InvalidControllerException(array($resolverInstance, $controllerName), self::EXCEPTION_INVALID_CONTROLLER); } @@ -70,7 +70,7 @@ class HubConsoleControllerResolver extends BaseControllerResolver implements Con $resolverInstance->setApplicationInstance($applicationInstance); // Set namespace and command name - $resolverInstance->setNamespace('Hub\Controller'); + $resolverInstance->setNamespace('Org\Shipsimu\Hub\Controller'); $resolverInstance->setControllerName($controllerName); // Return the prepared instance diff --git a/application/hub/classes/resolver/controller/html/class_HubHtmlControllerResolver.php b/application/hub/classes/resolver/controller/html/class_HubHtmlControllerResolver.php index 5a4795746..2e1299c93 100644 --- a/application/hub/classes/resolver/controller/html/class_HubHtmlControllerResolver.php +++ b/application/hub/classes/resolver/controller/html/class_HubHtmlControllerResolver.php @@ -1,12 +1,12 @@ isControllerValid('Hub\Controller', $controllerName) === false) { + } elseif ($resolverInstance->isControllerValid('Org\Shipsimu\Hub\Controller', $controllerName) === false) { // Invalid command found throw new InvalidControllerException(array($resolverInstance, $controllerName), self::EXCEPTION_INVALID_CONTROLLER); } @@ -70,7 +70,7 @@ class HubHtmlControllerResolver extends BaseControllerResolver implements Contro $resolverInstance->setApplicationInstance($applicationInstance); // Set namespace and command name - $resolverInstance->setNamespace('Hub\Controller'); + $resolverInstance->setNamespace('Org\Shipsimu\Hub\Controller'); $resolverInstance->setControllerName($controllerName); // Return the prepared instance diff --git a/application/hub/classes/resolver/protocol/class_BaseProtocolResolver.php b/application/hub/classes/resolver/protocol/class_BaseProtocolResolver.php index c7c40df24..ca48cdd85 100644 --- a/application/hub/classes/resolver/protocol/class_BaseProtocolResolver.php +++ b/application/hub/classes/resolver/protocol/class_BaseProtocolResolver.php @@ -1,9 +1,9 @@ diff --git a/application/hub/classes/states/crawler/active/class_CrawlerActiveState.php b/application/hub/classes/states/crawler/active/class_CrawlerActiveState.php index 647f1b186..18f56ac47 100644 --- a/application/hub/classes/states/crawler/active/class_CrawlerActiveState.php +++ b/application/hub/classes/states/crawler/active/class_CrawlerActiveState.php @@ -1,9 +1,10 @@ partialStub('Unfinished method, executorInstance=' . $executorInstance->__toString()); } } - -// [EOF] -?> diff --git a/application/hub/classes/states/crawler/booting/class_CrawlerBootingState.php b/application/hub/classes/states/crawler/booting/class_CrawlerBootingState.php index 684f3262e..0c6d1f9ac 100644 --- a/application/hub/classes/states/crawler/booting/class_CrawlerBootingState.php +++ b/application/hub/classes/states/crawler/booting/class_CrawlerBootingState.php @@ -1,9 +1,10 @@ partialStub('Unfinished method, executorInstance=' . $executorInstance->__toString()); } } - -// [EOF] -?> diff --git a/application/hub/classes/states/crawler/class_BaseCrawlerState.php b/application/hub/classes/states/crawler/class_BaseCrawlerState.php index dcfefa1d5..6c715641e 100644 --- a/application/hub/classes/states/crawler/class_BaseCrawlerState.php +++ b/application/hub/classes/states/crawler/class_BaseCrawlerState.php @@ -1,9 +1,9 @@ diff --git a/application/hub/classes/states/cruncher/class_BaseCruncherState.php b/application/hub/classes/states/cruncher/class_BaseCruncherState.php index 357abe170..eb7df383f 100644 --- a/application/hub/classes/states/cruncher/class_BaseCruncherState.php +++ b/application/hub/classes/states/cruncher/class_BaseCruncherState.php @@ -1,9 +1,9 @@ diff --git a/application/hub/classes/states/cruncher/virgin/class_CruncherVirginState.php b/application/hub/classes/states/cruncher/virgin/class_CruncherVirginState.php index 9dce0225b..aaab7c5a8 100644 --- a/application/hub/classes/states/cruncher/virgin/class_CruncherVirginState.php +++ b/application/hub/classes/states/cruncher/virgin/class_CruncherVirginState.php @@ -1,9 +1,10 @@ produceKeys($this); } } - -// [EOF] -?> diff --git a/application/hub/classes/states/dht/active/class_DhtActiveState.php b/application/hub/classes/states/dht/active/class_DhtActiveState.php index 9e908d6b9..594e2742b 100644 --- a/application/hub/classes/states/dht/active/class_DhtActiveState.php +++ b/application/hub/classes/states/dht/active/class_DhtActiveState.php @@ -1,12 +1,12 @@ diff --git a/application/hub/classes/states/miner/virgin/class_MinerVirginState.php b/application/hub/classes/states/miner/virgin/class_MinerVirginState.php index f2e9e84e4..32c1b5861 100644 --- a/application/hub/classes/states/miner/virgin/class_MinerVirginState.php +++ b/application/hub/classes/states/miner/virgin/class_MinerVirginState.php @@ -1,9 +1,10 @@ produceKeys($this); } } - -// [EOF] -?> diff --git a/application/hub/classes/states/node/active/class_NodeActiveState.php b/application/hub/classes/states/node/active/class_NodeActiveState.php index 6fad50910..907783d14 100644 --- a/application/hub/classes/states/node/active/class_NodeActiveState.php +++ b/application/hub/classes/states/node/active/class_NodeActiveState.php @@ -1,13 +1,13 @@ ifStartEndMarkersSet($data)); // Count of start and end markers must be the same - assert(substr_count($data, BaseRawDataHandler::STREAM_START_MARKER) == substr_count($data, BaseRawDataHandler::STREAM_END_MARKER)); + assert(substr_count($data, HandleableRawData::STREAM_START_MARKER) == substr_count($data, HandleableRawData::STREAM_END_MARKER)); // Check if more than two start markers exist and if so, split it. - if (substr_count($data, BaseRawDataHandler::STREAM_START_MARKER) > 1) { + if (substr_count($data, HandleableRawData::STREAM_START_MARKER) > 1) { // Please do it outside this method throw new MultipleMessageSentException(array($this, $data), BaseHubSystem::EXCEPTION_MULTIPLE_MESSAGE_SENT); } // END - if // Remove both - $data = substr($data, strlen(BaseRawDataHandler::STREAM_START_MARKER), -1 * strlen(BaseRawDataHandler::STREAM_END_MARKER)); + $data = substr($data, strlen(HandleableRawData::STREAM_START_MARKER), -1 * strlen(HandleableRawData::STREAM_END_MARKER)); // Can it be validated? if ((strlen($data) % 4) != 0) { diff --git a/application/hub/classes/streams/raw_data/output/class_RawDataOutputStream.php b/application/hub/classes/streams/raw_data/output/class_RawDataOutputStream.php index 5ca6481df..8ea061fa4 100644 --- a/application/hub/classes/streams/raw_data/output/class_RawDataOutputStream.php +++ b/application/hub/classes/streams/raw_data/output/class_RawDataOutputStream.php @@ -1,13 +1,13 @@ debugOutput(sprintf('RAW-OUTPUT-STREAM: data()=%d - CALLED!', strlen($data))); + /* * Encode the data with BASE64 encoding and put it in a "frame": * * [[S]] - Start marker * [[E]] - End marker */ - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('RAW-OUTPUT-STREAM: data()=' . strlen($data) . ' - BEFORE!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('RAW-OUTPUT-STREAM: data(%d)=%s - BEFORE!', strlen($data), $data)); $data = sprintf('%s%s%s', - BaseRawDataHandler::STREAM_START_MARKER, + HandleableRawData::STREAM_START_MARKER, base64_encode($data), - BaseRawDataHandler::STREAM_END_MARKER + HandleableRawData::STREAM_END_MARKER ); - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('RAW-OUTPUT-STREAM: data(' . strlen($data) . ')=' . $data); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('RAW-OUTPUT-STREAM: data(%d)=%s - AFTER!', strlen($data), $data)); + + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('RAW-OUTPUT-STREAM: data()=%d - EXIT!', strlen($data))); // Return it return $data; diff --git a/application/hub/classes/tags/class_BaseTag.php b/application/hub/classes/tags/class_BaseTag.php index 6de66a680..f1b8c5921 100644 --- a/application/hub/classes/tags/class_BaseTag.php +++ b/application/hub/classes/tags/class_BaseTag.php @@ -1,12 +1,12 @@ debugOutput('TAGS: packageData=' . print_r($packageData, TRUE)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TAGS: packageData=' . print_r($packageData, TRUE)); /* * We take a look at the tags (in most cases only one is needed) so @@ -191,7 +191,7 @@ class PackageTags extends BaseTag implements Tagable { // Extract the tags $this->extractTagsFromPackageData($packageData); - // Now we need to verify every single tag + // Now every single tag needs to be validated $this->verifyAllTags($packageData); // Now simply check it out diff --git a/application/hub/classes/tasks/apt-proxy/class_ b/application/hub/classes/tasks/apt-proxy/class_ index b11ac8fef..aef1feefa 100644 --- a/application/hub/classes/tasks/apt-proxy/class_ +++ b/application/hub/classes/tasks/apt-proxy/class_ @@ -3,10 +3,10 @@ namespace Hub\Task\AptProxy\; // Import framework stuff -use CoreFramework\Task\BaseTask; -use CoreFramework\Task\Taskable; -use CoreFramework\Visitor\Visitable; -use CoreFramework\Visitor\Visitor; +use Org\Mxchange\CoreFramework\Task\BaseTask; +use Org\Mxchange\CoreFramework\Task\Taskable; +use Org\Mxchange\CoreFramework\Visitor\Visitable; +use Org\Mxchange\CoreFramework\Visitor\Visitor; /** * A ??? task for apt-proxy consoles diff --git a/application/hub/classes/tasks/apt-proxy/class_AptProxyListenerTask.php b/application/hub/classes/tasks/apt-proxy/class_AptProxyListenerTask.php index 1fa8b3034..355077ad1 100644 --- a/application/hub/classes/tasks/apt-proxy/class_AptProxyListenerTask.php +++ b/application/hub/classes/tasks/apt-proxy/class_AptProxyListenerTask.php @@ -1,12 +1,12 @@ isEncodedDataPending()) { // Trace message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-WRITER-TASK: Calling packageInstance->sendEncodedData() ...'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-WRITER-TASK: Calling packageInstance->sendEncodedData() ...'); // Sent encoded (raw) data $packageInstance->sendEncodedData(); } elseif ($packageInstance->isPackageWaitingForDelivery()) { // Trace message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-WRITER-TASK: Calling packageInstance->sendWaitingPackage() ...'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-WRITER-TASK: Calling packageInstance->sendWaitingPackage() ...'); // Sent it finally out $packageInstance->sendWaitingPackage(); } elseif ($packageInstance->isPackageDeclared()) { // Trace message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-WRITER-TASK: Calling packageInstance->processDeclaredPackage() ...'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-WRITER-TASK: Calling packageInstance->processDeclaredPackage() ...'); // Prepare package for delivery $packageInstance->processDeclaredPackage(); } elseif ($packageInstance->isPackageEnqueued()) { // Trace message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-WRITER-TASK: Calling packageInstance->declareEnqueuedPackage() ...'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-WRITER-TASK: Calling packageInstance->declareEnqueuedPackage() ...'); // Okay, then deliver (better discover its recipients) this package $packageInstance->declareEnqueuedPackage(); diff --git a/application/hub/classes/tasks/node/announcement/class_NodeAnnouncementTask.php b/application/hub/classes/tasks/node/announcement/class_NodeAnnouncementTask.php index b83eca7ac..5a8f829fe 100644 --- a/application/hub/classes/tasks/node/announcement/class_NodeAnnouncementTask.php +++ b/application/hub/classes/tasks/node/announcement/class_NodeAnnouncementTask.php @@ -1,15 +1,15 @@ getConfigEntry('external_address') != '') { + if (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('external_address') != '') { // Use it as external address - $unl = FrameworkConfiguration::getSelfInstance()->getConfigEntry('external_address'); + $unl = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('external_address'); } else { // Determine own external address by connecting to my (coder) server at 188.138.90.169 $unl = self::determineExternalUniversalNodeLocator(); @@ -244,18 +244,18 @@ class HubTools extends BaseHubSystem { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: CALLED!'); // Is the internal_address config entry set? - if (FrameworkConfiguration::getSelfInstance()->getConfigEntry('allow_publish_internal_address') == 'N') { + if (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('allow_publish_internal_address') == 'N') { // Debug message //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: Calling self::determineOwnExternalAddress() as allow_publish_internal_address=N is set ...'); // Not allowed to publish internal address, so use external $unl = self::determineOwnExternalAddress(); - } elseif (FrameworkConfiguration::getSelfInstance()->getConfigEntry('internal_address') != '') { + } elseif (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('internal_address') != '') { // Debug message //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: Getting config entry internal_address ...'); // Use it as internal address - $unl = FrameworkConfiguration::getSelfInstance()->getConfigEntry('internal_address'); + $unl = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('internal_address'); } else { // Debug message //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: Calling self::determineInternalUniversalNodeLocator() ...'); diff --git a/application/hub/classes/visitor/pool/class_ b/application/hub/classes/visitor/pool/class_ index 7002224e4..28db8b1a6 100644 --- a/application/hub/classes/visitor/pool/class_ +++ b/application/hub/classes/visitor/pool/class_ @@ -7,8 +7,8 @@ use Hub\Pool\Poolable; use Hub\Visitor\Pool\PoolVisitor; // Import framework stuff -use CoreFramework\Visitor\BaseVisitor; -use CoreFramework\Visitor\Visitor; +use Org\Mxchange\CoreFramework\Visitor\BaseVisitor; +use Org\Mxchange\CoreFramework\Visitor\Visitor; /** * A ??? visitor diff --git a/application/hub/classes/visitor/pool/handler/class_Handler b/application/hub/classes/visitor/pool/handler/class_Handler index 0a4f1298d..c75e7bcd3 100644 --- a/application/hub/classes/visitor/pool/handler/class_Handler +++ b/application/hub/classes/visitor/pool/handler/class_Handler @@ -7,7 +7,7 @@ use Hub\Pool\Poolable; use Hub\Visitor\Pool\PoolVisitor; // Import framework stuff -use CoreFramework\Visitor\BaseVisitor; +use Org\Mxchange\CoreFramework\Visitor\BaseVisitor; /** * A ??? handler visitor diff --git a/application/hub/classes/visitor/pool/monitor/class_RawDataPoolMonitorVisitor.php b/application/hub/classes/visitor/pool/monitor/class_RawDataPoolMonitorVisitor.php index 7ec3db43d..ffc9f76a7 100644 --- a/application/hub/classes/visitor/pool/monitor/class_RawDataPoolMonitorVisitor.php +++ b/application/hub/classes/visitor/pool/monitor/class_RawDataPoolMonitorVisitor.php @@ -1,17 +1,17 @@ debugOutput('RAWDATA-MONITOR-VISITOR: poolInstance=' . $poolInstance->__toString() . ' - CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('RAWDATA-MONITOR-VISITOR: poolInstance=' . $poolInstance->__toString() . ' - CALLED!'); } /** @@ -82,12 +82,17 @@ class RawDataPoolMonitorVisitor extends BaseVisitor implements PoolVisitor, List * @return void */ public function visitListener (Listenable $listenerInstance) { + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('RAWDATA-MONITOR-VISITOR: listenerInstance=' . $listenerInstance->__toString() . ' - CALLED!'); + /* - * The listener itself cannot distinguish between node and client - * traffic. This is why its method monitorIncomingRawData() is not - * called. + * The TCP/UDP listener have a socket registry instance set. These + * registered sockets needs to be checked for pending incoming data. */ - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('RAWDATA-MONITOR-VISITOR: listenerInstance=' . $listenerInstance->__toString() . ' - CALLED!'); + $listenerInstance->monitorIncomingRawData(); + + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('RAWDATA-MONITOR-VISITOR: EXIT!'); } /** @@ -98,9 +103,9 @@ class RawDataPoolMonitorVisitor extends BaseVisitor implements PoolVisitor, List */ public function visitDecorator (BaseDecorator $decoratorInstance) { // Do monitor here - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('RAWDATA-MONITOR-VISITOR: Visiting decoratorInstance=' . $decoratorInstance->__toString() . ' - CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('RAWDATA-MONITOR-VISITOR: Visiting decoratorInstance=' . $decoratorInstance->__toString() . ' - CALLED!'); $decoratorInstance->monitorIncomingRawData(); - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('RAWDATA-MONITOR-VISITOR: Visiting decoratorInstance=' . $decoratorInstance->__toString() . ' - EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('RAWDATA-MONITOR-VISITOR: EXIT!'); } } diff --git a/application/hub/classes/visitor/pool/shutdown/class_Shutdown b/application/hub/classes/visitor/pool/shutdown/class_Shutdown index 08b3b1286..96241414e 100644 --- a/application/hub/classes/visitor/pool/shutdown/class_Shutdown +++ b/application/hub/classes/visitor/pool/shutdown/class_Shutdown @@ -7,7 +7,7 @@ use Hub\Pool\Poolable; use Hub\Visitor\Pool\PoolVisitor; // Import framework stuff -use CoreFramework\Visitor\BaseVisitor; +use Org\Mxchange\CoreFramework\Visitor\BaseVisitor; /** * A ??? shutdown visitor diff --git a/application/hub/classes/visitor/pool/shutdown/class_ShutdownListenerPoolVisitor.php b/application/hub/classes/visitor/pool/shutdown/class_ShutdownListenerPoolVisitor.php index 7fc8831c9..da5ab1019 100644 --- a/application/hub/classes/visitor/pool/shutdown/class_ShutdownListenerPoolVisitor.php +++ b/application/hub/classes/visitor/pool/shutdown/class_ShutdownListenerPoolVisitor.php @@ -1,14 +1,14 @@ setConfigEntry('node_listen_addr', '0.0.0.0'); diff --git a/application/hub/config.php b/application/hub/config.php index 0a9b48f61..7ccea7d68 100644 --- a/application/hub/config.php +++ b/application/hub/config.php @@ -1,6 +1,6 @@ setConfigEntry('hub_bootstrap_nodes', 'tcp://188.138.90.169:9060'); @@ -43,7 +43,7 @@ $cfg->setConfigEntry('node_default_mode', 'regular'); $cfg->setConfigEntry('enable_feature_hubcoin_reward', 'Y'); // CFG: FEATURE-HUBCOIN-REWARD-CLASS -$cfg->setConfigEntry('feature_hubcoin_reward_class', 'Hub\Feature\CoinReward\HubcoinRewardFeature'); +$cfg->setConfigEntry('feature_hubcoin_reward_class', 'Org\Shipsimu\Hub\Feature\CoinReward\HubcoinRewardFeature'); // CFG: TEMPLATE-ENGINE $cfg->setConfigEntry('tpl_engine', 'ConsoleOutput'); @@ -52,64 +52,64 @@ $cfg->setConfigEntry('tpl_engine', 'ConsoleOutput'); $cfg->setConfigEntry('output_class', 'DebugConsoleOutput'); // CFG: NODE-INFO-DB-WRAPPER-CLASS -$cfg->setConfigEntry('node_info_db_wrapper_class', 'Hub\Database\Frontend\Node\Information\NodeInformationDatabaseWrapper'); +$cfg->setConfigEntry('node_info_db_wrapper_class', 'Org\Shipsimu\Hub\Database\Frontend\Node\Information\NodeInformationDatabaseWrapper'); // CFG: NODE-DHT-DB-WRAPPER-CLASS -$cfg->setConfigEntry('node_dht_db_wrapper_class', 'Hub\Database\Frontend\Node\Dht\NodeDistributedHashTableDatabaseWrapper'); +$cfg->setConfigEntry('node_dht_db_wrapper_class', 'Org\Shipsimu\Hub\Database\Frontend\Node\Dht\NodeDistributedHashTableDatabaseWrapper'); // CFG: NODE-DHT-LIST-LIMIT $cfg->setConfigEntry('node_dht_list_limit', 20); // CFG: PEER-LOOKUP-DB-WRAPPER-CLASS -$cfg->setConfigEntry('peer_state_lookup_db_wrapper_class', 'Hub\Database\Frontend\Node\PeerState\PeerStateLookupDatabaseWrapper'); +$cfg->setConfigEntry('peer_state_lookup_db_wrapper_class', 'Org\Shipsimu\Hub\Database\Frontend\Node\PeerState\PeerStateLookupDatabaseWrapper'); // CFG: WEB-CONTENT-TYPE $cfg->setConfigEntry('web_content_type', ''); // CFG: LISTENER-POOL-CLAS -$cfg->setConfigEntry('listener_pool_class', 'Hub\Pool\Listener\DefaultListenerPool'); +$cfg->setConfigEntry('listener_pool_class', 'Org\Shipsimu\Hub\Pool\Listener\DefaultListenerPool'); // CFG: TCP-LISTENER-CLASS -$cfg->setConfigEntry('tcp_listener_class', 'Hub\Listener\Tcp\TcpListener'); +$cfg->setConfigEntry('tcp_listener_class', 'Org\Shipsimu\Hub\Listener\Tcp\TcpListener'); // CFG: UDP-LISTENER-CLASS -$cfg->setConfigEntry('udp_listener_class', 'Hub\Listener\Udp\UdpListener'); +$cfg->setConfigEntry('udp_listener_class', 'Org\Shipsimu\Hub\Listener\Udp\UdpListener'); // CFG: SOCKET-FILE-LISTENER-CLASS -$cfg->setConfigEntry('socket_file_listener_class', 'Hub\Listener\Socket\SocketFileListener'); +$cfg->setConfigEntry('socket_file_listener_class', 'Org\Shipsimu\Hub\Listener\Socket\SocketFileListener'); // CFG: SOCKET-FILE-DECORATOR-LISTENER-CLASS -$cfg->setConfigEntry('socket_file_decorator_listener_class', 'Hub\Listener\Socket\SocketFileListenerDecorator'); +$cfg->setConfigEntry('socket_file_decorator_listener_class', 'Org\Shipsimu\Hub\Listener\Socket\SocketFileListenerDecorator'); // CFG: NODE-TCP-LISTENER-CLASS -$cfg->setConfigEntry('node_tcp_listener_class', 'Hub\Listener\Hub\Tcp\HubTcpListenerDecorator'); +$cfg->setConfigEntry('node_tcp_listener_class', 'Org\Shipsimu\Hub\Listener\Hub\Tcp\HubTcpListenerDecorator'); // CFG: NODE-UDP-LISTENER-CLASS -$cfg->setConfigEntry('node_udp_listener_class', 'Hub\Listener\Hub\Udp\HubUdpListenerDecorator'); +$cfg->setConfigEntry('node_udp_listener_class', 'Org\Shipsimu\Hub\Listener\Hub\Udp\HubUdpListenerDecorator'); // CFG: CLIENT-TCP-LISTENER-CLASS -$cfg->setConfigEntry('client_tcp_listener_class', 'Hub\Listener\Client\Tcp\ClientTcpListenerDecorator'); +$cfg->setConfigEntry('client_tcp_listener_class', 'Org\Shipsimu\Hub\Listener\Client\Tcp\ClientTcpListenerDecorator'); // CFG: CLIENT-UDP-LISTENER-CLASS -$cfg->setConfigEntry('client_udp_listener_class', 'Hub\Listener\Client\Udp\ClientUdpListenerDecorator'); +$cfg->setConfigEntry('client_udp_listener_class', 'Org\Shipsimu\Hub\Listener\Client\Udp\ClientUdpListenerDecorator'); // CFG: NODE-POOL-CLASS -$cfg->setConfigEntry('node_pool_class', 'Hub\Pool\Peer\DefaultPeerPool'); +$cfg->setConfigEntry('node_pool_class', 'Org\Shipsimu\Hub\Pool\Peer\DefaultPeerPool'); // CFG: APPLICATION-POOL-CLASS -$cfg->setConfigEntry('application_pool_class', 'Hub\Pool\Peer\DefaultPeerPool'); +$cfg->setConfigEntry('application_pool_class', 'Org\Shipsimu\Hub\Pool\Peer\DefaultPeerPool'); // CFG: POOL-ENTRIES-LIST-CLASS -$cfg->setConfigEntry('pool_entries_list_class', 'Hub\Lists\Pool\PoolEntriesList'); +$cfg->setConfigEntry('pool_entries_list_class', 'Org\Shipsimu\Hub\Lists\Pool\PoolEntriesList'); // CFG: FILE-POOL-ITERATOR-CLASS -$cfg->setConfigEntry('file_pool_iterator_class', 'CoreFramework\Iterator\DefaultIterator'); +$cfg->setConfigEntry('file_pool_iterator_class', 'Org\Mxchange\CoreFramework\Iterator\DefaultIterator'); // CFG: TCP-POOL-ITERATOR-CLASS -$cfg->setConfigEntry('tcp_pool_iterator_class', 'CoreFramework\Iterator\DefaultIterator'); +$cfg->setConfigEntry('tcp_pool_iterator_class', 'Org\Mxchange\CoreFramework\Iterator\DefaultIterator'); // CFG: UDP-POOL-ITERATOR-CLASS -$cfg->setConfigEntry('udp_pool_iterator_class', 'CoreFramework\Iterator\DefaultIterator'); +$cfg->setConfigEntry('udp_pool_iterator_class', 'Org\Mxchange\CoreFramework\Iterator\DefaultIterator'); // CFG: SHUTDOWN-POOL-ITERATOR-CLASS $cfg->setConfigEntry('shutdown_pool_iterator_class', 'ShutdownPoolIterator'); @@ -118,43 +118,46 @@ $cfg->setConfigEntry('shutdown_pool_iterator_class', 'ShutdownPoolIterator'); $cfg->setConfigEntry('handler_pool_iterator_class', 'HandlerPoolIterator'); // CFG: NETWORK-LISTEN-ITERATOR-CLASS -$cfg->setConfigEntry('network_listen_iterator_class', 'Hub\Iterator\Network\Listener\NetworkListenIterator'); +$cfg->setConfigEntry('network_listen_iterator_class', 'Org\Shipsimu\Hub\Iterator\Network\Listener\NetworkListenIterator'); // CFG: SOCKET-LISTEN-ITERATOR-CLASS -$cfg->setConfigEntry('socket_listen_iterator_class', 'CoreFramework\Iterator\DefaultIterator'); +$cfg->setConfigEntry('socket_listen_iterator_class', 'Org\Mxchange\CoreFramework\Iterator\DefaultIterator'); // CFG: TCP-RAW-DATA-HANDLER-CLASS -$cfg->setConfigEntry('tcp_raw_data_handler_class', 'Hub\Handler\Network\RawData\Tcp\TcpRawDataHandler'); +$cfg->setConfigEntry('tcp_raw_data_handler_class', 'Org\Shipsimu\Hub\Handler\Network\RawData\Tcp\TcpRawDataHandler'); // CFG: UDP-RAW-DATA-HANDLER-CLASS -$cfg->setConfigEntry('udp_raw_data_handler_class', 'Hub\Handler\Network\RawData\Udp\UdpRawDataHandler'); +$cfg->setConfigEntry('udp_raw_data_handler_class', 'Org\Shipsimu\Hub\Handler\Network\RawData\Udp\UdpRawDataHandler'); // CFG: SOCKET-RAW-DATA-HANDLER-CLASS -$cfg->setConfigEntry('socket_raw_data_handler_class', 'Hub\Handler\Network\Socket\RawData\SocketRawDataHandler'); +$cfg->setConfigEntry('socket_raw_data_handler_class', 'Org\Shipsimu\Hub\Handler\Network\Socket\RawData\SocketRawDataHandler'); // CFG: SHUTDOWN-LISTENER-POOL-VISITOR-CLASS $cfg->setConfigEntry('shutdown_listener_pool_visitor_class', 'ShutdownListenerPoolVisitor'); // CFG: SHUTDOWN-SOCKET-VISITOR-CLASS -$cfg->setConfigEntry('shutdown_socket_visitor_class', 'Hub\Visitor\Shutdown\Socket\ShutdownSocketVisitor'); +$cfg->setConfigEntry('shutdown_socket_visitor_class', 'Org\Shipsimu\Hub\Visitor\Shutdown\Socket\ShutdownSocketVisitor'); // CFG: HALF-SHUTDOWN-SOCKET-VISITOR-CLASS -$cfg->setConfigEntry('half_shutdown_socket_visitor_class', 'Hub\Visitor\Shutdown\Socket\HalfShutdownSocketVisitor'); +$cfg->setConfigEntry('half_shutdown_socket_visitor_class', 'Org\Shipsimu\Hub\Visitor\Shutdown\Socket\HalfShutdownSocketVisitor'); // CFG: NODE-RAW-DATA-MONITOR-VISITOR-CLASS -$cfg->setConfigEntry('node_raw_data_monitor_visitor_class', 'Hub\Visitor\Monitor\Pool\RawDataPoolMonitorVisitor'); +$cfg->setConfigEntry('node_raw_data_monitor_visitor_class', 'Org\Shipsimu\Hub\Visitor\Monitor\Pool\RawDataPoolMonitorVisitor'); // CFG: ACTIVE-TASK-VISITOR-CLASS -$cfg->setConfigEntry('active_task_visitor_class', 'Hub\Visitor\Task\Active\ActiveTaskVisitor'); +$cfg->setConfigEntry('active_task_visitor_class', 'Org\Shipsimu\Hub\Visitor\Task\Active\ActiveTaskVisitor'); + +// CFG: SHUTDOWN-TASK-VISITOR-CLASS +$cfg->setConfigEntry('shutdown_task_visitor_class', 'Org\Shipsimu\Hub\Visitor\Task\Shutdown\ShutdownTaskVisitor'); // CFG: NODE-ANNOUNCEMENT-HELPER-CLASS $cfg->setConfigEntry('node_announcement_helper_class', 'NodeAnnouncementHelper'); // CFG: NODE-SELF-CONNECT-HELPER-CLASS -$cfg->setConfigEntry('node_self_connect_helper_class', 'Hub\Node\Helper\SelfConnect\NodeSelfConnectHelper'); +$cfg->setConfigEntry('node_self_connect_helper_class', 'Org\Shipsimu\Hub\Node\Helper\SelfConnect\NodeSelfConnectHelper'); // CFG: DHT-BOOTSTRAP-HELPER-CLASS -$cfg->setConfigEntry('dht_bootstrap_helper_class', 'Hub\Helper\Dht\Bootstrap\DhtBootstrapHelper'); +$cfg->setConfigEntry('dht_bootstrap_helper_class', 'Org\Shipsimu\Hub\Helper\Dht\Bootstrap\DhtBootstrapHelper'); // CFG: DHT-PUBLISH-ENTRY-HELPER-CLASS $cfg->setConfigEntry('dht_publish_entry_helper_class', 'DhtPublishEntryHelper'); @@ -166,55 +169,55 @@ $cfg->setConfigEntry('default_console_command', 'main'); $cfg->setConfigEntry('default_hub_console_command', 'main'); // CFG: HUB-CONSOLE-CMD-MAIN-RESOLVER-CLASS -$cfg->setConfigEntry('hub_console_cmd_main_resolver_class', 'Hub\Resolver\Command\HubConsoleCommandResolver'); +$cfg->setConfigEntry('hub_console_cmd_main_resolver_class', 'Org\Shipsimu\Hub\Resolver\Command\HubConsoleCommandResolver'); // CFG: NETWORK-STATE-RESOLVER-CLASS $cfg->setConfigEntry('network_state_resolver_class', 'NetworkStateResolver'); // CFG: NEWS-DOWNLOAD-FILTER -$cfg->setConfigEntry('news_download_filter_class', 'CoreFramework\Filter\News\NewsDownloadFilter'); +$cfg->setConfigEntry('news_download_filter_class', 'Org\Mxchange\CoreFramework\Filter\News\NewsDownloadFilter'); // CFG: NEWS-PROCESS-FILTER -$cfg->setConfigEntry('news_process_filter_class', 'CoreFramework\Filter\News\NewsProcessFilter'); +$cfg->setConfigEntry('news_process_filter_class', 'Org\Mxchange\CoreFramework\Filter\News\NewsProcessFilter'); // CFG: NODE-PHP-REQUIREMENTS-FILTER -$cfg->setConfigEntry('node_php_requirements_filter_class', 'Hub\Filter\Node\Requirements\NodePhpRequirementsFilter'); +$cfg->setConfigEntry('node_php_requirements_filter_class', 'Org\Shipsimu\Hub\Filter\Node\Requirements\NodePhpRequirementsFilter'); // CFG: NODE-INITIALIZER-FILTER -$cfg->setConfigEntry('node_initializer_filter_class', 'Hub\Filter\Node\Initialization\NodeInitializationFilter'); +$cfg->setConfigEntry('node_initializer_filter_class', 'Org\Shipsimu\Hub\Filter\Node\Initialization\NodeInitializationFilter'); // CFG: NODE-ACTIVATION-TASK-HANDLER-INITIALIZER-FILTER -$cfg->setConfigEntry('node_activation_task_handler_initializer_filter_class', 'Hub\Filter\Initializer\Node\Handler\Task\NodeTaskHandlerInitializerFilter'); +$cfg->setConfigEntry('node_activation_task_handler_initializer_filter_class', 'Org\Shipsimu\Hub\Filter\Initializer\Node\Handler\Task\NodeTaskHandlerInitializerFilter'); // CFG: NODE-ACTIVATION-ANNOUNCEMENT-TASK-FILTER $cfg->setConfigEntry('node_activation_announcement_task_filter_class', 'NodeActivationAnnouncementFilter'); // CFG: NODE-WELCOME-TEASER-FILTER -$cfg->setConfigEntry('node_welcome_teaser_filter_class', 'Hub\Filter\Node\WelcomeTeaser\NodeWelcomeTeaserFilter'); +$cfg->setConfigEntry('node_welcome_teaser_filter_class', 'Org\Shipsimu\Hub\Filter\Node\WelcomeTeaser\NodeWelcomeTeaserFilter'); // CFG: NODE-BOOTSTRAP-GENERATE-NODEID-FILTER -$cfg->setConfigEntry('node_bootstrap_generate_nodeid_filter_class', 'Hub\Filter\Bootstrap\Node\NodeId\NodeBootstrapGenerateNodeIdFilter'); +$cfg->setConfigEntry('node_bootstrap_generate_nodeid_filter_class', 'Org\Shipsimu\Hub\Filter\Bootstrap\Node\NodeId\NodeBootstrapGenerateNodeIdFilter'); // CFG: NODE-BOOTSTRAP-GENERATE-SESSIONID-FILTER -$cfg->setConfigEntry('node_bootstrap_generate_sessionid_filter_class', 'Hub\Filter\Bootstrap\Node\SessionId\NodeBootstrapGenerateSessionIdFilter'); +$cfg->setConfigEntry('node_bootstrap_generate_sessionid_filter_class', 'Org\Shipsimu\Hub\Filter\Bootstrap\Node\SessionId\NodeBootstrapGenerateSessionIdFilter'); // CFG: NODE-BOOTSTRAP-GENERATE-PRIVATE-KEY-FILTER -$cfg->setConfigEntry('node_bootstrap_generate_private_key_filter_class', 'Hub\Filter\Bootstrap\Node\PrivateKey\NodeBootstrapGeneratePrivateKeyFilter'); +$cfg->setConfigEntry('node_bootstrap_generate_private_key_filter_class', 'Org\Shipsimu\Hub\Filter\Bootstrap\Node\PrivateKey\NodeBootstrapGeneratePrivateKeyFilter'); // CFG: NODE-BOOTSTRAP-EXTRA-BOOTSTRAPPING-FILTER -$cfg->setConfigEntry('node_bootstrap_extra_bootstrapping_filter_class', 'Hub\Filter\Bootstrap\Node\Extra\NodeBootstrapExtraBootstrappingFilter'); +$cfg->setConfigEntry('node_bootstrap_extra_bootstrapping_filter_class', 'Org\Shipsimu\Hub\Filter\Bootstrap\Node\Extra\NodeBootstrapExtraBootstrappingFilter'); // CFG: NODE-BOOTSTRAP-LISTENER-POOL-FILTER -$cfg->setConfigEntry('node_bootstrap_listener_pool_filter_class', 'Hub\Filter\Bootstrap\Node\Pool\NodeBootstrapListenerPoolFilter'); +$cfg->setConfigEntry('node_bootstrap_listener_pool_filter_class', 'Org\Shipsimu\Hub\Filter\Bootstrap\Node\Pool\NodeBootstrapListenerPoolFilter'); // CFG: NODE-SHUTDOWN-FLUSH-NODE-LIST-FILTER -$cfg->setConfigEntry('node_shutdown_flush_node_list_filter_class', 'Hub\Filter\Shutdown\Node\NodeList\NodeShutdownFlushNodeListFilter'); +$cfg->setConfigEntry('node_shutdown_flush_node_list_filter_class', 'Org\Shipsimu\Hub\Filter\Shutdown\Node\NodeList\NodeShutdownFlushNodeListFilter'); // CFG: NODE-SHUTDOWN-TASK-HANDLER-FILTER -$cfg->setConfigEntry('node_shutdown_task_handler_filter_class', 'Hub\Filter\Shutdown\Node\Handler\Task\NodeShutdownTaskHandlerFilter'); +$cfg->setConfigEntry('node_shutdown_task_handler_filter_class', 'Org\Shipsimu\Hub\Filter\Shutdown\Node\Handler\Task\NodeShutdownTaskHandlerFilter'); // CFG: NODE-SHUTDOWN-NODE-FILTER -$cfg->setConfigEntry('node_shutdown_node_filter_class', 'Hub\Filter\Shutdown\Node\NodeShutdownNodeFilter'); +$cfg->setConfigEntry('node_shutdown_node_filter_class', 'Org\Shipsimu\Hub\Filter\Shutdown\Node\NodeShutdownNodeFilter'); // CFG: PACKAGE-FILTER-CHAIN-CLASS $cfg->setConfigEntry('package_filter_chain_class', 'PackageFilterChain'); @@ -274,7 +277,7 @@ $cfg->setConfigEntry('node_answer_message_dht_bootstrap_helper_class', 'NodeDhtB $cfg->setConfigEntry('node_next_announcement_answer_okay_helper_class', 'NodeRequestNodeListHelper'); // CFG: NEWS-READER-MAIN-CLASS -$cfg->setConfigEntry('news_reader_main_class', 'CoreFramework\Reader\News\Console\ConsoleNewsReader'); +$cfg->setConfigEntry('news_reader_main_class', 'Org\Mxchange\CoreFramework\Reader\News\Console\ConsoleNewsReader'); // CFG: NODE-ANNOUNCEMENT-TEMPLATE-CLASS $cfg->setConfigEntry('node_announcement_template_class', 'XmlAnnouncementTemplateEngine'); @@ -286,7 +289,7 @@ $cfg->setConfigEntry('node_announcement_answer_template_class', 'XmlAnnouncement $cfg->setConfigEntry('node_request_node_list_template_class', 'XmlRequestNodeListTemplateEngine'); // CFG: NODE-DHT-BOOTSTRAP-TEMPLATE-CLASS -$cfg->setConfigEntry('node_dht_bootstrap_template_class', 'Hub\Template\Engine\Xml\Dht\Bootstrap\XmlDhtBootstrapTemplateEngine'); +$cfg->setConfigEntry('node_dht_bootstrap_template_class', 'Org\Shipsimu\Hub\Template\Engine\Xml\Dht\Bootstrap\XmlDhtBootstrapTemplateEngine'); // CFG: NODE-DHT-BOOTSTRAP-ANSWER-TEMPLATE-CLASS $cfg->setConfigEntry('node_dht_bootstrap_answer_template_class', 'XmlDhtBootstrapAnswerTemplateEngine'); @@ -298,7 +301,7 @@ $cfg->setConfigEntry('node_request_node_list_answer_template_class', 'XmlRequest $cfg->setConfigEntry('node_request_node_list_entries_template_class', 'XmlRequestNodeListEntryTemplateEngine'); // CFG: DHT-BOOTSTRAP-TEMPLATE-CLASS -$cfg->setConfigEntry('dht_bootstrap_template_class', 'Hub\Template\Engine\Xml\Dht\Bootstrap\XmlDhtBootstrapTemplateEngine'); +$cfg->setConfigEntry('dht_bootstrap_template_class', 'Org\Shipsimu\Hub\Template\Engine\Xml\Dht\Bootstrap\XmlDhtBootstrapTemplateEngine'); // CFG: DHT-PUBLISH-ENTRY-TEMPLATE-CLASS $cfg->setConfigEntry('dht_publish_entry_template_class', 'XmlDhtPublishEntryTemplateEngine'); @@ -316,31 +319,31 @@ $cfg->setConfigEntry('node_announcement_answer_template_extension', '.xml'); $cfg->setConfigEntry('node_announcement_template_type', 'xml/announcement'); // CFG: NODE-ANNOUNCEMENT-STACKER-CLASS -$cfg->setConfigEntry('node_announcement_stacker_class', 'CoreFramework\Stacker\FiLoStacker'); +$cfg->setConfigEntry('node_announcement_stacker_class', 'Org\Mxchange\CoreFramework\Stacker\FiLoStacker'); // CFG: NODE-ANNOUNCEMENT-ANSWER-STACKER-CLASS -$cfg->setConfigEntry('node_announcement_answer_stacker_class', 'CoreFramework\Stacker\FiLoStacker'); +$cfg->setConfigEntry('node_announcement_answer_stacker_class', 'Org\Mxchange\CoreFramework\Stacker\FiLoStacker'); // CFG: NODE-DHT-BOOTSTRAP-STACKER-CLASS -$cfg->setConfigEntry('node_dht_bootstrap_stacker_class', 'CoreFramework\Stacker\FiLoStacker'); +$cfg->setConfigEntry('node_dht_bootstrap_stacker_class', 'Org\Mxchange\CoreFramework\Stacker\FiLoStacker'); // CFG: NODE-DHT-BOOTSTRAP-ANSWER-STACKER-CLASS -$cfg->setConfigEntry('node_dht_bootstrap_answer_stacker_class', 'CoreFramework\Stacker\FiLoStacker'); +$cfg->setConfigEntry('node_dht_bootstrap_answer_stacker_class', 'Org\Mxchange\CoreFramework\Stacker\FiLoStacker'); // CFG: NODE-REQUEST-NODE-LIST-ANSWER-STACKER-CLASS -$cfg->setConfigEntry('node_request_node_list_answer_stacker_class', 'CoreFramework\Stacker\FiLoStacker'); +$cfg->setConfigEntry('node_request_node_list_answer_stacker_class', 'Org\Mxchange\CoreFramework\Stacker\FiLoStacker'); // CFG: NODE-REQUEST-NODE-LIST-ENTRY-STACKER-CLASS -$cfg->setConfigEntry('node_request_node_list_entry_stacker_class', 'CoreFramework\Stacker\FiLoStacker'); +$cfg->setConfigEntry('node_request_node_list_entry_stacker_class', 'Org\Mxchange\CoreFramework\Stacker\FiLoStacker'); // CFG: DHT-STACKER-CLASS -$cfg->setConfigEntry('dht_stacker_class', 'CoreFramework\Stacker\FiLoStacker'); +$cfg->setConfigEntry('dht_stacker_class', 'Org\Mxchange\CoreFramework\Stacker\FiLoStacker'); // CFG: RAW-DATA-STACKER-CLASS -$cfg->setConfigEntry('raw_data_stacker_class', 'CoreFramework\Stacker\FiLoStacker'); +$cfg->setConfigEntry('raw_data_stacker_class', 'Org\Mxchange\CoreFramework\Stacker\FiLoStacker'); // CFG: MULTIPLE-MESSAGE-STACKER-CLASS -$cfg->setConfigEntry('multiple_message_stacker_class', 'CoreFramework\Stacker\FiFoStacker'); +$cfg->setConfigEntry('multiple_message_stacker_class', 'Org\Mxchange\CoreFramework\Stacker\FiFoStacker'); // CFG: NODE-ANNOUNCEMENT-ANSWER-TEMPLATE-TYPE $cfg->setConfigEntry('node_announcement_answer_template_type', 'xml/answer/announcement'); @@ -352,7 +355,7 @@ $cfg->setConfigEntry('node_dht_bootstrap_answer_template_type', 'xml/answer/dht_ $cfg->setConfigEntry('node_request_node_list_answer_template_type', 'xml/answer/requests'); // CFG: NODE-SELF-CONNECT-TEMPLATE-CLASS -$cfg->setConfigEntry('node_self_connect_template_class', 'Hub\Template\Engine\Xml\SelfConnect\XmlSelfConnectTemplateEngine'); +$cfg->setConfigEntry('node_self_connect_template_class', 'Org\Shipsimu\Hub\Template\Engine\Xml\SelfConnect\XmlSelfConnectTemplateEngine'); // CFG: NODE-SELF-CONNECT-TEMPLATE-TYPE $cfg->setConfigEntry('node_self_connect_template_type', 'xml/self_connect'); @@ -361,13 +364,13 @@ $cfg->setConfigEntry('node_self_connect_template_type', 'xml/self_connect'); $cfg->setConfigEntry('node_request_node_list_template_type', 'xml/requests'); // CFG: NODE-SELF-CONNECT-STACKER-CLASS -$cfg->setConfigEntry('node_self_connect_stacker_class', 'CoreFramework\Stacker\FiLoStacker'); +$cfg->setConfigEntry('node_self_connect_stacker_class', 'Org\Mxchange\CoreFramework\Stacker\FiLoStacker'); // CFG: NODE-REQUEST-NODE_LIST-STACKER-CLASS -$cfg->setConfigEntry('node_request_node_list_stacker_class', 'CoreFramework\Stacker\FiLoStacker'); +$cfg->setConfigEntry('node_request_node_list_stacker_class', 'Org\Mxchange\CoreFramework\Stacker\FiLoStacker'); // CFG: NODE-OBJECT-REGISTRY-TEMPLATE-CLASS -$cfg->setConfigEntry('node_object_registry_template_class', 'Hub\Template\Engine\Xml\ObjectRegistry\XmlObjectRegistryTemplateEngine'); +$cfg->setConfigEntry('node_object_registry_template_class', 'Org\Shipsimu\Hub\Template\Engine\Xml\ObjectRegistry\XmlObjectRegistryTemplateEngine'); // CFG: NODE-OBJECT-REGISTRY-TEMPLATE-EXTENSION $cfg->setConfigEntry('node_object_registry_template_extension', '.xml'); @@ -376,10 +379,10 @@ $cfg->setConfigEntry('node_object_registry_template_extension', '.xml'); $cfg->setConfigEntry('node_object_registry_template_type', 'xml/object_registry'); // CFG: NODE-OBJECT-REGISTRY-STACKER-CLASS -$cfg->setConfigEntry('node_object_registry_stacker_class', 'CoreFramework\Stacker\FiLoStacker'); +$cfg->setConfigEntry('node_object_registry_stacker_class', 'Org\Mxchange\CoreFramework\Stacker\FiLoStacker'); // CFG: NODE-OBJECT-TYPE-REGISTRY-CLASS -$cfg->setConfigEntry('node_object_type_registry_class', 'Hub\Registry\Object\ObjectTypeRegistry'); +$cfg->setConfigEntry('node_object_type_registry_class', 'Org\Shipsimu\Hub\Registry\Object\ObjectTypeRegistry'); // CFG: DHT-BOOTSTRAP-TEMPLATE-TYPE $cfg->setConfigEntry('node_dht_bootstrap_template_type', 'xml/dht_bootstrap'); @@ -391,25 +394,25 @@ $cfg->setConfigEntry('node_dht_publish_template_type', 'xml/dht_publish'); $cfg->setConfigEntry('raw_template_extension', '.xml'); // CFG: PACKAGE-STACKER-CLASS -$cfg->setConfigEntry('network_package_stacker_class', 'CoreFramework\Stacker\FiFoStacker'); +$cfg->setConfigEntry('network_package_stacker_class', 'Org\Mxchange\CoreFramework\Stacker\FiFoStacker'); // CFG: NODE-RAW-DATA-STACKER-CLASS -$cfg->setConfigEntry('node_raw_data_stacker_class', 'CoreFramework\Stacker\FiFoStacker'); +$cfg->setConfigEntry('node_raw_data_stacker_class', 'Org\Mxchange\CoreFramework\Stacker\FiFoStacker'); // CFG: CHUNK-HANDLER-STACKER-CLASS -$cfg->setConfigEntry('chunk_handler_stacker_class', 'CoreFramework\Stacker\FiFoStacker'); +$cfg->setConfigEntry('chunk_handler_stacker_class', 'Org\Mxchange\CoreFramework\Stacker\FiFoStacker'); // CFG: DHT-BOOTSTRAP-STACKER-CLASS -$cfg->setConfigEntry('dht_bootstrap_stacker_class', 'CoreFramework\Stacker\FiFoStacker'); +$cfg->setConfigEntry('dht_bootstrap_stacker_class', 'Org\Mxchange\CoreFramework\Stacker\FiFoStacker'); // CFG: DHT-PUBLISH-STACKER-CLASS -$cfg->setConfigEntry('dht_publish_stacker_class', 'CoreFramework\Stacker\FiFoStacker'); +$cfg->setConfigEntry('dht_publish_stacker_class', 'Org\Mxchange\CoreFramework\Stacker\FiFoStacker'); // CFG: PRODUCER-OUTGOING-QUEUE -$cfg->setConfigEntry('producer_outgoing_queue', 'CoreFramework\Stacker\FiFoStacker'); +$cfg->setConfigEntry('producer_outgoing_queue', 'Org\Mxchange\CoreFramework\Stacker\FiFoStacker'); // CFG: PRODUCER-INCOMING-QUEUE -$cfg->setConfigEntry('producer_incoming_queue', 'CoreFramework\Stacker\FiFoStacker'); +$cfg->setConfigEntry('producer_incoming_queue', 'Org\Mxchange\CoreFramework\Stacker\FiFoStacker'); // CFG: STACKER-NODE-ANNOUNCEMENT-MAX-SIZE $cfg->setConfigEntry('stacker_node_announcement_max_size', 20); @@ -547,52 +550,52 @@ $cfg->setConfigEntry('task_ping_interval_delay', 1000*60*60); $cfg->setConfigEntry('task_ping_max_runs', 0); // CFG: NODE-PACKAGE-TAGS-INIT-TASK-CLASS -$cfg->setConfigEntry('node_package_tags_init_task_class', 'Hub\Node\Task\Initialization\Tag\NodePackageTagsInitTask'); +$cfg->setConfigEntry('node_package_tags_init_task_class', 'Org\Shipsimu\Hub\Node\Task\Initialization\Tag\NodePackageTagsInitTask'); // CFG: NODE-SELFCONNECT-TASK-CLASS -$cfg->setConfigEntry('node_selfconnect_task_class', 'Hub\Node\Task\SelfConnect\NodeSelfConnectTask'); +$cfg->setConfigEntry('node_selfconnect_task_class', 'Org\Shipsimu\Hub\Node\Task\SelfConnect\NodeSelfConnectTask'); // CFG: NODE-UPDATE-CHECK-TASK-CLASS -$cfg->setConfigEntry('node_update_check_task_class', 'Hub\Node\Check\Update\NodeUpdateCheckTask'); +$cfg->setConfigEntry('node_update_check_task_class', 'Org\Shipsimu\Hub\Node\Check\Update\NodeUpdateCheckTask'); // CFG: NODE-PING-TASK-CLASS -$cfg->setConfigEntry('node_ping_task_class', 'Hub\Node\Ping\NodePingTask'); +$cfg->setConfigEntry('node_ping_task_class', 'Org\Shipsimu\Hub\Node\Ping\NodePingTask'); // CFG: NODE-ANNOUNCEMENT-TASK-CLASS $cfg->setConfigEntry('node_announcement_task_class', 'NodeAnnouncementTask'); // CFG: NODE-PACKAGE-WRITER-TASK-CLASS -$cfg->setConfigEntry('node_package_writer_task_class', 'Hub\Task\Network\Writer\NetworkPackageWriterTask'); +$cfg->setConfigEntry('node_package_writer_task_class', 'Org\Shipsimu\Hub\Task\Network\Writer\NetworkPackageWriterTask'); // CFG: NODE-PACKAGE-READER-TASK-CLASS -$cfg->setConfigEntry('node_package_reader_task_class', 'Hub\Task\Network\Reader\NetworkPackageReaderTask'); +$cfg->setConfigEntry('node_package_reader_task_class', 'Org\Shipsimu\Hub\Task\Network\Reader\NetworkPackageReaderTask'); // CFG: NODE-SOCKET-LISTENER-TASK-CLASS -$cfg->setConfigEntry('node_socket_listener_task_class', 'Hub\Node\Task\Listener\Socket\NodeSocketListenerTask'); +$cfg->setConfigEntry('node_socket_listener_task_class', 'Org\Shipsimu\Hub\Node\Task\Listener\Socket\NodeSocketListenerTask'); // CFG: NODE-CHUNK-ASSEMBLER-TASK-CLASS -$cfg->setConfigEntry('node_chunk_assembler_task_class', 'Hub\Node\Task\Assembler\NodeChunkAssemblerTask'); +$cfg->setConfigEntry('node_chunk_assembler_task_class', 'Org\Shipsimu\Hub\Node\Task\Assembler\NodeChunkAssemblerTask'); // CFG: NODE-PACKAGE-DECODER-TASK-CLASS -$cfg->setConfigEntry('node_package_decoder_task_class', 'Hub\Node\Task\Decoder\NodePackageDecoderTask'); +$cfg->setConfigEntry('node_package_decoder_task_class', 'Org\Shipsimu\Hub\Node\Task\Decoder\NodePackageDecoderTask'); // CFG: NODE-DHT-INIT-TASK-CLASS -$cfg->setConfigEntry('node_dht_init_task_class', 'Hub\Node\Task\Dht\Initialization\NodeDhtInitializationTask'); +$cfg->setConfigEntry('node_dht_init_task_class', 'Org\Shipsimu\Hub\Node\Task\Dht\Initialization\NodeDhtInitializationTask'); // CFG: NODE-DHT-BOOTSTRAP-TASK-CLASS -$cfg->setConfigEntry('node_dht_bootstrap_task_class', 'Hub\Node\Task\Dht\Bootstrap\NodeDhtBootstrapTask'); +$cfg->setConfigEntry('node_dht_bootstrap_task_class', 'Org\Shipsimu\Hub\Node\Task\Dht\Bootstrap\NodeDhtBootstrapTask'); // CFG: NODE-DHT-LATE-BOOTSTRAP-TASK-CLASS $cfg->setConfigEntry('node_dht_late_bootstrap_task_class', 'NodeDhtLateBootstrapTask'); // CFG: NODE-DHT-QUERY-TASK-CLASS -$cfg->setConfigEntry('node_dht_query_task_class', 'Hub\Node\Task\Dht\Query\NodeDhtQueryTask'); +$cfg->setConfigEntry('node_dht_query_task_class', 'Org\Shipsimu\Hub\Node\Task\Dht\Query\NodeDhtQueryTask'); // CFG: NODE-DHT-PUBLICATION-CHECK-TASK-CLASS -$cfg->setConfigEntry('node_dht_publication_check_task_class', 'Hub\Node\Task\Dht\Check\Publication\NodeDhtPublicationCheckTask'); +$cfg->setConfigEntry('node_dht_publication_check_task_class', 'Org\Shipsimu\Hub\Node\Task\Dht\Check\Publication\NodeDhtPublicationCheckTask'); // CFG: NODE-DHT-PUBLICATION-TASK-CLASS -$cfg->setConfigEntry('node_dht_publication_task_class', 'Hub\Node\Task\Dht\Publication\NodeDhtPublicationTask'); +$cfg->setConfigEntry('node_dht_publication_task_class', 'Org\Shipsimu\Hub\Node\Task\Dht\Publication\NodeDhtPublicationTask'); // CFG: TASK-NETWORK-PACKAGE-WRITER-STARTUP-DELAY $cfg->setConfigEntry('task_network_package_writer_startup_delay', 2500); @@ -694,73 +697,73 @@ $cfg->setConfigEntry('task_dht_publication_interval_delay', 5000); $cfg->setConfigEntry('task_dht_publication_max_runs', 0); // CFG: TASK-POOL-ITERATOR-CLASS -$cfg->setConfigEntry('task_pool_iterator_class', 'Hub\Iterator\Pool\Task\TaskPoolIterator'); +$cfg->setConfigEntry('task_pool_iterator_class', 'Org\Shipsimu\Hub\Iterator\Pool\Task\TaskPoolIterator'); // CFG: MONITOR-POOL-ITERATOR-CLASS -$cfg->setConfigEntry('monitor_pool_iterator_class', 'Hub\Iterator\Pool\Monitor\MonitorPoolIterator'); +$cfg->setConfigEntry('monitor_pool_iterator_class', 'Org\Shipsimu\Hub\Iterator\Pool\Monitor\MonitorPoolIterator'); // CFG: QUERY-ITERATOR-CLASS -$cfg->setConfigEntry('query_iterator_class', 'CoreFramework\Iterator\DefaultIterator'); +$cfg->setConfigEntry('query_iterator_class', 'Org\Mxchange\CoreFramework\Iterator\DefaultIterator'); // CFG: NODE-PING-ITERATOR-CLASS -$cfg->setConfigEntry('node_ping_iterator_class', 'Hub\Iterator\Node\Ping\NodePingIterator'); +$cfg->setConfigEntry('node_ping_iterator_class', 'Org\Shipsimu\Hub\Iterator\Node\Ping\NodePingIterator'); // CFG: WEB-TEMPLATE-CLASS @OVERRIDE $cfg->setConfigEntry('web_template_class', 'ConsoleTemplateEngine'); // CFG: NETWORK-PACKAGE-CLASS -$cfg->setConfigEntry('network_package_class', 'Hub\Network\Package\NetworkPackage'); +$cfg->setConfigEntry('network_package_class', 'Org\Shipsimu\Hub\Network\Package\NetworkPackage'); // CFG: PACKAGE-COMPRESSOR-CLASS -$cfg->setConfigEntry('deco_package_compressor_class', 'Hub\Network\Compressor\Package\NetworkPackageCompressorDecorator'); +$cfg->setConfigEntry('deco_package_compressor_class', 'Org\Shipsimu\Hub\Network\Compressor\Package\NetworkPackageCompressorDecorator'); // CFG: RAW-PACKAGE-COMPRESSOR-CLASS -$cfg->setConfigEntry('raw_package_compressor_class', 'CoreFramework\Compressor\Zlib\ZlibCompressor'); +$cfg->setConfigEntry('raw_package_compressor_class', 'Org\Mxchange\CoreFramework\Compressor\Zlib\ZlibCompressor'); // CFG: SOCKET-REGISTRY-CLASS -$cfg->setConfigEntry('socket_registry_class', 'Hub\Registry\Socket\SocketRegistry'); +$cfg->setConfigEntry('socket_registry_class', 'Org\Shipsimu\Hub\Registry\Socket\SocketRegistry'); // CFG: SOCKET-CONTAINER-CLASS -$cfg->setConfigEntry('socket_container_class', 'Hub\Container\Socket\SocketContainer'); +$cfg->setConfigEntry('socket_container_class', 'Org\Shipsimu\Hub\Container\Socket\SocketContainer'); // CFG: IPC-SOCKET-FILE-NAME $cfg->setConfigEntry('ipc_socket_file_name', 'php_hub_ipc_socket'); // CFG: PACKAGE-RECIPIENT-DISCOVERY-CLASS -$cfg->setConfigEntry('package_recipient_discovery_class', 'Hub\Discovery\Network\Recipient\PackageRecipientDiscovery'); +$cfg->setConfigEntry('package_recipient_discovery_class', 'Org\Shipsimu\Hub\Discovery\Network\Recipient\PackageRecipientDiscovery'); // CFG: SOCKET-DISCOVERY-CLASS -$cfg->setConfigEntry('socket_discovery_class', 'Hub\Network\Discovery\Socket\PackageSocketDiscovery'); +$cfg->setConfigEntry('socket_discovery_class', 'Org\Shipsimu\Hub\Network\Discovery\Socket\PackageSocketDiscovery'); // CFG: DHT-RECIPIENT-DISCOVERY-CLASS -$cfg->setConfigEntry('dht_recipient_discovery_class', 'Hub\Discovery\Recipient\Dht\DhtRecipientDiscovery'); +$cfg->setConfigEntry('dht_recipient_discovery_class', 'Org\Shipsimu\Hub\Discovery\Recipient\Dht\DhtRecipientDiscovery'); // CFG: UNL-DISCOVERY-CLASS -$cfg->setConfigEntry('unl_discovery_class', 'Hub\Discovery\Locator\UniversalNodeLocatorDiscovery'); +$cfg->setConfigEntry('unl_discovery_class', 'Org\Shipsimu\Hub\Discovery\Locator\UniversalNodeLocatorDiscovery'); // CFG: TCP-PROTOCOL-HANDLER-CLASS -$cfg->setConfigEntry('tcp_protocol_handler_class', 'Hub\Handler\Protocol\Network\IpV4\Tcp\TcpProtocolHandler'); +$cfg->setConfigEntry('tcp_protocol_handler_class', 'Org\Shipsimu\Hub\Handler\Protocol\Network\IpV4\Tcp\TcpProtocolHandler'); // CFG: UNIVERSAL-NODE-LOCATOR-CLASS -$cfg->setConfigEntry('universal_node_locator_class', 'Hub\Locator\Node\UniversalNodeLocator'); +$cfg->setConfigEntry('universal_node_locator_class', 'Org\Shipsimu\Hub\Locator\Node\UniversalNodeLocator'); // CFG: RECIPIENT-LIST-CLASS -$cfg->setConfigEntry('recipient_list_class', 'Hub\Lists\Recipient\RecipientList'); +$cfg->setConfigEntry('recipient_list_class', 'Org\Shipsimu\Hub\Lists\Recipient\RecipientList'); // CFG: PACKAGE-TAGS-CLASS -$cfg->setConfigEntry('package_tags_class', 'Hub\Tag\Package\PackageTags'); +$cfg->setConfigEntry('package_tags_class', 'Org\Shipsimu\Hub\Tag\Package\PackageTags'); // CFG: TCP-CONNECTION-HELPER-CLASS -$cfg->setConfigEntry('tcp_connection_helper_class', 'Hub\Helper\Connection\Network\IpV4\Tcp\TcpConnectionHelper'); +$cfg->setConfigEntry('tcp_connection_helper_class', 'Org\Shipsimu\Hub\Helper\Connection\Network\IpV4\Tcp\TcpConnectionHelper'); // CFG: UDP-CONNECTION-HELPER-CLASS -$cfg->setConfigEntry('udp_connection_helper_class', 'Hub\Helper\Connection\Network\IpV4\Udp\UdpConnectionHelper'); +$cfg->setConfigEntry('udp_connection_helper_class', 'Org\Shipsimu\Hub\Helper\Connection\Network\IpV4\Udp\UdpConnectionHelper'); // CFG: HUB-COMMUNICATION-PROTOCOL-TYPE $cfg->setConfigEntry('hub_communication_protocol_type', 'tcp'); // CFG: TCP-PROTOCOL-RESOLVER-CLASS -$cfg->setConfigEntry('tcp_protocol_resolver_class', 'Hub\Resolver\Protocol\Tcp\TcpProtocolResolver'); +$cfg->setConfigEntry('tcp_protocol_resolver_class', 'Org\Shipsimu\Hub\Resolver\Protocol\Tcp\TcpProtocolResolver'); // CFG: TCP-BUFFER-LENGTH $cfg->setConfigEntry('tcp_buffer_length', 1024); @@ -809,19 +812,19 @@ $cfg->setConfigEntry('allow_publish_internal_address', 'N'); $cfg->setConfigEntry('node_status', 'invalid'); // CFG: PACKAGE-FRAGMENTER-CLASS -$cfg->setConfigEntry('package_fragmenter_class', 'Hub\Network\Package\Fragment\PackageFragmenter'); +$cfg->setConfigEntry('package_fragmenter_class', 'Org\Shipsimu\Hub\Network\Package\Fragment\PackageFragmenter'); // CFG: PACKAGE-ASSEMBLER-CLASS -$cfg->setConfigEntry('package_assembler_class', 'Hub\Network\Package\Assembler\PackageAssembler'); +$cfg->setConfigEntry('package_assembler_class', 'Org\Shipsimu\Hub\Network\Package\Assembler\PackageAssembler'); // CFG: PACKAGE-CHUNK-SIZE $cfg->setConfigEntry('package_chunk_size', 256*8); // CFG: NODE-RAW-DATA-OUTPUT-STREAM-CLASS -$cfg->setConfigEntry('node_raw_data_output_stream_class', 'Hub\Stream\Network\Output\RawData\RawDataOutputStream'); +$cfg->setConfigEntry('node_raw_data_output_stream_class', 'Org\Shipsimu\Hub\Stream\Network\Output\RawData\RawDataOutputStream'); // CFG: NODE-RAW-DATA-INPUT-STREAM-CLASS -$cfg->setConfigEntry('node_raw_data_input_stream_class', 'Hub\Stream\Network\Input\RawData\RawDataInputStream'); +$cfg->setConfigEntry('node_raw_data_input_stream_class', 'Org\Shipsimu\Hub\Stream\Network\Input\RawData\RawDataInputStream'); // CFG: SOCKET-TIMEOUT-SECONDS $cfg->setConfigEntry('socket_timeout_seconds', 3); @@ -833,23 +836,23 @@ $cfg->setConfigEntry('socket_timeout_microseconds', 0); $cfg->setConfigEntry('socket_select_timeout_usec', 50); // CFG: CHUNK-HANDLER-CLASS -$cfg->setConfigEntry('chunk_handler_class', 'Hub\Handler\Network\RawData\Chunks\ChunkHandler'); +$cfg->setConfigEntry('chunk_handler_class', 'Org\Shipsimu\Hub\Handler\Network\RawData\Chunks\ChunkHandler'); // CFG: PACKAGE-DECODER-CLASS -$cfg->setConfigEntry('package_decoder_class', 'Hub\Network\Decoder\Package\PackageDecoder'); +$cfg->setConfigEntry('package_decoder_class', 'Org\Shipsimu\Hub\Network\Decoder\Package\PackageDecoder'); // CFG: PACKAGE-RECIPIENT-MAX-COUNT // @TODO This is very static, rewrite it to more flexible $cfg->setConfigEntry('package_recipient_max_count', 3); // CFG: NODE-DHT-CLASS -$cfg->setConfigEntry('node_dht_class', 'Hub\Dht\Node\NodeDhtFacade'); +$cfg->setConfigEntry('node_dht_class', 'Org\Shipsimu\Hub\Dht\Node\NodeDhtFacade'); // CFG: MAX-DHT-RECIPIENTS $cfg->setConfigEntry('max_dht_recipients', 10); // CFG: CONNECTION-INFO-CLASS -$cfg->setConfigEntry('connection_info_class', 'Hub\Information\Connection\ConnectionInfo'); +$cfg->setConfigEntry('connection_info_class', 'Org\Shipsimu\Hub\Information\Connection\ConnectionInfo'); // CFG: DEFAULT-HUB-CONSOLE-CONTROLLER $cfg->setConfigEntry('default_hub_console_controller', 'main'); @@ -859,73 +862,73 @@ $cfg->setConfigEntry('default_hub_console_controller', 'main'); /////////////////////////////////////////////////////////////////////////////// // CFG: NODE-INIT-STATE-CLASS -$cfg->setConfigEntry('node_init_state_class', 'Hub\State\Node\NodeInitState'); +$cfg->setConfigEntry('node_init_state_class', 'Org\Shipsimu\Hub\State\Node\NodeInitState'); // CFG: NODE-VIRGIN-STATE-CLASS -$cfg->setConfigEntry('node_virgin_state_class', 'Hub\State\Node\NodeVirginState'); +$cfg->setConfigEntry('node_virgin_state_class', 'Org\Shipsimu\Hub\State\Node\NodeVirginState'); // CFG: NODE-ACTIVE-STATE-CLASS -$cfg->setConfigEntry('node_active_state_class', 'Hub\State\Node\NodeActiveState'); +$cfg->setConfigEntry('node_active_state_class', 'Org\Shipsimu\Hub\State\Node\NodeActiveState'); // CFG: NODE-ANNOUNCING-STATE-CLASS -$cfg->setConfigEntry('node_announcing_state_class', 'Hub\State\Node\NodeAnnouncingState'); +$cfg->setConfigEntry('node_announcing_state_class', 'Org\Shipsimu\Hub\State\Node\NodeAnnouncingState'); // CFG: NODE-REACHABLE-STATE-CLASS -$cfg->setConfigEntry('node_reachable_state_class', 'Hub\State\Node\NodeReachableState'); +$cfg->setConfigEntry('node_reachable_state_class', 'Org\Shipsimu\Hub\State\Node\NodeReachableState'); // CFG: NODE-ANNOUNCEMENT-COMPLETED-STATE-CLASS -$cfg->setConfigEntry('node_announcement_completed_state_class', 'Hub\State\Node\NodeAnnouncementCompletedState'); +$cfg->setConfigEntry('node_announcement_completed_state_class', 'Org\Shipsimu\Hub\State\Node\NodeAnnouncementCompletedState'); /////////////////////////////////////////////////////////////////////////////// // Peer states /////////////////////////////////////////////////////////////////////////////// // CFG: PEER-INIT-STATE-CLASS -$cfg->setConfigEntry('peer_init_state_class', 'Hub\State\Peer\InitPeerState'); +$cfg->setConfigEntry('peer_init_state_class', 'Org\Shipsimu\Hub\State\Peer\InitPeerState'); // CFG: PEER-CONNECTED-STATE-CLASS -$cfg->setConfigEntry('peer_connected_state_class', 'Hub\State\Peer\ConnectedPeerState'); +$cfg->setConfigEntry('peer_connected_state_class', 'Org\Shipsimu\Hub\State\Peer\ConnectedPeerState'); // CFG: PEER-PROBLEM-STATE-CLASS -$cfg->setConfigEntry('peer_problem_state_class', 'Hub\State\Peer\ProblemPeerState'); +$cfg->setConfigEntry('peer_problem_state_class', 'Org\Shipsimu\Hub\State\Peer\ProblemPeerState'); // CFG: PEER-CONNECTION-REFUSED-STATE-CLASS -$cfg->setConfigEntry('peer_connection_refused_state_class', 'Hub\State\Peer\ConnectionRefusedPeerState'); +$cfg->setConfigEntry('peer_connection_refused_state_class', 'Org\Shipsimu\Hub\State\Peer\ConnectionRefusedPeerState'); // CFG: PEER-CONNECTION-TIMED-OUT-STATE-CLASS -$cfg->setConfigEntry('peer_connection_timed_out_state_class', 'Hub\State\Peer\ConnectionTimedOutPeerState'); +$cfg->setConfigEntry('peer_connection_timed_out_state_class', 'Org\Shipsimu\Hub\State\Peer\ConnectionTimedOutPeerState'); // CFG: PEER-TRANSPORT-ENDPOINT-STATE-CLASS -$cfg->setConfigEntry('peer_transport_endpoint_state_class', 'Hub\State\Peer\TransportEndpointGonePeerState'); +$cfg->setConfigEntry('peer_transport_endpoint_state_class', 'Org\Shipsimu\Hub\State\Peer\TransportEndpointGonePeerState'); // CFG: PEER-OPERATION-ALREADY-PROGRESS-STATE-CLASS -$cfg->setConfigEntry('peer_operation_already_progress_state_class', 'Hub\State\Peer\OperationAlreadyProgressPeerState'); +$cfg->setConfigEntry('peer_operation_already_progress_state_class', 'Org\Shipsimu\Hub\State\Peer\OperationAlreadyProgressPeerState'); // CFG: PEER-NO-ROUTE-TO-HOST-STATE-CLASS -$cfg->setConfigEntry('peer_no_route_to_host_state_class', 'Hub\State\Peer\NoRouteToHostPeerState'); +$cfg->setConfigEntry('peer_no_route_to_host_state_class', 'Org\Shipsimu\Hub\State\Peer\NoRouteToHostPeerState'); /////////////////////////////////////////////////////////////////////////////// // DHT states /////////////////////////////////////////////////////////////////////////////// // CFG: DHT-INIT-STATE-CLASS -$cfg->setConfigEntry('dht_init_state_class', 'Hub\State\Dht\DhtInitState'); +$cfg->setConfigEntry('dht_init_state_class', 'Org\Shipsimu\Hub\State\Dht\DhtInitState'); // CFG: DHT-VIRGIN-STATE-CLASS -$cfg->setConfigEntry('dht_virgin_state_class', 'Hub\State\Dht\DhtVirginState'); +$cfg->setConfigEntry('dht_virgin_state_class', 'Org\Shipsimu\Hub\State\Dht\DhtVirginState'); // CFG: DHT-BOOTING-STATE-CLASS -$cfg->setConfigEntry('dht_booting_state_class', 'Hub\State\Dht\DhtBootingState'); +$cfg->setConfigEntry('dht_booting_state_class', 'Org\Shipsimu\Hub\State\Dht\DhtBootingState'); // CFG: DHT-ACTIVE-STATE-CLASS -$cfg->setConfigEntry('dht_active_state_class', 'Hub\State\Dht\DhtActiveState'); +$cfg->setConfigEntry('dht_active_state_class', 'Org\Shipsimu\Hub\State\Dht\DhtActiveState'); /////////////////////////////////////////////////////////////////////////////// // Message answer-status handler /////////////////////////////////////////////////////////////////////////////// // CFG: ANNOUNCEMENT-ANSWER-STATUS-OKAY-HANDLER-CLASS -$cfg->setConfigEntry('announcement_answer_status_okay_handler_class', 'Hub\Handler\Node\Announcement\Answer\NodeAnnouncementAnswerOkayHandler'); +$cfg->setConfigEntry('announcement_answer_status_okay_handler_class', 'Org\Shipsimu\Hub\Handler\Node\Announcement\Answer\NodeAnnouncementAnswerOkayHandler'); // CFG: REQUEST-NODE-LIST-ANSWER-STATUS-OKAY-HANDLER-CLASS $cfg->setConfigEntry('request_node_list_answer_status_okay_handler_class', 'RequestNodeListAnswerOkayHandler'); @@ -935,16 +938,16 @@ $cfg->setConfigEntry('request_node_list_answer_status_okay_handler_class', 'Requ /////////////////////////////////////////////////////////////////////////////// // CFG: DIRECT-RECIPIENT-CLASS -$cfg->setConfigEntry('direct_recipient_class', 'Hub\Network\Recipient\Direct\DirectRecipient'); +$cfg->setConfigEntry('direct_recipient_class', 'Org\Shipsimu\Hub\Network\Recipient\Direct\DirectRecipient'); // CFG: DHT-RECIPIENT-CLASS -$cfg->setConfigEntry('dht_recipient_class', 'Hub\Network\Recipient\Dht\DhtRecipient'); +$cfg->setConfigEntry('dht_recipient_class', 'Org\Shipsimu\Hub\Network\Recipient\Dht\DhtRecipient'); // CFG: SELF-RECIPIENT-CLASS -$cfg->setConfigEntry('self_recipient_class', 'Hub\Network\Recipient\Loopback\SelfRecipient'); +$cfg->setConfigEntry('self_recipient_class', 'Org\Shipsimu\Hub\Network\Recipient\Loopback\SelfRecipient'); // CFG: UPPER-RECIPIENT-CLASS -$cfg->setConfigEntry('upper_recipient_class', 'Hub\Network\Recipient\Upper\UpperRecipient'); +$cfg->setConfigEntry('upper_recipient_class', 'Org\Shipsimu\Hub\Network\Recipient\Upper\UpperRecipient'); /////////////////////////////////////////////////////////////////////////////// // Miner configuration @@ -954,10 +957,10 @@ $cfg->setConfigEntry('upper_recipient_class', 'Hub\Network\Recipient\Upper\Upper $cfg->setConfigEntry('miner_default_mode', 'coin'); // CFG: MINER-BUFFER-STACKER-CLASS -$cfg->setConfigEntry('miner_buffer_stacker_class', 'CoreFramework\Stacker\FiFoStacker'); +$cfg->setConfigEntry('miner_buffer_stacker_class', 'Org\Mxchange\CoreFramework\Stacker\FiFoStacker'); // CFG: HUB-CONSOLE-CMD-CRUNCHER-RESOLVER-CLASS -$cfg->setConfigEntry('hub_console_cmd_miner_resolver_class', 'Hub\Resolver\Command\HubConsoleCommandResolver'); +$cfg->setConfigEntry('hub_console_cmd_miner_resolver_class', 'Org\Shipsimu\Hub\Resolver\Command\HubConsoleCommandResolver'); // CFG: MINER-PHP-REQUIREMENTS-FILTER $cfg->setConfigEntry('miner_php_requirements_filter_class', 'MinerPhpRequirementsFilter'); @@ -1060,10 +1063,10 @@ $cfg->setConfigEntry('miner_real_hash_block_class', 'HashBlock'); $cfg->setConfigEntry('cruncher_default_mode', 'mcrypt'); // CFG: CRUNCHER-BUFFER-STACKER-CLASS -$cfg->setConfigEntry('cruncher_buffer_stacker_class', 'CoreFramework\Stacker\FiFoStacker'); +$cfg->setConfigEntry('cruncher_buffer_stacker_class', 'Org\Mxchange\CoreFramework\Stacker\FiFoStacker'); // CFG: HUB-CONSOLE-CMD-CRUNCHER-RESOLVER-CLASS -$cfg->setConfigEntry('hub_console_cmd_cruncher_resolver_class', 'Hub\Resolver\Command\HubConsoleCommandResolver'); +$cfg->setConfigEntry('hub_console_cmd_cruncher_resolver_class', 'Org\Shipsimu\Hub\Resolver\Command\HubConsoleCommandResolver'); // CFG: CRUNCHER-PHP-REQUIREMENTS-FILTER $cfg->setConfigEntry('cruncher_php_requirements_filter_class', 'CruncherPhpRequirementsFilter'); @@ -1153,7 +1156,7 @@ $cfg->setConfigEntry('cruncher_message_template_extension', '.xml'); $cfg->setConfigEntry('cruncher_test_unit_template_extension', '.xml'); // CFG: CRUNCHER-TEST-UNIT-STACKER-CLASS -$cfg->setConfigEntry('cruncher_test_unit_stacker_class', 'CoreFramework\Stacker\FiLoStacker'); +$cfg->setConfigEntry('cruncher_test_unit_stacker_class', 'Org\Mxchange\CoreFramework\Stacker\FiLoStacker'); // CFG: CRUNCHER-TEST-UNIT-TEMPLATE-TYPE $cfg->setConfigEntry('cruncher_test_unit_template_type', 'xml/cruncher/producer'); @@ -1202,7 +1205,7 @@ $cfg->setConfigEntry('cruncher_per_unit_key_limit', 1000); /////////////////////////////////////////////////////////////////////////////// // CFG: HUB-CONSOLE-CMD-CHAT-RESOLVER-CLASS -$cfg->setConfigEntry('hub_console_cmd_chat_resolver_class', 'Hub\Resolver\Command\HubConsoleCommandResolver'); +$cfg->setConfigEntry('hub_console_cmd_chat_resolver_class', 'Org\Shipsimu\Hub\Resolver\Command\HubConsoleCommandResolver'); // CFG: CHAT-PHP-REQUIREMENTS-FILTER $cfg->setConfigEntry('chat_php_requirements_filter_class', 'ChatPhpRequirementsFilter'); @@ -1254,7 +1257,7 @@ $cfg->setConfigEntry('file_stacks_extension', 'stack'); $cfg->setConfigEntry('index_extension', '.idx'); // CFG: HUB-CONSOLE-CMD-CHAT-RESOLVER-CLASS -$cfg->setConfigEntry('hub_console_cmd_crawler_resolver_class', 'Hub\Resolver\Command\HubConsoleCommandResolver'); +$cfg->setConfigEntry('hub_console_cmd_crawler_resolver_class', 'Org\Shipsimu\Hub\Resolver\Command\HubConsoleCommandResolver'); // CFG: CRAWLER-PHP-REQUIREMENTS-FILTER $cfg->setConfigEntry('crawler_php_requirements_filter_class', 'CrawlerPhpRequirementsFilter'); @@ -1314,31 +1317,31 @@ $cfg->setConfigEntry('crawler_url_stacks', 'local_start:uploaded_list:rss_start: $cfg->setConfigEntry('crawler_node_communicator_task_class', 'CrawlerNodeCommunicatorTask'); // CFG: CRAWLER-URL-LOCAL-START-STACK-CLASS -$cfg->setConfigEntry('crawler_url_local_start_stack_class', 'CoreFramework\Stack\Filesystem\FiFoFileStack'); +$cfg->setConfigEntry('crawler_url_local_start_stack_class', 'Org\Mxchange\CoreFramework\Stack\Filesystem\FiFoFileStack'); // CFG: CRAWLER-URL-UPLOADED-LIST-STACK-CLASS -$cfg->setConfigEntry('crawler_url_uploaded_list_stack_class', 'CoreFramework\Stack\Filesystem\FiFoFileStack'); +$cfg->setConfigEntry('crawler_url_uploaded_list_stack_class', 'Org\Mxchange\CoreFramework\Stack\Filesystem\FiFoFileStack'); // CFG: CRAWLER-URL-RSS-START-STACK-CLASS -$cfg->setConfigEntry('crawler_url_rss_start_stack_class', 'CoreFramework\Stack\Filesystem\FiFoFileStack'); +$cfg->setConfigEntry('crawler_url_rss_start_stack_class', 'Org\Mxchange\CoreFramework\Stack\Filesystem\FiFoFileStack'); // CFG: CRAWLER-URL-FOUND-RSS-STACK-CLASS -$cfg->setConfigEntry('crawler_url_found_rss_stack_class', 'CoreFramework\Stack\Filesystem\FiFoFileStack'); +$cfg->setConfigEntry('crawler_url_found_rss_stack_class', 'Org\Mxchange\CoreFramework\Stack\Filesystem\FiFoFileStack'); // CFG: CRAWLER-URL-LOCAL-START-FILE-STACK-INDEX-CLASS -$cfg->setConfigEntry('crawler_url_local_start_file_stack_index_class', 'CoreFramework\Index\Stack\FileStackIndex'); +$cfg->setConfigEntry('crawler_url_local_start_file_stack_index_class', 'Org\Mxchange\CoreFramework\Index\Stack\FileStackIndex'); // CFG: CRAWLER-URL-UPLOADED-LIST-FILE-STACK-INDEX-CLASS -$cfg->setConfigEntry('crawler_url_uploaded_list_file_stack_index_class', 'CoreFramework\Index\Stack\FileStackIndex'); +$cfg->setConfigEntry('crawler_url_uploaded_list_file_stack_index_class', 'Org\Mxchange\CoreFramework\Index\Stack\FileStackIndex'); // CFG: CRAWLER-URL-RSS-START-FILE-STACK-INDEX-CLASS -$cfg->setConfigEntry('crawler_url_rss_start_file_stack_index_class', 'CoreFramework\Index\Stack\FileStackIndex'); +$cfg->setConfigEntry('crawler_url_rss_start_file_stack_index_class', 'Org\Mxchange\CoreFramework\Index\Stack\FileStackIndex'); // CFG: CRAWLER-URL-FOUND-RSS-FILE-STACK-INDEX-CLASS -$cfg->setConfigEntry('crawler_url_found_rss_file_stack_index_class', 'CoreFramework\Index\Stack\FileStackIndex'); +$cfg->setConfigEntry('crawler_url_found_rss_file_stack_index_class', 'Org\Mxchange\CoreFramework\Index\Stack\FileStackIndex'); // CFG: CRAWLER-URL-UPLOADED-LIST-URL-SOURCE-STACK-CLASS -$cfg->setConfigEntry('crawler_uploaded_list_url_source_stack_class', 'CoreFramework\Stacker\FiFoStacker'); +$cfg->setConfigEntry('crawler_uploaded_list_url_source_stack_class', 'Org\Mxchange\CoreFramework\Stacker\FiFoStacker'); // CFG: STACKER-CSV-FILE-MAX-SIZE $cfg->setConfigEntry('stacker_csv_file_max_size', 10); @@ -1522,7 +1525,7 @@ $cfg->setConfigEntry('crawler_url_list_column_separator', ','); /////////////////////////////////////////////////////////////////////////////// // CFG: HUB-CONSOLE-CMD-APT-PROXY-RESOLVER-CLASS -$cfg->setConfigEntry('hub_console_cmd_apt_proxy_resolver_class', 'Hub\Resolver\Command\HubConsoleCommandResolver'); +$cfg->setConfigEntry('hub_console_cmd_apt_proxy_resolver_class', 'Org\Shipsimu\Hub\Resolver\Command\HubConsoleCommandResolver'); // CFG: APT-PROXY-PHP-REQUIREMENTS-FILTER $cfg->setConfigEntry('apt_proxy_php_requirements_filter_class', 'AptProxyPhpRequirementsFilter'); @@ -1571,7 +1574,7 @@ $cfg->setConfigEntry('default_hub_html_command', 'index'); $cfg->setConfigEntry('default_html_controller', 'index'); // CFG: HTML-CMD-INDEX-RESOLVER-CLASS -$cfg->setConfigEntry('html_cmd_index_resolver_class', 'Hub\Resolver\Command\HubHtmlCommandResolver'); +$cfg->setConfigEntry('html_cmd_index_resolver_class', 'Org\Shipsimu\Hub\Resolver\Command\HubHtmlCommandResolver'); // CFG: NEWS-READER-INDEX-CLASS $cfg->setConfigEntry('news_reader_index_class', 'DefaultNewsReader'); @@ -1599,7 +1602,7 @@ $cfg->setConfigEntry('form_target', '_self'); /////////////////////////////////////////////////////////////////////////////// // CFG: HUB-CONSOLE-CMD-FUSE-RESOLVER-CLASS -$cfg->setConfigEntry('hub_console_cmd_fuse_resolver_class', 'CoreFramework\Resolver\Command\ConsoleCommandResolver'); +$cfg->setConfigEntry('hub_console_cmd_fuse_resolver_class', 'Org\Mxchange\CoreFramework\Resolver\Command\ConsoleCommandResolver'); // CFG: ENABLE-FEATURE-FUSE $cfg->setConfigEntry('enable_feature_fuse', 'N'); diff --git a/application/hub/exceptions.php b/application/hub/exceptions.php index 0dcb971b4..8488577c6 100644 --- a/application/hub/exceptions.php +++ b/application/hub/exceptions.php @@ -1,7 +1,7 @@ __toString(), $this->getLine(), $messageArray[1], - $messageArray[2][BaseRawDataHandler::PACKAGE_ERROR_CODE] + $messageArray[2][HandleableRawData::PACKAGE_ERROR_CODE] ); // Call parent exception constructor diff --git a/application/hub/exceptions/peer/class_PeerAlreadyRegisteredException.php b/application/hub/exceptions/peer/class_PeerAlreadyRegisteredException.php index 98f25cd43..d5fc13d30 100644 --- a/application/hub/exceptions/peer/class_PeerAlreadyRegisteredException.php +++ b/application/hub/exceptions/peer/class_PeerAlreadyRegisteredException.php @@ -1,12 +1,12 @@ diff --git a/application/hub/interfaces/consumer/class_Consumer.php b/application/hub/interfaces/consumer/class_Consumer.php index 0e62003ca..f5bfbeb93 100644 --- a/application/hub/interfaces/consumer/class_Consumer.php +++ b/application/hub/interfaces/consumer/class_Consumer.php @@ -1,9 +1,9 @@ - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Hub Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -interface Executor extends HubInterface { - /** - * Initializes the executor, whatever it does. - * - * @return void - */ - function initExecutor (Stateable $stateInstance); -} - -// [EOF] -?> diff --git a/application/hub/interfaces/filter/class_FilterablePackage.php b/application/hub/interfaces/filter/class_FilterablePackage.php index 7f5164490..b39e67f44 100644 --- a/application/hub/interfaces/filter/class_FilterablePackage.php +++ b/application/hub/interfaces/filter/class_FilterablePackage.php @@ -1,12 +1,12 @@ . */ -interface Networkable extends HandleableDataSet, HubInterface { +interface Networkable extends HandleableDataSet, HandleableRawData { /** * Processes raw data from given socket instance. This is mostly useful for * package handling and is implemented in the TcpListener class. * - * @param $socketData A valid socket resource array + * @param $socketInstance An instance of a StorableSocket class * @return void * @throws InvalidResourceException If the given resource is invalid */ - function processRawDataFromSocketArray (array $socketData); + function processRawDataFromSocketInstance (StorableSocket $socketInstance); /** * Checks whether decoded data is pending for further processing. diff --git a/application/hub/interfaces/handler/protocol/class_HandleableProtocol.php b/application/hub/interfaces/handler/protocol/class_HandleableProtocol.php index 33528ffe5..5eed3ad2e 100644 --- a/application/hub/interfaces/handler/protocol/class_HandleableProtocol.php +++ b/application/hub/interfaces/handler/protocol/class_HandleableProtocol.php @@ -1,12 +1,12 @@ + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Hub Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +interface HandleableRawData extends HubInterface { + // - Package errors + const PACKAGE_ERROR_INVALID_DATA = 'invalid_data'; // Invalid data in package found + const PACKAGE_ERROR_INCOMPLETE_DATA = 'incomplete_data'; // Incomplete data sent (e.g. field is missing) + const PACKAGE_ERROR_INVALID_CONTENT = 'invalid_content'; // Content is invalid (e.g. not well-formed) + const PACKAGE_ERROR_RECIPIENT_MISMATCH = 'recipient_error'; // Recipient is not us + const PACKAGE_LEVEL_CHECK_OKAY = 'checked_package'; // Package is fine + + // Package data + const PACKAGE_RAW_DATA = 'raw_data'; + const PACKAGE_ERROR_CODE = 'error_code'; + + // Start/end marker + const STREAM_START_MARKER = '[[S]]'; + const STREAM_END_MARKER = '[[E]]'; + + /** + * Stacker for raw data + */ + const STACKER_NAME_RAW_DATA = 'raw_data'; + + /** + * Checks whether raw data is pending for further processing. + * + * @return $isPending Whether raw data is pending + */ + function isRawDataPending (); + + /** + * "Getter" for next raw data from the stacker + * + * @return $rawData Raw data from the stacker + */ + function getNextRawData (); + + /** + * Setter for error code + * + * @param $errorCode The error code we shall set + * @return void + */ + function setErrorCode ($errorCode); + + /** + * Getter for error code + * + * @return $errorCode The error code + */ + function getErrorCode (); + +} diff --git a/application/hub/interfaces/helper/connections/class_ConnectionHelper.php b/application/hub/interfaces/helper/connections/class_ConnectionHelper.php index 9093bac9f..6f62b0090 100644 --- a/application/hub/interfaces/helper/connections/class_ConnectionHelper.php +++ b/application/hub/interfaces/helper/connections/class_ConnectionHelper.php @@ -1,10 +1,10 @@ diff --git a/application/hub/interfaces/producer/class_Producer.php b/application/hub/interfaces/producer/class_Producer.php index 31fff2c21..66a5b7318 100644 --- a/application/hub/interfaces/producer/class_Producer.php +++ b/application/hub/interfaces/producer/class_Producer.php @@ -1,9 +1,9 @@ diff --git a/application/hub/interfaces/producer/work_units/class_UnitProducer.php b/application/hub/interfaces/producer/work_units/class_UnitProducer.php index d521c81c0..e72aa7132 100644 --- a/application/hub/interfaces/producer/work_units/class_UnitProducer.php +++ b/application/hub/interfaces/producer/work_units/class_UnitProducer.php @@ -1,9 +1,10 @@ diff --git a/application/hub/interfaces/recipient/class_Recipient.php b/application/hub/interfaces/recipient/class_Recipient.php index 1e170d22b..a6a8a300b 100644 --- a/application/hub/interfaces/recipient/class_Recipient.php +++ b/application/hub/interfaces/recipient/class_Recipient.php @@ -1,12 +1,12 @@ * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Core Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.shipsimu.org * @@ -58,7 +57,7 @@ final class ApplicationEntryPoint { * @return void * @todo This method is old code and needs heavy rewrite and should be moved to ApplicationHelper */ - public static final function app_exit ($message = '', $code = false, $extraData = '', $silentMode = false) { + public static final function exitApplication ($message = '', $code = false, $extraData = '', $silentMode = false) { // Is this method already called? if (isset($GLOBALS['app_die_called'])) { // Then output the text directly @@ -75,7 +74,7 @@ final class ApplicationEntryPoint { } // END - if // Get config instance - $configInstance = FrameworkConfiguration::getSelfInstance(); + $configInstance = FrameworkBootstrap::getConfigurationInstance(); // Do we have debug installation? if (($configInstance->getConfigEntry('product_install_mode') == 'productive') || ($silentMode === true)) { @@ -133,7 +132,7 @@ final class ApplicationEntryPoint { $applicationInstance = NULL; // Is the class there? - if (class_exists('CoreFramework\Helper\Application\ApplicationHelper')) { + if (class_exists('Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper')) { // Get application instance $applicationInstance = ApplicationHelper::getSelfInstance(); @@ -193,7 +192,7 @@ final class ApplicationEntryPoint { // Is it not set? if (empty(self::$frameworkPath)) { // Auto-detect core path (first application-common) - foreach (array('core', '.', '/usr/local/share/php/core', '/usr/share/php/core') as $possiblePath) { + foreach (array('core', __DIR__, '/usr/local/share/php/core', '/usr/share/php/core') as $possiblePath) { // Create full path for testing $realPath = realpath($possiblePath); @@ -206,22 +205,19 @@ final class ApplicationEntryPoint { continue; } // END - if + // Append framework path + $frameworkPath = sprintf('%s%sframework%s', $realPath, DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR); + // First create full-qualified file name (FQFN) to framework/config-global.php - $fqfn = sprintf( - '%s%sframework%sconfig-global.php', - $realPath, - DIRECTORY_SEPARATOR, - DIRECTORY_SEPARATOR, - $possiblePath - ); + $configFile = $frameworkPath . 'config-global.php'; // Debug message - //* NOISY-DEBUG: */ printf('[%s:%d]: fqfn=%s' . PHP_EOL, __METHOD__, __LINE__, $fqfn); + //* NOISY-DEBUG: */ printf('[%s:%d]: configFile=%s' . PHP_EOL, __METHOD__, __LINE__, $configFile); // Is it readable? - if (is_readable($fqfn)) { + if (is_readable($configFile)) { // Found one - self::$frameworkPath = $realPath . '/framework/'; + self::$frameworkPath = $frameworkPath; // Abort here break; -- 2.39.5