Commit Graph

613 Commits

Author SHA1 Message Date
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
kwolekr
699d42efc6 Revert "Server::step throw is never catched. Replace it with an errorstream + assert"
This reverts commit 5f8e48c63baf12930430d5d8fc07495021599e61.
2015-03-16 21:17:27 -04:00
Loic Blot
5f8e48c63b Server::step throw is never catched. Replace it with an errorstream + assert
This throw can be trigger by LuaError exception or ConnectionBindFailed exception in the following functions:
* EmergeThread::Thread()
* ScriptApiEnv::environment_Step()
* ScriptApiEnv::player_event()
* ServerThread::Thread()
2015-03-16 20:25:35 +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
b2801d8127 SendPlayerHPOrDie everytime at client connection, damage enabled or not, this will fix the player which stay dead at connection 2015-03-15 19:09:26 +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
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
ngosang
f6e4c5d9cf Respect game mapgen flags and save world noise params 2015-03-07 15:53:39 -05: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
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
2066655aae ClientInterface::getClientIDs doesn't need a std::list. Use a std::vector for better perfs 2015-03-04 16:30:24 +01: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
7f8f9785d7 ASyncRunStep doesn't need to lock when do setTimeOfDaySpeed.
* setTimeOfDaySpeed already lock a mutex when modify the value, we don't need to lock all environment.
* add a fine grain lock for getTimeOfDay and setTimeOfDay to solve environment multithread modifications on this value
2015-03-04 11:46:31 +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
038d3a31df Remove unused m_wielded_item_not_sent 2015-03-03 17:36:54 +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
009149a073 Fix some memory leaks on packet sending. 2015-02-21 17:27:31 +01:00
Loic Blot
5a5854ea9d Move hex.h to util/ 2015-02-21 14:32:35 +01:00
Loic Blot
3998a1f8f9 Move sha1.hpp and base64.hpp to util/ 2015-02-21 14:03:27 +01:00
Loic Blot
27d4e89d32 Fix unused (and so, broken) enable_rollback_recording. This option must be reloaded at server loop but loaded when server starts, for data consistency (not a hot load variable)
ok @ShadowNinja
2015-02-18 09:28:39 +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
bb59a8543d Replace getPlayer(playername) by getPlayer(peer_id) in some possible cases. ok @Zeno- 2015-02-10 16:03:16 +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
SmallJoker
929e0b0ad8 Give full breath after death 2015-02-05 17:33:08 +10:00
Loic Blot
80a7408e4d Fix a crash (assert) when client set serial version < 24 in INIT
When SER_FMT_VER_LOWEST is set to zero, then the test is stupid in INIT because all client works. In mapblock we check if client's serialization version is < 24, but if client sent serialization version < 24 (15 for example) the server set it and tried to send nodes, then BOOM

To resolve the problem:
* Create a different CLIENT_MIN_VERSION to handle this problem
* Remove the exception
* Use an assert in case of bad developer code
2015-01-27 16:55:25 +01:00
Kahrl
f8bd1f3563 Fix uninitialized variable Server::m_next_sound_id 2015-01-24 06:44:41 +01:00
ShadowNinja
a9f81b729b Send real port to server list 2015-01-23 21:38:34 +10:00
onkrot
0fd1ee0380 Performance fixes. 2015-01-13 23:48:56 +10:00
kwolekr
cd4d213ae0 NodeResolver: Perform callback immediately if node registration phase finished
Also add NodeResolver callbacks on the client
2015-01-04 16:32:31 -05:00
kwolekr
a3d7203be5 Fix map parameter load order 2014-12-30 12:30:42 -05:00
kwolekr
5e2753c712 Expose mapgen parameters on scripting init
Add minetest.get_mapgen_params()
Deprecate minetest.register_on_mapgen_init()
2014-12-29 12:59:59 -05:00
Craig Robbins
3993102e88 Fix -Wtype-limits warnings and remove disabling of -Wtype-limits 2014-12-29 23:56:40 +10:00
kwolekr
b67f37f27e Redefine NodeResolver interface and replace with callback mechanism 2014-12-27 02:12:21 -05:00
Anton
10e0cf8b2c Use std::string::empty() instead of size() where applicable 2014-12-12 15:16:24 -05:00
Craig Robbins
9f65fd6819 Fix typo in mapblock.h 2014-12-12 20:46:37 +10:00
Muhammad Rifqi Priyo Susanto
5ffddc94c0 Add space between client names in status text (client)
Before:
Server: version=0.4.10, uptime=190.5, max_lag=0.001, clients={user1,user2,user3,user4,user5,foobar,userplayedminetestthismorning}

