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
Network cleanup #6310
Network cleanup #6310
Conversation
nerzhul
commented
Aug 24, 2017
•
edited
edited
- Move Connection threads to dedicated files (divide cpp file by 2 & make it more readable)
- ConnectionReceiveThread::processPacket now uses function pointer table to route MT packet types
- Remove many packet buffers copy (performance improval)
- Various code style fixes
* ConnectionReceiveThread::processPacket now uses function pointer table to route MT packet types * Various code style fixes
* SharedBuffer cannot be copied anymore using Buffer * Fix many SharedBuffer copy (thanks to delete operator)
src/network/connectionthreads.cpp
Outdated
std::list<BufferedPacket> timed_outs; | ||
|
||
if (dynamic_cast<UDPPeer *>(&peer)->getLegacyPeer()) | ||
channel.setWindowSize(g_settings->getU16("workaround_window_size")); |
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.
Undocumented setting.
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.
yes, i moved the code but didn't see that, what is that thing, i think i will remove it, it's too dangerous for a end user
src/network/connectionthreads.cpp
Outdated
continue; | ||
} | ||
|
||
float resend_timeout = dynamic_cast<UDPPeer *>(&peer)->getResendTimeout(); |
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.
UDPPeer *udp_peer = dynamic_cast<UDPPeer *>(&peer);
, shortens and improves readability on 9 lines.
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.
exact :)
src/network/connectionthreads.cpp
Outdated
while ((!channel.queued_reliables.empty()) && | ||
(channel.outgoing_reliables_sent.size() | ||
< channel.getWindowSize()) && | ||
(peer->m_increment_packets_remaining > 0)) { |
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.
Indents missing and redundant parentheses.
* Move Connection threads to dedicated files + various cleanups * ConnectionReceiveThread::processPacket now uses function pointer table to route MT packet types * Various code style fixes * Code style with clang-format * Various SharedBuffer copy removal * SharedBuffer cannot be copied anymore using Buffer * Fix many SharedBuffer copy (thanks to delete operator)
* Move Connection threads to dedicated files + various cleanups * ConnectionReceiveThread::processPacket now uses function pointer table to route MT packet types * Various code style fixes * Code style with clang-format * Various SharedBuffer copy removal * SharedBuffer cannot be copied anymore using Buffer * Fix many SharedBuffer copy (thanks to delete operator)