Skip to content

Commit

Permalink
upgrade protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
yuxshao committed Mar 8, 2021
1 parent a345b7f commit c65cc8b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/network/Client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ void Client::tryToStart() {
if (!hello.isValid()) {
qWarning("Invalid hello response. Disconnecting.");
emit errorOccurred(
tr("Invalid hello response from server. Disconnecting."));
tr("Invalid hello response from server. Are you running the same version of ptcollab as the server?"));
m_socket->disconnectFromHost();
return;
}
Expand Down
10 changes: 5 additions & 5 deletions src/protocol/Hello.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

// Constants so different versions of the software can hopefully try to
// communicate with each other
constexpr char CLIENT_HELLO[] = "CLIENT_HELLO";
constexpr char SERVER_HELLO[] = "SERVER_HELLO";
const qint64 PROTOCOL_VERSION = 1;
constexpr char CLIENT_HELLO[] = "PTCOLLAB_CLIENT_HELLO";
constexpr char SERVER_HELLO[] = "PTCOLLAB_SERVER_HELLO";
const qint64 PROTOCOL_VERSION = 2;

ClientHello::ClientHello(const QString &username)
: hello(CLIENT_HELLO), version(PROTOCOL_VERSION), m_username(username) {}

bool ClientHello::isValid() {
return (hello == CLIENT_HELLO) && (version == PROTOCOL_VERSION);
return (hello == CLIENT_HELLO) && (version == PROTOCOL_VERSION) && false;
}

QString ClientHello::username() { return m_username; }
Expand All @@ -29,7 +29,7 @@ ServerHello::ServerHello(qint64 uid)
: hello(SERVER_HELLO), version(PROTOCOL_VERSION), m_uid(uid) {}

bool ServerHello::isValid() {
return (hello == SERVER_HELLO && version == PROTOCOL_VERSION && m_uid != -1);
return (hello == SERVER_HELLO && version == PROTOCOL_VERSION && m_uid != -1) && false;
}

qint64 ServerHello::uid() { return m_uid; }
Expand Down

0 comments on commit c65cc8b

Please sign in to comment.