Commit Graph

189 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
kwolekr 1a1774a105 Fix damage flash when damage disabled 2015-07-10 15:58:57 -04:00
kwolekr 7b171ea2be Fix code style from recent commits and add misc. optimizations 2015-07-02 23:14:30 -04:00
TeTpaAka c0335f7d13 Add some missing getter functions to the lua API
ObjectRef:
get_properties
get_armor_groups
get_animation
get_attach
get_bone_position

Players:
get_physics_override
hud_get_hotbar_itemcount
hud_get_hotbar_image
hud_get_hotbar_selected_image
get_sky
get_day_night_ratio
get_local_animation
get_eye_offset

Global:
minetest.get_gen_notify
minetest.get_noiseparams
2015-05-28 16:46:35 +02:00
ShadowNinja 3a8c788880 Add mod security
Due to compatibility concerns, this is temporarily disabled.
2015-05-16 18:32:31 -04: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
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
kwolekr 821d0025da Biomes: Remove referenced biomes from Decorations on clear 2015-04-16 23:38:05 -04:00
Loic Blot 470de10de3 Fix players spawned at (0,0,0) in some rare cases instead of static_spawnpoint, if set
Approved by: @kwoelkr
2015-04-03 09:44:36 +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 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 bfc4652c66 Fix a little regression on SendActiveObjectMessages which send all TOCLIENT_ACTIVE_OBJECT_MESSAGES as reliable 2015-03-17 09:16:39 +01:00
Loic Blot e7736ffdd6 Move TOCLIENT_ACTIVE_OBJECT_REMOVE_ADD and TOCLIENT_ACTIVE_OBJECT_MESSAGES to private functions 2015-03-16 12:01:40 +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 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 aa474e4501 Server.cpp Use std::list instead of std::vector for playSound, fillMediaCache, sendRequestedMedia, sendMediaAnnouncement and related functions 2015-03-05 11:40:04 +01:00
Loic Blot 82482ecd9d Server::AsyncRunStep: buffered_messages now uses std::vector instead of std::list. * sendRemoveNode and sendAddNodes are also converted as a side effect 2015-03-05 11:23:54 +01:00
Loic Blot 365e4ae0fa Performance improvement: Use std::list instead of std::vector for request_media, Server::getModNames, Environment::m_simple_objects.
* Also remove unused Server::m_modspaths
2015-03-05 10:44:48 +01:00
Loic Blot b214cde5b4 Remove Queue class which uses std::list and use native std::queue 2015-03-05 16:49:51 +10:00
Loic Blot 7e088fdfe3 We always know playerSAO when calling SendInventory. Using it instead of searching it via peer_id 2015-03-04 15:28:33 +01:00
Loic Blot 40bf1d7b5f Send Position packet on event, don't check it at each AsyncRunStep.
* This permit to cleanup the player checking loop
2015-03-04 12:19:26 +01:00
Loic Blot 1b2f64473e Send Inventory packet on event, don't check it at each AsyncRunStep.
* Call UpdateCrafting into SendInventory because this functions is only called before SendInventory
* Use Player* instead of peer_id for UpdateCrafting because SendInventory already has the Player* pointer, then don't loop for searching Player* per peer_id
* m_env_mutex don't need to be used with this modification because it's already locked before the calls
2015-03-04 11:29:39 +01:00
Loic Blot 7e56637ed0 Send Breath packet on event, don't check it at each AsyncRunStep 2015-03-03 16:33:20 +01:00
Loic Blot 64ff966bae Send Player HP when setHP (or a setHP caller) is called instead of looping and testing the state change. 2015-03-03 16:06:04 +01:00
Loic Blot ed04e8e9e4 [Patch 2/4] Network rework: packet writing, sending and cleanups
NetworkPacket.cpp:
* Remove some deprecated functions, we must use streaming interface
* m_data converted from u8* to std::vector<u8>
* Add an exporter to forge packet to Connection object
* implement operator << std::wstring. n
* implement operator << std::string
* dynamic resize when write packet content.
* fix string writing and performances.
* create ServerCommandFactory, used by client to get useful informations about packet processing (sending).
  * Reliability
  * Transmit channel
