Commit Graph

65 Commits

Author SHA1 Message Date
est31 a9213fd12c Protocol 25: Repurpose string field for access denial
Send it always, and make client use it as fallback for unknown reason strings.

This gives us future-proof-ness.
2015-07-17 07:01:24 +02:00
RealBadAngel 655fc6010f Fix relief mapping issues 2015-07-16 15:36:48 +02:00
Loic Blot 8ac0cf500f connection.cpp: remove unused constructor 2015-07-14 18:33:20 +02:00
kwolekr 5006ce8260 Remove raw message output on AOM deserialization failure
Improve TOCLIENT_ACTIVE_OBJECT_MESSAGES robustness for handling invalid data
2015-07-13 23:29:29 -04:00
kwolekr 1a1774a105 Fix damage flash when damage disabled 2015-07-10 15:58:57 -04:00
est31 b0784ba871 Use UTF-8 instead of narrow
Use wide_to_utf8 and utf8_to_wide instead of wide_to_narrow and narrow_to_wide at almost all places.
Only exceptions: test functions for narrow conversion, and chat, which is done in a separate commit.
2015-07-08 10:12:44 +02:00
est31 d92d376148 Client: better m_proto_ver initialisation
Previously, m_proto_ver was set to the serialisation version
inside the legacy init packet.

Now, if the server doesn't send a protocol version (protocols < 25),
we set m_proto_ver to some value < 25 and > 0.
2015-07-07 17:03:26 +02:00
Loic Blot c6766b275f Typo fix on previous @est31 commit 2015-06-23 23:17:47 +02:00
est31 3a89e25fe0 Small TOCLIENT_HELLO logging fix
Fix grammar error and missing number conversion for version.
Also add deployed protocol to log line.
2015-06-23 21:14:48 +02:00
Craig Davison bc55ef337c Use actionstream instead of errorstream when failing to emerge player 2015-06-23 19:25:06 +02:00
est31 dd91b3d6fb Generic CAO cleanups and renames for clarification
* Use enum for GENERIC_CMD_*
* Rename m_attachements to attachement_parent_ids (public member and clearer name)
* Rename GENERIC_CMD_SET_ATTACHMENT to GENERIC_CMD_ATTACH_TO
* USHRT_MAX + 1 buffer sizes to prevent overflows as @kahrl suggested
* Remove unneccessary m_id from GenericCAO (shadowing protected superclass member for no reason) as @kahrl suggested
2015-06-20 03:37:30 +02:00
est31 e13d2bafc6 Deny empty username early in the protocol
Thanks to @UltimateNate for pointing this out :)
2015-05-22 20:24:39 +02:00
kwolekr da34a2b33e Replace instances of std::map<std::string, std::string> with StringMap
Also, clean up surrounding code style
Replace by-value parameter passing with const refs when possible
Fix post-increment of iterators
2015-05-19 16:10:49 -04:00
est31 497299afd6 Lower log level for unexpected behaviour
Its a possible mistake to log in to a server with twice the same name.
Before, it triggered a server wide error message, now it logs to actionstream.
2015-05-19 00:55:58 +02:00
est31 c297a75a7d Fix build since last commit
Also rename method to better match what it does.
2015-05-16 22:14:15 +02:00
est31 8dbf683313 Finalize init packets and enable protocol v25
This enables srp.
2015-05-16 21:17:28 +02:00
est31 82e35edff5 Make early protocol auth mechanism generic, and add SRP
Adds everything needed for SRP (and everything works too),
but still deactivated, as protocol v25 init packets aren't final yet.
Can be activated by changing the LATEST_PROTOCOL_VERSION header to 25
inside networkprotocol.h.
2015-05-11 18:40:27 +02:00
Jay Arndt 2923eafaca Stop NetworkPacket methods from producing bloated packets 2015-05-05 01:47:41 +02:00
est31 ccc09abc2d Protocol 25: wstring -> string for custom access denial reasons
Also fix std::logic_error when server::DenyAccess() is used with only two arguments.
2015-04-22 14:10:39 +02:00
est31 f0a1379e5a Refactor around translatePassword
Change types for passed password from wstring to string, which removes converting
back and forth in most cases. Move the narrow_to_wide conversion, where its neccessary,
closer to irrlicht. Remove trailing spaces in guiPasswordChange.cpp. Make parameters for
translatePassword passed as const reference.
2015-04-17 06:10:30 +02:00
est31 f81759792e Make comments consistent with TOSERVER_INIT -> TOSERVER_INIT_LEGACY rename 2015-04-07 00:15:15 +02:00
Loic Blot 8804c47e59 TOCLIENT_ACTIVE_OBJECT_REMOVE_ADD can be unreliable, catch PacketError exception.
Also set the packet size at creation not when pushing rawString, no functional change
2015-04-05 11:39:38 +02:00
Loic Blot 4235f671c1 Fix uninitialized variabled in ConnectionEvent 2015-04-05 11:13:30 +02:00
est31 1cb404522f Remove errorstream logging on password change
This seems to be a debug message which has been forgotten to be removed.
2015-04-03 14:01:41 +02:00
Loic Blot aa340fd857 Create PacketError exception and use it with ACTIVEOBJECT_REMOVE_ADD handler which can be unreliable 2015-04-03 08:53:31 +02:00
Craig Robbins 9527984dbc Move globals from main.cpp to more sane locations
Move debug streams to log.cpp|h

