Commit graph

63 commits

Author SHA1 Message Date
weihuoya adac0d193b reduce network latency 2021-07-04 23:06:13 +08:00
Johel Ernesto Guerrero Peña f8eb4b7edc fix(net): prevent gibberish padding on linux 2021-03-30 08:55:58 -04:00
Hamish Milne 9cd669db84 Merge branch 'master' into feature/savestates-2 2020-04-16 19:03:49 +01:00
Marshall Mohror d5a435fdf0
Merge pull request #5162 from tbsp/log_user_ips
Added user IP to log events for join/left/kicked/banned
2020-04-13 12:05:42 -05:00
Hamish Milne 828f88d20a Merge branch 'master' into feature/savestates-2 2020-04-12 11:24:06 +01:00
Subv d17557c02c Warnings/Network: Initialize the members of Room::RoomImpl in the order they are defined. 2020-04-11 12:24:09 -05:00
Subv 7903f6fbfc Warnings/Network: Handle ENET_EVENT_TYPE_NONE and ENET_EVENT_TYPE_CONNECT in the network packet loop.
ENET_EVENT_TYPE_NONE is basically a no-op.

ENET_EVENT_TYPE_CONNECT should not happen since we are already connected. Assert in case we do receive it.
2020-04-11 12:23:57 -05:00
tbsp 7b93b51040 Added user IP to log events for join/left/kicked/banned 2020-04-01 08:09:28 -07:00
Hamish Milne 6760ea18b6 Serialize ArchiveManager and other code review actions 2020-03-29 18:56:25 +01:00
Hamish Milne f5e2f873b0 Serialize NWM service 2020-02-13 17:41:24 +08:00
vvanelslande db1b0a1964 network/room: add message/join/leave/kick/ban/unban/game name logging 2019-11-03 09:55:38 -05:00
zhupengfei 698b471074
network/room_member: Silence -Wswitch warning
This causes lots of warnings. Adding the Uninitialized case solves this
2019-08-20 22:23:32 +08:00
Jack Harper cb455fd410 Added default case for GetErrorStr, removed useless const declaration in header 2019-07-23 23:24:38 +01:00
Weiyi Wang 2bbbfa86d8 network/room_member: in-header function should be inline
Otherwise produces multpile definition in translation units and generates unused warnings
2019-07-14 14:01:13 -04:00
Lioncash 21c71d21ae general: Use deducation guides for std::lock_guard and std::unique_lock
Since C++17, the introduction of deduction guides for locking facilities
means that we no longer need to hardcode the mutex type into the locks
themselves, making it easier to switch mutex types, should it ever be
necessary in the future.
2019-04-07 15:14:29 +02:00
Weiyi Wang 895936360b network: remove cpp-jwt library dependency
This is not used anywhere in in the module
2018-12-31 23:23:09 -05:00
zhupengfei 13ec2abbf6
network: Make citra mods optional and disabled by default
To avoid extra legal responsibility, this should actually only be used on our self-hosted rooms.
2018-12-15 22:47:07 +08:00
zhupengfei 9d062d63da
network, citra_qt: Give moderation permission to community mods
Based on the `roles` payload in the JWT, the rooms will now give mod permission to Citra Community Moderators. To notify the client of its permissions, a new response, IdJoinSuccessAsMod is added, and there's now a new RoomMember::State called Moderator.
2018-12-15 20:28:03 +08:00
zhupengfei 94be4050bc
network/packet: Fix reading vectors/arrays of strings
Previously would break here, as it is trying to initialize a string with 0, which is then considered NULL.
2018-12-15 14:37:23 +08:00
zhupengfei 7acd2664dd
network/room_member: Add moderation functions
To allow for passing moderation errors around without impacting the State, this commit also separates the previous State enum into two enums: State, and Error. The State enum now only contains generic states like disconnected or connected, and the Error enum describes the specific error happened.

citra_qt/multiplayer/{state, message} is changed accordingly.
2018-12-15 11:03:31 +08:00
zhupengfei 38f86cce94 network/room: Moderation implementation
Currently consist of 4 moderation commands (kick, ban, unban and get ban list).
2018-12-15 11:03:28 +08:00
zhupengfei 0319e51960 multiplayer: Add status message for user joining/leaving
The room server is now able to send a new type of packet: IdStatusMessage which is parsed and displayed by the client.
2018-12-15 11:03:06 +08:00
zhupengfei 1a8841f96e
network, web_service: Add Verification backend and use new lobby API
Added verify_backend to load user_data for members. and removed method to generate UID as this is now done server-side.

