#3575 closed enhancement (fixed)
[PATCH] Allow hosting on different UDP ports
Reported by: | elexis | Owned by: | Imarok |
---|---|---|---|
Priority: | Nice to Have | Milestone: | Alpha 21 |
Component: | Network | Keywords: | patch |
Cc: | Patch: |
Description
It would be nice to be able to host on different UDP ports.
Once we have dedicated servers (#3556), we could host multiple games simultaneously on a single server with a single IP address.
To be done for this ticket:
- Hosting players entering the gamesetup in lobbygames need to send the port they use to the lobby server
- The lobby bot needs to send the port in the gamelist
- Players that want to join a lobbied game need to use this port when joining
If we could do this in a19, then we could use the dedicated server after the release. Besides allowing users to play that don't find a server to join and can't host (#2305), it would also allow us to switch from a free-for-all lobby to a lobby with only certified hosts. This means that potentially malicious players won't be able to see the IP addresses of other players (they will only be able to see the IPs of the certified hosts, which might be a single wfg server in harsh times).
Attachments (7)
Change History (18)
comment:1 by , 8 years ago
Component: | Core engine → Network |
---|
comment:3 by , 8 years ago
Owner: | set to |
---|
by , 8 years ago
Attachment: | 3575_differentPorts.patch added |
---|
comment:4 by , 8 years ago
Keywords: | review patch added |
---|---|
Summary: | Allow hosting on different UDP ports → [PATCH] Allow hosting on different UDP ports |
by , 8 years ago
Attachment: | 3575_differentPorts_v2.1.patch added |
---|
using u16 instead of unsigned int. Allow to save and restore the port
by , 8 years ago
Attachment: | 3575_differentPorts_v2.3.patch added |
---|
Retrieve default port from c++ part. New lines for SwitchGuiPage
by , 8 years ago
Attachment: | 3575_differentPorts_v2.5.patch added |
---|
use only u16. Added tooltip for port input field. Only allow valid ports
comment:6 by , 8 years ago
Milestone: | Backlog → Alpha 21 |
---|
by , 8 years ago
Attachment: | wip.v1.patch added |
---|
(This was the mentioned wip patch from november 2015 on which the patch above was based on)
comment:9 by , 8 years ago
Keywords: | review removed |
---|---|
Type: | defect → enhancement |
Thanks picking this up and finishing the patch! Here the things changed:
Ports:
- Port 0: doesn't work on linux here, neither on your windows machine as you mentioned. Here an article about tcp port 0 and why it isn't a valid port: http://www.lovemytool.com/blog/2013/08/the-strange-history-of-port-0-by-jim-macleod.html Some OS use this port as a wildcard to return a randomized port. For these reasons port 0 will be disabled for now.
- Unix port < 1024:
Philip is right, on most unix systems you can't host on ports < 1024 without root rights.
To run with root permissions, a check from
main.cpp
needs to be removed. To allow retries comfortably, #4035 was implemented.
GUI:
- The GUI object positions are ugly. The port is shown in the wrong place (vertical space between two fields).
Since only one of the two host wrapper things can be shown simultaneously, they can have the same position.
The port field can be placed below that.
In the future the
resizeMoreOptionsWindow
fromgamesetup.js
might be reused.
- Showing the
hostPortWrapper
is not necessary. The other GUI objects only have a wrapper because their visbility depends on whether it's a lobby game or not. Therefore the GUI object should only be added to get cleaner XML, but it's not necessary otherwise (thus removing the name and the hidden attribute).
- All labels are placed wrong (4px vertical), not the fault of this patch though.
Port validation:
getValidPort
should be moved tonetwork.js
and useisNaN
- Not convinced we need the
translate("The game's port is missing.")
error for the lobby. Just replace with default like everywhere else. - Added calls to validate the port and optionally replace it with the default on load or when pressed enter.
C++:
- Switched the server and port argument of
NetSession
and usedconst
for consistency.
comment:10 by , 7 years ago
Was this done in this ticket? (I couldn't find any modifications to the lobby bot in the commits here)
To be done for this ticket:
- Hosting players entering the gamesetup in lobbygames need to send the port they use to the lobby server
- The lobby bot needs to send the port in the gamelist
- Players that want to join a lobbied game need to use this port when joining
(set component to network)