protected function initSSLContext() { if (!\EventUtil::sslRandPoll()) { Daemon::$process->log(get_class($this->pool) . ': EventUtil::sslRandPoll failed'); return false; } $params = [\EventSslContext::OPT_VERIFY_PEER => $this->verifypeer, \EventSslContext::OPT_ALLOW_SELF_SIGNED => $this->allowselfsigned]; if ($this->certfile !== null) { $params[\EventSslContext::OPT_LOCAL_CERT] = $this->certfile; } if ($this->pkfile !== null) { $params[\EventSslContext::OPT_LOCAL_PK] = $this->pkfile; } if ($this->passphrase !== null) { $params[\EventSslContext::OPT_PASSPHRASE] = $this->passphrase; } $hash = igbinary_serialize($params); if (!self::$contextCache) { self::$contextCache = new CappedStorageHits(self::$contextCacheSize); } elseif ($ctx = self::$contextCache->getValue($hash)) { return $ctx; } $ctx = new \EventSslContext(\EventSslContext::TLS_CLIENT_METHOD, $params); self::$contextCache->put($hash, $ctx); return $ctx; }