-
Notifications
You must be signed in to change notification settings - Fork 1.1k
early support for web login and packet sequencing #3671
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
Conversation
logging in now possible both ways - legacy and webService\nClient 12 will crash on login because the server still sends 10.98 packets.
Not necessary unless you run multiworld loginserver. Not present in current tfs either.
Fixed the bugs and walked a bit around the temple. 7.6, 8.6, 9.7, 10.99, 12.71: only client with protocol 10.98 allowed Waiting for a review. |
receivedFirst = true; | ||
|
||
if (!protocol) { | ||
// Skip deprecarted checksum bytes (with clients that aren't using it in mind) | ||
uint16_t len = msg.getLength(); | ||
if (len < 280 && len != 151) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to know what are these numbers xD
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
151 is exact packet length for 8.6 and 9.7 (and probably all the clients in the middle)
clients that use checksums have packet lengths larger than 280 although I'm not sure how was that figured out
7.6 has packet lengths varying on user input for credentials fields, but it never goes above 100
This won't affect the gameplay because after login, it skips all these checks and just calls onRecvPacket
src/connection.cpp
Outdated
// Read size of the first packet | ||
boost::asio::async_read(socket, | ||
boost::asio::buffer(msg.getBuffer(), NetworkMessage::HEADER_LENGTH), | ||
std::bind(&Connection::parseHeader, shared_from_this(), std::placeholders::_1)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use a lambda here, I think it will be way cleaner, e.g.
auto bufferLength = !receivedLastChar && receivedName && connectionState == CONNECTION_STATE_CONNECTING_STAGE2 ? 1 : NetworkMessage::HEADER_LENGTH
// Read size of the first packet
boost::asio::async_read(socket,
boost::asio::buffer(msg.getBuffer(), bufferLength),
[connection = shared_from_this()](auto packet) { connection->parseHeader(packet); });
Not 100% sure about the syntax but you'll get the idea
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand this enough to make that change. I'm not that good at c++
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe it is right now, just copy it over the whole if/else block
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see what you meant. There is same code with a small difference written twice. The code preview on github didn't show that so I didn't understood the context. Everything is clear now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[connection = shared_from_this()](auto packet) { connection->parseHeader(packet); });
this line causes an error btw
C2780 "auto Connection::accept::<lambda_a28015d96ed371fa3d8a39af35f1cb78>::operator ()(_T1) const": expected 1 argument, got 2 theforgottenserver c:\vcpkg\installed\x64-windows\include\boost\asio\impl\read.hpp 480
so I'll use current tfs implementation instead
Applied the requested changes except for lambda expression because it was causing compiling issues |
See the pull request referenced above for continuation of this project. |
Pull Request Prelude
Changes Proposed
name
andemail
columns when logging in (login with email is webservice only)dropping token auth since it wasn't present in version 12 login packet (or no one knows how to set it up yet)Reverted. You can make client 12 compatible using this change: TFS compatibility adjustments to webLogin Znote/ZnoteAAC#491Issues addressed: one step closer to #3492
Notes
I know these changes are far from perfect, therefore I'm waiting for reviews and opinions
Changes based on opentibiabr/canary code (License GPL-2.0, same as ours)