Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Announce protocol version (Stevenarella client support) #4335

Open
earboxer opened this issue May 13, 2019 · 1 comment

Comments

Projects
None yet
2 participants
@earboxer
Copy link
Contributor

commented May 13, 2019

Client version: Stevenarella 10e5d6f44186c6acdf87666a6f00744d20744d0c
Server OS: macOS
Commit id: e6d805d

Expected behavior

Cuberite tells Stevenarella what protocols are supported, Stevenarella connects using one of those supported protocols.

Actual behavior

Cuberite doesn't tell Stevenarella what protocol to use, Stevenarella defaults to 477 (1.14). Cuberite says that that version is not supported, client cannot connect.

Stevenarella log message

[main.rs:99][WARN] Error pinging server 127.0.0.1 to get protocol version: Err("Wrong packet"), defaulting to 477

message on screen

{"text":"Unsupported protocol version 477, please use on of these versions: 1.8.x, 1.9.x, 1.10.x, 1.11.x, 1.12.x"}

protocol error: Wrong packet

Steps to reproduce the behavior

  • clone https://github.com/iceiix/stevenarella
  • have rust installed, cargo run --release to build and launch client
  • have cuberite server running
  • try to connect to cuberite server (127.0.0.1) in Stevenarella
@iceiix

This comment has been minimized.

Copy link

commented May 15, 2019

In the status check, Cuberite is sending a StatusResponse packet in response to StatusPing, instead of the expected StatusPong.

        let status = if let Packet::StatusResponse(res) = self.read_packet()? {
            res.status
        } else {
            return Err(Error::Err("Wrong packet".to_owned()));
        };

        let start = Instant::now();
        self.write_packet(StatusPing { ping: 42 })?;

        if let Packet::StatusPong(_) = self.read_packet()? {
        } else {
            return Err(Error::Err("Wrong packet".to_owned())); // errors out here
        };

If I change Stevenarella to accept StatusResponse in response to StatusPing, then it can connect to Cuberite (and negotiates the protocol correctly). But I think Cuberite should reply with pong (0x01) instead of a duplicate StatusResponse (0x00). Looking at the code I'm not sure why it doesn't, looks like it is meant to:

void cProtocolRecognizer::HandlePacketStatusPing()
{
Int64 Timestamp;
if (!m_Buffer.ReadBEInt64(Timestamp))
{
return;
}
cPacketizer Pkt(*this, 0x01); // Pong packet
Pkt.WriteBEInt64(Timestamp);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.