Exemple #1
0
 public function connect()
 {
     $this->socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
     if ($this->socket === false or !@socket_connect($this->socket, $this->interface, $this->port)) {
         $this->logger->critical("Synapse Client can't connect {$this->interface}:{$this->port}");
         $this->logger->error("Socket error: " . socket_strerror(socket_last_error()));
         return false;
     }
     $this->logger->info("Synapse has connected to {$this->interface}:{$this->port}");
     socket_set_nonblock($this->socket);
     return true;
 }
 public function onRun()
 {
     foreach ($this->loadPaths as $name => $path) {
         if (!class_exists($name, false) and !interface_exists($name, false)) {
             require $path;
         }
     }
     $this->loader->register(true);
     $rsa = new RSA();
     $this->logger->info("[BigBrother] Generating keypair");
     $rsa->setPrivateKeyFormat(CRYPT_RSA_PRIVATE_FORMAT_PKCS1);
     $rsa->setPublicKeyFormat(CRYPT_RSA_PUBLIC_FORMAT_PKCS1);
     $keys = $rsa->createKey(1024);
     $this->setResult($keys);
 }