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