* Implement putRawString for some ugly char (_INIT packet), and use it.
* Many packet read and write migrated
* Implement oldForgePacket to interface writing with current connection
* fix U8/char/bool writing
* fix string writing and performances.
* add some missing functions
* Use v3s16 read instead of reading x,y,z separately
* Add irr::video::SColor support into packets
* Add some missing handlers
* Add a template function to increase offset
* Throw a serialization error on packet reading (must be improved)

PacketFactories:
* Create ServerCommandFactory, used by client to get useful informations about packet processing (sending).
* Create ClientCommandFactory, used by server to get useful informations about packet processing (sending).

Client.cpp:
* implement NetworkPacket ::Send interface.
* Move packet handlers to a dedicated file
* Remove Client::Send(SharedBuffer)

Server.cpp:
* implement NetworkPacket ::Send interface.
* Rewrite all packets using NetworkPacket
* Move packet handlers to a dedicated file
* Remove Server::Send(SharedBuffer)

ClientIface.cpp:
* Remove sendToAll(SharedBuffer<u8>)

Connection.hpp rework:
* Remove duplicate include
* Remove duplicate negation
* Remove a useless variable
* Improve code performance by using a m_peers_list instead of scanning m_peers map
* Remove Connection::Send(SharedBuffer)
* Fix useafterfree into NetworkPacket Sending
* Remove unused Connection::sendToAll

Test.cpp:
* Remove dead code
* Update tests to use NetworkPackets

Misc:
* add new wrappers to Send packets in client, using NetworkPacket
* Add NetworkPacket methods for Connection
* coding style fix
* dead code since changes cleanup
* Use v3s16 read instead of reading x,y,z separately in some packets
* Use different files to handle packets received by client and server
* Cleanup: Remove useless includes

ok @Zeno-
Tested by @Zeno- @VanessaE and @nerzhul on running servers
2015-02-16 11:00:55 +01:00
Loic Blot a704c04f00 Network Layer 7 rework (Packet handling)
* Move networkcode to a dedicated directory
* Rename clientserver.h to network/networkprotocol.h (Better name) and sanitize some includes
* Create object NetworkPacket
  * It stores command (opcode) and data separated
  * It also stores peer_id
  * Data reading can be done by using a streaming interface
* Change packet routing analysis
  * Remove old conditional analysis
  * Now uses function pointed analysis and add connection state ({Client,Server}::handlers)
  * Connection state permit to categorize condition to handle before analyze packets
  * Create a handler for depreciated messages, instead of duplicating code
2015-02-10 20:04:08 +10:00
ShadowNinja a9f81b729b Send real port to server list 2015-01-23 21:38:34 +10:00
Kahrl 0183c05ee0 Fix struct vs. class in forward declarations 2014-12-08 09:06:31 +01:00
ShadowNinja b1965ac209 Clean up rollback 2014-11-19 16:21:59 -05:00
RealBadAngel d221917170 Recalculate normals for cached meshes.
Check if mesh is here before adding to meshcollector.

