projects
/
oweals
/
minetest.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove duplicate code in main menu
[oweals/minetest.git]
/
src
/
connection.cpp
diff --git
a/src/connection.cpp
b/src/connection.cpp
index 8f308c99fe1321860f431e68109b58b07e9f0594..58a0fb2bd9c3ef377f119dcea5982afbc9cd30b1 100644
(file)
--- a/
src/connection.cpp
+++ b/
src/connection.cpp
@@
-463,7
+463,7
@@
void Peer::reportRTT(float rtt)
{
if(rtt >= 0.0){
if(rtt < 0.01){
{
if(rtt >= 0.0){
if(rtt < 0.01){
- if(m_max_packets_per_second <
1
00)
+ if(m_max_packets_per_second <
4
00)
m_max_packets_per_second += 10;
} else if(rtt < 0.2){
if(m_max_packets_per_second < 100)
m_max_packets_per_second += 10;
} else if(rtt < 0.2){
if(m_max_packets_per_second < 100)
@@
-986,8
+986,16
@@
nextpeer:
void Connection::serve(u16 port)
{
dout_con<<getDesc()<<" serving at port "<<port<<std::endl;
void Connection::serve(u16 port)
{
dout_con<<getDesc()<<" serving at port "<<port<<std::endl;
- m_socket.Bind(port);
- m_peer_id = PEER_ID_SERVER;
+ try{
+ m_socket.Bind(port);
+ m_peer_id = PEER_ID_SERVER;
+ }
+ catch(SocketException &e){
+ // Create event
+ ConnectionEvent e;
+ e.bindFailed();
+ putEvent(e);
+ }
}
void Connection::connect(Address address)
}
void Connection::connect(Address address)
@@
-1597,6
+1605,9
@@
u32 Connection::Receive(u16 &peer_id, SharedBuffer<u8> &data)
if(m_bc_peerhandler)
m_bc_peerhandler->deletingPeer(&tmp, e.timeout);
continue; }
if(m_bc_peerhandler)
m_bc_peerhandler->deletingPeer(&tmp, e.timeout);
continue; }
+ case CONNEVENT_BIND_FAILED:
+ throw ConnectionBindFailed("Failed to bind socket "
+ "(port already in use?)");
}
}
throw NoIncomingDataException("No incoming data");
}
}
throw NoIncomingDataException("No incoming data");