After:
Server: version=0.4.10, uptime=190.5, max_lag=0.001, clients={user1, user2, user3, user4, user5, foobar, userplayedminetestthismorning}
2014-12-07 21:32:08 +10:00
ShadowNinja
b1965ac209 Clean up rollback 2014-11-19 16:21:59 -05:00
Craig Robbins
5b8855e83c Remove most exceptions from getNode() (and variants) 2014-11-14 18:05:34 +10:00
Kahrl
0adadba218 Serverlist: announce mg_name from map_meta.txt instead of minetest.conf 2014-11-10 22:27:10 +01:00
SmallJoker
c40e993ce4 Replace setting unlimited_player_transfer_distance with player_transfer_distance 2014-11-08 14:56:09 +01:00
kwolekr
9e811a92e7 Split up mapgen.cpp 2014-11-01 13:16:23 -04:00
kwolekr
d274cbfce6 Add NodeResolver and clean up node name -> content ID resolution system 2014-10-26 23:55:45 -04: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
ShadowNinja
e9c9b66ae9 Make players check inventory modification properly 2014-10-01 18:44:36 -04:00
ShadowNinja
cd0df0d5e7 Simplify player modification checks 2014-10-01 18:44:36 -04:00
ShadowNinja
c061bdd37f Fix locking bugs and make inventory deserialization errors more specific 2014-09-21 14:39:36 -04:00
sapier
dec8c43de3 Fix to to too two times 2014-08-22 21:51:20 +02:00
sapier
d7d8aa1039 Add player name length checks 2014-08-22 21:18:43 +02:00
sapier
8e9d896f2d Fix "ghost" blocks if block update is "on wire" while player digs nodes 2014-08-22 20:56:16 +02:00
sapier
2a5c88bde1 Don't call a player event without having player to do a event for 2014-08-21 17:29:26 +02:00
sapier
d38f6ebb9b Fix error handling on inconsistent client ready message
Fix android makefile to provide a correct dummy githash if detection fails
2014-07-16 20:01:00 +02:00
ShadowNinja
9afeb97fc6 Fix serverlist code style, const-correctness, and types 2014-06-30 13:26:02 -04:00
sapier
ff36071d93 Don't spam server console on player/playersao error but just drop the affected client 2014-06-29 17:55:21 +02:00
sapier
ebf7ea5019 Add formspec api versioning 2014-06-29 12:13:55 +02:00
kwolekr
c91f8b1d25 Add prefixes to enum values and fix style issues 2014-06-28 02:02:38 -04:00
ShadowNinja
7e6db1b803 Only keep players loaded while they're connected 2014-06-23 15:45:59 -04:00
sapier
a0097c6bfa Fix uncought deserialization error on receiving data 2014-06-22 00:05:41 +02:00
sapier
f8522d50e7 Fix server assert in case of invalid message from client, just kick that client. 2014-06-21 23:56:46 +02:00
sapier
d76b8c6e7c Small cleanup of hud add/remove code 2014-05-31 22:32:44 +02:00
sapier
73e5bc9c01 Add joining player to printed player list 2014-05-20 18:09:32 +02:00
sapier
6c37e89f08 Fix old client showing duplicated health bar on new server
Fix client not showing hearts and bubbles on connecting to old server
Fix server not remembering hud flags correctly
2014-05-11 22:34:44 +02:00
sapier
f76b9d724b Fix possible deadlock in error conditions 2014-05-11 00:14:57 +02:00
ShadowNinja
1cd512913e Organize builtin into subdirectories 2014-05-07 17:14:23 -04:00
sapier
d3ee617f37 Fix heart + bubble bar size on different texture packs
Add DPI support for statbar
Move heart+bubble bar to Lua HUD
Add statbar size (based upon an idea by blue42u)
Add support for customizing breath and statbar
2014-05-07 21:46:27 +02:00
sapier
555dc86343 Add missing ip address to player join log entry 2014-04-21 22:28:52 +02:00
sapier
a0dd2d89f3 Reduce log level for incoming crap packets
Add log entry for peer timeout
2014-04-19 22:12:01 +02: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
edcad09dee Add support for named threads (atm linux only) 2014-04-09 21:32:21 +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
kwolekr
3570f3e396 Add minetest.set_noiseparam_defaults() Lua API 2014-02-15 19:13:14 -05:00
sapier
ded5f8b1a6 Fix possible missing unlock of env_lock 2014-02-12 19:47:27 +01:00
kwolekr
89f7dc1efd ServerEnvironment: Remove direct dependency on EmergeManager 2014-02-09 16:36:30 -05:00
ShadowNinja
85fe75d1cb Add the option to bind to a specific address 2014-02-05 21:24:46 +01:00
kwolekr
5a34f40d80 Huge overhaul of the entire MapgenParams system
MapgenParams is no longer a polymorphic class, eliminating the need for messy and bug-prone reallocations.
Separation between the common and mapgen-specific parameters is now strongly defined.
Mapgen parameters objects are now properly encapsulated within the proper subsystems.
2014-02-03 22:50:14 -05:00
sapier
e7c2e61b19 Add additional check to avoid broadcasting private messages in error conditions 2014-02-02 01:55:24 +01: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
RealBadAngel
21f1bec724 New HUD element - waypoint. 2014-01-26 21:31:59 +01:00
kwolekr
9b978db0c2 Fix use of previously deallocated EmergeManager 2014-01-26 01:12:18 -05:00
ShadowNinja
76d4396fa1 Pass pointed_thing to on_punch and minetest.register_on_punchnode callbacks 2014-01-23 19:21:56 -05: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
ShadowNinja
0fd5c61c00 Revert "Improve (re)spawn, add cache_block_before_spawn and max_spawn_height settings"
The commit didn't work because the blocks weren't loaded yet.

This reverts commit 22dbbf0a6fc9547f0dbdb7f6076337b8c6acd48b.

Conflicts:
	minetest.conf.example
2014-01-06 21:25:10 -05: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
2902a29c2d Initialize world before creating BanManager and RollbackManager 2013-12-30 14:29:33 -05:00
sapier
e9e9fd7c3f Replace SimpleThread by JThread now implementing same features 2013-12-15 13:39:42 +01:00
kwolekr
7a4c1e7327 Update mapgen params in ServerMap after Mapgen init 2013-12-14 10:49:20 -05:00