Move GUI-related globals to clientlauncher

Move g_settings and g_settings_path to settings.cpp|h

Move g_menuclouds to clouds.cpp|h

Move g_profiler to profiler.cpp|h
2015-04-01 23:04:25 +10:00
Loic Blot 113bdd3ec0 NetworkPacket: reading outside packet is now clearer.
Use a common function to check the reading offset
2015-04-01 14:47:46 +02:00
Loic Blot 1fe4256462 Connection::Receive(): receive Network Packet instead of SharedBuffer<u8>.
Because we get a Buffer<u8> from ConnectionEvent, don't convert it to SharedBuffer<u8> and return it to Server/Client::Receive which will convert it to NetworkPacket
Instead, put the Buffer<u8> directly to NetworkPacket and return it to packet processing
This remove a long existing memory copy
Also check the packet size directly into Connection::Receive instead of packet processing
2015-03-31 11:01:08 +02:00
Loic Blot ab77bf98ee RunCommandQueues: little optimization
remove command from queue on success, else do nothing, instead of remove command from queue and push it front on success
2015-03-31 09:29:33 +02:00
Loic Blot 7c121726dc Typo in getOutgoingSequenceNumber => successfull to successful 2015-03-31 09:18:11 +02:00
Loic Blot 6a48844eba Use Buffer not SharedBuffer in NetworkPacket::oldForgePacket 2015-03-30 19:55:14 +02:00
Loic Blot dfe00abc5a queued_commands must be a std::deque. RunCommandQueues needs to push packet on front, not back 2015-03-29 10:49:43 +02:00
ShadowNinja 30075467b8 Change error_message from wstring to string
This removes a lot of narrow/wide conversions where a wide string was never used.
2015-03-27 20:24:04 -04:00
ShadowNinja 93fcab952b Clean up and tweak build system
* Combine client and server man pages.
  * Update unit test options and available databases in man page.
  * Add `--worldname` to man page.
  * Fix a bunch of places where `"Minetest"` was used directly instead of `PROJECT_NAME`.
  * Disable server build by default on all operating systems.
  * Make `ENABLE_FREETYPE` not fail if FreeType isn't found.
  * Enable LevelDB, Redis, and FreeType detection by default.
  * Remove the `VERSION_PATCH_ORIG` hack.
  * Add option to search for and use system JSONCPP.
  * Remove broken LuaJIT version detection.
  * Rename `DISABLE_LUAJIT` to `ENABLE_LUAJIT`.
  * Rename `minetest_*` variables in `version.{h,cpp}` to `g_*`.
  * Clean up style of CMake files.