Added GetUsername function and a "token" param to room_member.
Also added a username to ChatEntry, so that the username can be shown (along with nicknames) in the chat dialog.
2018-12-15 11:02:51 +08:00
adityaruplaha 5f0e189238
Add Support for Room Descriptions 2018-12-15 11:02:50 +08:00
zhupengfei c396e3c6e5 network: check Console ID conflicts
As Console ID can be sensitive data sometimes, this implementation sent a SHA256 hash of it instead.
2018-12-15 11:02:47 +08:00
zhupengfei 3c589f473f
multiplayer: check nickname regex server side 2018-12-15 10:40:27 +08:00
James Rowe e040bc9355
Multiplayer: Send an error message when connecting to a full room 2018-12-15 10:40:26 +08:00
zhupengfei a9c9ffd32c
network: bump multiplayer version 2018-12-15 10:40:25 +08:00
Pengfei Zhu 0d2c027a9d
Merge pull request #4191 from valentinvanelslande/minor-fix
room_member: RakNet -> ENet
2018-09-08 10:05:33 +08:00
Valentin Vanelslande c29c66000e
room_member: RakNet -> ENet 2018-09-07 20:17:24 -05:00
Valentin Vanelslande fc876e727a
room_member: fix 3 typos 2018-09-07 20:12:52 -05:00
Weiyi Wang 7d8f115185 Prefix all size_t with std::
done automatically by executing regex replace `([^:0-9a-zA-Z_])size_t([^0-9a-zA-Z_])` -> `$1std::size_t$2`
2018-09-06 16:03:28 -04:00
Valentin Vanelslande 2c31bd1a52
network: fix 3 typos 2018-08-12 17:55:15 -05:00
Weiyi Wang 1b1439c6af NWM_UDS: use sizeof(<var being used>) instead of hard-coded type (#4093)
* NWM_UDS: use sizeof(<var being used>) instead of hard-coded type

Intend to fix #4090. 

` node_map.node.second` type was changed to `u16` in #3985. However the type change wasn't reflected here. Should have used variable name instead to automatically do type change

* NWM_UDS: ... and also the node.first one

* NWM_UDS: ... and here

* Network: bump version because we changed UDS packet layout

* Update nwm_uds.cpp
2018-08-12 22:47:48 +02:00
zhupengfei 76465dd0f5
citra_qt: retranslate status bar 2018-07-24 19:20:00 +08:00
wwylele 0eab948728 reformat all files with clang-format 2018-06-29 16:56:12 +03:00
wwylele 7c5a76e58b log: replace all NGLOG with LOG 2018-06-29 14:18:07 +03:00
James Rowe d35693bbbc More minor issue fixes
* Move Joining state change sooner in the code to prevent an issue where
failing to connect multiple times in a row doesn't change the state (as
it goes from CouldNotConnect -> CouldNotConnect which doesn't trigger a
state changed callback)
* Prevent double clicking too fast on a room in the lobby from causing
issues
* Lobby no longer closes when joining a room
2018-04-19 10:28:19 -06:00
Ben 4be12d5f56 NWM_UDS:: Check flags in SendTo (#3481)
* NWM_UDS:: Check flags in SendTo

* NWM_UDS: SendTo from Host to only oneClient

* fix u8 in flags

* Send node_map to clients

* Libnetwork: Increase libnetwork version

* Broadcast on dest_node_id 0xFFFF

* fixup: dest_node_id offset

* fixup: dest_node_id offset part 2

* Adressed wwyleles feedback

* Adressed wwylele's nits
2018-03-27 15:01:29 +03:00
Daniel Lim Wee Soong 3e8e011c33 network: Migrate logging macros (#3575)
* network: Migrate logging macros

Follow-up of #3533

Replace prefix of all logging macros from LOG to NGLOG

* Remove hash in format
2018-03-27 12:00:14 +01:00
B3n30 fd20c8c321 remove MacAddressToString 2018-03-13 11:00:05 +01:00
B3n30 b6d52f0299 Fix formatting of mac address in error log 2018-03-13 10:52:44 +01:00
James a2b65f0669 Correctly cleanup ENet packets if not used
This additionally adds logging when bad MAC addresses are found when transferring packets between clients
2018-03-12 01:38:54 +11:00
Lioncash ab021d163e CMakeLists: Derive the source directory grouping from targets themselves
Removes the need to store to separate SRC and HEADER variables,
and then construct the target in most cases.
2017-12-11 21:11:52 -05:00
bunnei d00b17eb43
Merge pull request #3162 from lioncash/packet
packet: Simplify operator bool overload
2017-11-29 10:41:13 -05:00
Lioncash 94999bde5b room/room_member: Silence -Wswitch warnings 2017-11-28 21:09:53 -05:00
Lioncash 0a988e07cb packet: Simplify operator bool overload
Previously this would cause a -Wnull-conversion warning
2017-11-28 21:00:24 -05:00
B3n30 c0a7afaa5c
Libnetwork: add password protected rooms, guid, and error fixes (#3068)
* Network: Add password protected roomsand GUID

* Limit chat message size
2017-11-19 19:52:37 +01:00
Huw Pascoe a13ab958cb Fixed type conversion ambiguity 2017-09-30 09:34:35 +01:00
B3n30 5d0a1e7efd Added missing parts in libnetwork (#2838)
* Network: Set and send the game information over enet

Added Callbacks for RoomMember and GetMemberList to Room in preparation for web_services.
2017-08-19 11:14:33 -06:00