551 Commits

Author SHA1 Message Date
Loic Blot
c4fd521797 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
b6a8f1e7c4 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
1186245881 Remove Queue class which uses std::list and use native std::queue 2015-03-05 16:49:51 +10:00
Loic Blot
a921830829 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
fa9145128a 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
61ffd65f26 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
705390e1f4 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
c468ca4821 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
e14b94eb22 Remove unused m_wielded_item_not_sent 2015-03-03 17:36:54 +01:00
Loic Blot
ee42254b45 Send Breath packet on event, don't check it at each AsyncRunStep 2015-03-03 16:33:20 +01:00
Loic Blot
14e866c4a6 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
12d7ac0fec Fix some memory leaks on packet sending. 2015-02-21 17:27:31 +01:00
Loic Blot
2fd9ac5fe9 Move hex.h to util/ 2015-02-21 14:32:35 +01:00
Loic Blot
d311a338ac Move sha1.hpp and base64.hpp to util/ 2015-02-21 14:03:27 +01:00
Loic Blot
ad693a80de 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
416ba2b408 [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
5700d0cf61 Replace getPlayer(playername) by getPlayer(peer_id) in some possible cases. ok @Zeno- 2015-02-10 16:03:16 +01:00
Loic Blot
d80a529d34 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
9e38d47e63 Give full breath after death 2015-02-05 17:33:08 +10:00
Loic Blot
306b69dbdd 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
676975f236 Fix uninitialized variable Server::m_next_sound_id 2015-01-24 06:44:41 +01:00
ShadowNinja
27d6dda4f9 Send real port to server list 2015-01-23 21:38:34 +10:00
onkrot
c91dbf8ad2 Performance fixes. 2015-01-13 23:48:56 +10:00
kwolekr
bcf72f8481 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
15534081d3 Fix map parameter load order 2014-12-30 12:30:42 -05:00
kwolekr
eb208e6b75 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
0865261409 Fix -Wtype-limits warnings and remove disabling of -Wtype-limits 2014-12-29 23:56:40 +10:00
kwolekr
2aa53ba603 Redefine NodeResolver interface and replace with callback mechanism 2014-12-27 02:12:21 -05:00
Anton
420b5ec08c Use std::string::empty() instead of size() where applicable 2014-12-12 15:16:24 -05:00
Craig Robbins
a23abf117a Fix typo in mapblock.h 2014-12-12 20:46:37 +10:00
Muhammad Rifqi Priyo Susanto
df505181a6 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
416c5c8339 Clean up rollback 2014-11-19 16:21:59 -05:00
Craig Robbins
aacc3cba46 Remove most exceptions from getNode() (and variants) 2014-11-14 18:05:34 +10:00
Kahrl
ac7626b620 Serverlist: announce mg_name from map_meta.txt instead of minetest.conf 2014-11-10 22:27:10 +01:00
SmallJoker
98e648368f Replace setting unlimited_player_transfer_distance with player_transfer_distance 2014-11-08 14:56:09 +01:00
kwolekr
08068ac0c6 Split up mapgen.cpp 2014-11-01 13:16:23 -04:00
kwolekr
4f31a0ef47 Add NodeResolver and clean up node name -> content ID resolution system 2014-10-26 23:55:45 -04:00
RealBadAngel
8ddf8a4022 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
b95caf17ad Make players check inventory modification properly 2014-10-01 18:44:36 -04:00
ShadowNinja
4d2318b576 Simplify player modification checks 2014-10-01 18:44:36 -04:00
ShadowNinja
28aad10dce Fix locking bugs and make inventory deserialization errors more specific 2014-09-21 14:39:36 -04:00
sapier
28b57f8d44 Fix to to too two times 2014-08-22 21:51:20 +02:00
sapier
4dc407a486 Add player name length checks 2014-08-22 21:18:43 +02:00
sapier
c1a0391b66 Fix "ghost" blocks if block update is "on wire" while player digs nodes 2014-08-22 20:56:16 +02:00
sapier
a50bacdc3a Don't call a player event without having player to do a event for 2014-08-21 17:29:26 +02:00
sapier
339c819cfa 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
d4561d6e72 Fix serverlist code style, const-correctness, and types 2014-06-30 13:26:02 -04:00
sapier
a93520b209 Don't spam server console on player/playersao error but just drop the affected client 2014-06-29 17:55:21 +02:00
sapier
1f88af3b7a Add formspec api versioning 2014-06-29 12:13:55 +02:00
kwolekr
a6c161d69f Add prefixes to enum values and fix style issues 2014-06-28 02:02:38 -04:00