Fix deleting the meshes.
2014-10-21 18:43:29 +02:00
kwolekr c91f8b1d25 Add prefixes to enum values and fix style issues 2014-06-28 02:02:38 -04:00
BlockMen 8b02a015eb Use integers instead of float values 2014-04-12 20:04:12 +02:00
BlockMen c0ab09af74 Add player:set_eye_offset() by @MirceaKitsune and clean up 2014-04-12 17:44:20 +02:00
BlockMen a1db9242ec Add third person view 2014-04-12 17:44:15 +02:00
Kahrl 6090e95cdc Infer ipv6_server from bind_address; fix client connect to IN(6)ADDR_ANY 2014-04-10 22:03:42 +02:00
sapier 142e2d3b74 Cleanup client init states by bumping protocol version
Don't use TOSERVER_RECEIVED_MEDIA but TOSERVER_CLIENT_READY as indicatio for client ready
Handle clients with protocol version < 23 (almost) same way as before
Make client tell server about it's version
Add client state to not send bogus player position updates prior init complete
Add access to statistics information (peer connction time,rtt,version)
Fix clients standing stalled in world while preloading item visuals (new clients only)
Add get_player_information to read client specific information from lua
2014-04-08 21:12:20 +02:00
Selat 7cac34c807 Pass arguments by reference 2014-03-12 17:34:48 -04:00
ShadowNinja 9a3b7715e2 Remove "Server -!- " prefix from player messages 2014-02-27 00:00:22 -05:00
ShadowNinja 85fe75d1cb Add the option to bind to a specific address 2014-02-05 21:24:46 +01:00
sapier 857a49e081 Add minetest.kick_player(name, reason) 2014-02-03 17:33:59 -05:00
Perttu Ahola 6a3fa9df12 Add player:override_day_night_ratio() for arbitrarily controlling sunlight brightness 2014-02-01 18:38:21 +01:00
Perttu Ahola 86a6cca3cf Add player:set_sky() with simple skybox support 2014-02-01 18:34:26 +01:00
sapier e258675eab Add propper client initialization
-add client states to avoid server sending data to uninitialized clients
  -don't show uninitialized clients to other players
  -propper client disconnect handling
Minor comment fixes in server
Minor bugfixes in connection
  -improved peer id calculation
  -honor NDEBUG flag
  -improved disconnect handling
  -increased initial send window
Remove some dead code
2014-01-31 18:44:43 +01:00
khonkhortisan 2b1eff7725 Allow vertical axis particle rotation constraint
Use tables for adding particles, deprecate former way.

separate particles(pawner) definition, add default values, work with no
arguments
2014-01-13 17:34:56 -05:00
sapier 9edb91da57 Fixed minetest reliable udp implementation (compatible to old clients) 2014-01-10 10:10:45 +01:00
proller c62bab010f Send long announce as POST, show OS in useragent
Add lag reporting to masterserver (average dtime)
StyledWriter  -> FastWriter in masterserver announce
2014-01-07 02:50:45 +04:00
ShadowNinja 49cec3f782 Handle LuaErrors in Lua -> C++ calls on LuaJIT 2013-12-18 16:35:55 -05:00
Kahrl 0404bbf671 Rewrite client media download and support hash-based remote download
Move most of the media-related code in client.cpp into a new class
ClientMediaDownloader (clientmedia.cpp, clientmedia.h). Among other
things, this class does the following things:

- Download [remote_server][sha1] instead of [remote_server][name]. This
is to support servers that provide the same file name with different
contents.
- Initially fetch [remote_server]index.mth. This file should follow the
Minetest Hashset format (currently version 1) and contain a list of SHA1
hashes that exist on the server.
- The list of needed SHA1s is uploaded (via HTTP POST) when index.mth is
requested, so servers can optionally narrow down the list to the needs
of the client.
- If index.mth is missing (HTTP response code 404), we enter compat mode,
fetching [remote_server][name] as before this commit.
- remote_server can now contain multiple servers, separated by commas.
The downloader code attempts to split requests between the different
servers, as permitted by each server's index.mth. If one server claims
to have a file but actually doesn't (or something fails), we ask a
different server that also claims to have it.
- As before, when none of the remote servers provide a particular
file, we download it via the conventional method, i.e. using
the minetest protocol: TOSERVER_REQUEST_MEDIA / TOCLIENT_MEDIA.
- Bugfix: Every downloaded file's SHA1 is now verified against the SHA1
announced by the minetest server (before loading it and inserting it
into the file cache).
- Bugfix: Only send TOSERVER_RECEIVED_MEDIA when we actually have all
media. This should fix #863.
2013-12-13 18:05:20 +01:00
Novatux d879a539cd Add minetest.swap_node 2013-11-30 18:37:56 +01:00
proller a924409bd1 Masterserver update 2013-10-18 01:32:49 +04:00