diff options
author | red-001 <red-001@outlook.ie> | 2020-11-02 21:21:03 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-02 22:21:03 +0100 |
commit | 0abb3e89fa6298041faa7e46d437e5a81f71cdd3 (patch) | |
tree | a5043443766349fd63d452e4f33dbea65213de70 /src/network/connection.h | |
parent | 9c9344ceb31892a8563994190f1ec31cb872f12c (diff) | |
download | minetest-0abb3e89fa6298041faa7e46d437e5a81f71cdd3.tar.gz minetest-0abb3e89fa6298041faa7e46d437e5a81f71cdd3.tar.bz2 minetest-0abb3e89fa6298041faa7e46d437e5a81f71cdd3.zip |
Block attempts to connect to the client (#10589)
A Minetest peer initiates a connection by sending a packet with an invalid peer_id, for whatever reason the code for doing this ran on both the client and the server meaning you could connect to a client if you knew what the address:port tuple it was listening on.
Diffstat (limited to 'src/network/connection.h')
-rw-r--r-- | src/network/connection.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/network/connection.h b/src/network/connection.h index 2dc6d4397..24cd4fe4a 100644 --- a/src/network/connection.h +++ b/src/network/connection.h @@ -809,6 +809,11 @@ protected: void putEvent(ConnectionEvent &e); void TriggerSend(); + + bool ConnectedToServer() + { + return getPeerNoEx(PEER_ID_SERVER) != nullptr; + } private: MutexedQueue<ConnectionEvent> m_event_queue; |