2015-03-27 15:00:48 -04:00
Loic Blot 7851c4f7a2 Don't send an InventoryAction at each setInventoryModified, we only need one SendInventory per inventory modification
Client doesn't like to receive multiples SendInventory for one action, this can trigger glitches on clients (sometimes due to incorrect UDP packet ordering due to UDP protocol)

This fix issue #2544
2015-03-24 14:13:17 +01:00
Loic Blot 61f2d0ca34 Remove unused ConnectionCommand::sendToAll function. NetworkPacket::oldForgePacket returns Buffer instead of SharedBuffer and is used in ConnectionCommand instead of Connection::Send
This remove the NetworkPacket buffer => SharedBuffer => Buffer copy. Now NetworkPacket => Buffer
2015-03-22 12:18:16 +01:00
poet-nohit 7679396ebb SendInventory when handleCommand_Interact is a use.
This call was missing when change looping to triggering SendInventory: 1b2f64473e
2015-03-21 21:37:32 +01:00
Loic Blot 8f2e9bfbc2 ServerpacketHandler: spelling fixes 2015-03-18 12:06:02 +01:00
Loic Blot 814e55597d Use the NetworkPacket api to read full version string instead of u8 pointers. Also store the reserved byte to use API properly
Fixes #2509
2015-03-17 14:12:18 +01:00
Loic Blot b560294050 Rename packethandler/{client,server}.cpp to {client,server}packethandler.cpp
* Requested by @Zeno-
* Approved by @nerzhul
2015-03-16 10:19:19 +01:00
Loic Blot aaf26b3a44 If player is dead, permit it to respawn, even if damages are not enabled
* Mods can do setHP function to do damages and override the enable_damage value sometimes
2015-03-16 10:02:01 +01:00
Loic Blot 083c8c734e Replace NetworkPacket pointers to references 2015-03-13 22:01:49 +01:00
Loic Blot 74d34da6cb Prepare Protocol v25 init & authentication.
* TOSERVER_INIT and TOCLIENT_INIT renamed to _LEGACY
* TOSERVER_PASSWORD merged from dev-0.5, can use protocol v24 and v25
* TOCLIENT_ACCESS_DENIED merged from dev-0.5, can use protocol v24 and v25, with normalized strings an a custom id for custom errors
* new TOSERVER_INIT packet only send MT version, supported compressions, protocols and serialization, this permit to rework everything later without break the _INIT packet
* new TOSERVER_AUTH packet which auth the client
* new TOCLIENT_HELLO packet which send server serialization version atm
* new TOCLIENT_AUTH_ACCEPTED which is send when TOCLIENT_AUTH was okay. After this packet, the client load datas from servers, like after TOCLIENT_INIT_LEGACY packet
2015-03-13 20:23:03 +01:00
Loic Blot 9f3fc7201b Handle the newly added TOCLIENT_ACCESS_DENIED and TOCLIENT_DELETE_PARTICLESPAWNER
* Rename the handlers from _Legacy to regular, because here we can use same handlers
* Fix some packet names and pseudo handlers
2015-03-13 14:28:20 +01:00
Loic Blot 126f36c2e6 Rename some packet and handlers to <packet>_Legacy name for compat layer between new network changes and old network clients 2015-03-13 13:40:48 +01:00
Loic Blot 4e63c977c7 Use the new Player::isDead function when it's the case 2015-03-13 08:57:58 +01:00
Loic Blot afb19f3a1f handleCommand_Breath mustn't update breath is player is dead. A dead player doesn't breath.
Add Player::isDead function to check player is dead
2015-03-12 11:27:28 +01:00
Loic Blot 3067d78216 Don't handle PlayerPos packet coming from client if player is dead 2015-03-12 10:32:16 +01:00
Craig Robbins ced6d20295 For usages of assert() that are meant to persist in Release builds (when NDEBUG is defined), replace those usages with persistent alternatives 2015-03-07 22:41:47 +10:00
ShadowNinja 708337dfc2 Clean up database API and save the local map on an interval 2015-03-06 00:20:45 -05:00