| @@ 229-243 (lines=15) @@ | ||
| 226 | call_user_func($this->onChallenge, $this, $packet['challenge']); |
|
| 227 | } |
|
| 228 | } |
|
| 229 | else { |
|
| 230 | if ($packet['message'] === 'authentication accepted') { |
|
| 231 | $this->state = self::CONN_STATE_HANDSHAKED_OK; |
|
| 232 | ||
| 233 | Daemon::$process->log(__METHOD__ . ': Authentication ok. Connected to ' . parse_url($this->addr, PHP_URL_HOST)); |
|
| 234 | ||
| 235 | if ($this->onConnected) { |
|
| 236 | $this->connected = true; |
|
| 237 | $this->onConnected->executeAll($this); |
|
| 238 | $this->onConnected = null; |
|
| 239 | } |
|
| 240 | ||
| 241 | $this->event('connected'); |
|
| 242 | } |
|
| 243 | } |
|
| 244 | } |
|
| 245 | else { |
|
| 246 | $this->state = self::CONN_STATE_HANDSHAKED_ERROR; |
|
| @@ 245-257 (lines=13) @@ | ||
| 242 | } |
|
| 243 | } |
|
| 244 | } |
|
| 245 | else { |
|
| 246 | $this->state = self::CONN_STATE_HANDSHAKED_ERROR; |
|
| 247 | ||
| 248 | Daemon::$process->log(__METHOD__ . ': Authentication failed. Connection to ' . parse_url($this->addr, PHP_URL_HOST) . ' failed.'); |
|
| 249 | ||
| 250 | if ($this->onConnected) { |
|
| 251 | $this->connected = false; |
|
| 252 | $this->onConnected->executeAll($this); |
|
| 253 | $this->onConnected = null; |
|
| 254 | } |
|
| 255 | ||
| 256 | $this->finish(); |
|
| 257 | } |
|
| 258 | ||
| 259 | $this->packets = []; |
|
| 260 | } |
|