summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/network/network_content.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/network/network_content.cpp b/src/network/network_content.cpp
index 174dbdafe..1a186826a 100644
--- a/src/network/network_content.cpp
+++ b/src/network/network_content.cpp
@@ -57,7 +57,7 @@ bool ClientNetworkContentSocketHandler::Receive_SERVER_INFO(Packet *p)
ci->filesize = p->Recv_uint32();
p->Recv_string(ci->name, lengthof(ci->name));
- p->Recv_string(ci->version, lengthof(ci->name));
+ p->Recv_string(ci->version, lengthof(ci->version));
p->Recv_string(ci->url, lengthof(ci->url));
p->Recv_string(ci->description, lengthof(ci->description), SVS_REPLACE_WITH_QUESTION_MARK | SVS_ALLOW_NEWLINE);
@@ -220,10 +220,9 @@ void ClientNetworkContentSocketHandler::RequestContentList(uint count, const Con
while (count > 0) {
/* We can "only" send a limited number of IDs in a single packet.
* A packet begins with the packet size and a byte for the type.
- * Then this packet adds a byte for the content type and a uint16
- * for the count in this packet. The rest of the packet can be
- * used for the IDs. */
- uint p_count = min(count, (SEND_MTU - sizeof(PacketSize) - sizeof(byte) - sizeof(byte) - sizeof(uint16)) / sizeof(uint32));
+ * Then this packet adds a uint16 for the count in this packet.
+ * The rest of the packet can be used for the IDs. */
+ uint p_count = min(count, (SEND_MTU - sizeof(PacketSize) - sizeof(byte) - sizeof(uint16)) / sizeof(uint32));
Packet *p = new Packet(PACKET_CONTENT_CLIENT_INFO_ID);
p->Send_uint16(p_count);
@@ -249,9 +248,9 @@ void ClientNetworkContentSocketHandler::RequestContentList(ContentVector *cv, bo
this->Connect();
- /* 20 is sizeof(uint32) + sizeof(md5sum (byte[16])) */
assert(cv->Length() < 255);
- assert(cv->Length() < (SEND_MTU - sizeof(PacketSize) - sizeof(byte) - sizeof(uint8)) / (send_md5sum ? 20 : sizeof(uint32)));
+ assert(cv->Length() < (SEND_MTU - sizeof(PacketSize) - sizeof(byte) - sizeof(uint8)) /
+ (sizeof(uint8) + sizeof(uint32) + (send_md5sum ? sizeof(ContentInfo::md5sum) : 0)));
Packet *p = new Packet(send_md5sum ? PACKET_CONTENT_CLIENT_INFO_EXTID_MD5 : PACKET_CONTENT_CLIENT_INFO_EXTID);
p->Send_uint8(cv->Length());