protected function auth()
{
if ($this->state !== self::CONN_STATE_GOT_INITIAL_PACKET) {
return;
}
if ($this->pool->config->authtype->value === 'md5') {
$this->challenge(function ($conn, $challenge) {
$packet = "Action: Login\r\n" . "AuthType: MD5\r\n" . "Username: " . $this->username . "\r\n" . "Key: " . md5($challenge . $this->secret) . "\r\n" . "Events: on\r\n" . "\r\n";
$this->state = self::CONN_STATE_LOGIN_PACKET_SENT_AFTER_CHALLENGE;
$conn->write($packet);
});
} else {
$this->login();
}
}