Skip to content

Commit

Permalink
Fixed minetest reliable udp implementation (compatible to old clients)
Browse files Browse the repository at this point in the history
  • Loading branch information
sapier authored and sapier committed Jan 10, 2014
1 parent 8b0b857 commit 9edb91d
Show file tree
Hide file tree
Showing 8 changed files with 2,696 additions and 1,008 deletions.
5 changes: 4 additions & 1 deletion minetest.conf.example
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,10 @@
# Number of emerge threads to use. Make this field blank, or increase this number, to use multiple threads.
# On multiprocessor systems, this will improve mapgen speed greatly, at the cost of slightly buggy caves.
#num_emerge_threads = 1

# maximum number of packets sent per send step, if you have a slow connection
# try reducing it, but don't reduce it to a number below double of targeted
# client number
#max_packets_per_iteration = 1024
#
# Physics stuff
#
Expand Down
12 changes: 6 additions & 6 deletions src/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ void Client::step(float dtime)
writeU16(&data[53], CLIENT_PROTOCOL_VERSION_MAX);

// Send as unreliable
Send(0, data, false);
Send(1, data, false);
}

// Not connected, return
Expand Down Expand Up @@ -597,7 +597,7 @@ void Client::step(float dtime)
writeV3S16(&reply[2+1+6*k], *j);
k++;
}
m_con.Send(PEER_ID_SERVER, 1, reply, true);
m_con.Send(PEER_ID_SERVER, 2, reply, true);

if(i == deleted_blocks.end())
break;
Expand Down Expand Up @@ -745,7 +745,7 @@ void Client::step(float dtime)
reply[2] = 1;
writeV3S16(&reply[3], r.p);
// Send as reliable
m_con.Send(PEER_ID_SERVER, 1, reply, true);
m_con.Send(PEER_ID_SERVER, 2, reply, true);
}
}
if(num_processed_meshes > 0)
Expand Down Expand Up @@ -840,7 +840,7 @@ void Client::step(float dtime)
std::string s = os.str();
SharedBuffer<u8> data((u8*)s.c_str(), s.size());
// Send as reliable
Send(0, data, true);
Send(1, data, true);
}
}
}
Expand Down Expand Up @@ -957,7 +957,7 @@ void Client::request_media(const std::list<std::string> &file_requests)
std::string s = os.str();
SharedBuffer<u8> data((u8*)s.c_str(), s.size());
// Send as reliable
Send(0, data, true);
Send(1, data, true);
infostream<<"Client: Sending media request list to server ("
<<file_requests.size()<<" files)"<<std::endl;
}
Expand All @@ -970,7 +970,7 @@ void Client::received_media()
std::string s = os.str();
SharedBuffer<u8> data((u8*)s.c_str(), s.size());
// Send as reliable
Send(0, data, true);
Send(1, data, true);
infostream<<"Client: Notifying server that we received all media"
<<std::endl;
}
Expand Down
Loading

0 comments on commit 9edb91d

Please sign in to comment.