-
-
Notifications
You must be signed in to change notification settings - Fork 239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Always ping server before initiating connection? #327
Comments
Made this change in examples/client_forge: 283b75d - but I think it'd be useful generically |
ping not doing DNS SRV is a bug. The ability to disable the SRV request isn't super useful in the 99.9999% scenario. The notchian client makes an SRV DNS request, we're just matching that. If someone wants to bypass it, he can just provide an already-created TCP stream to NMP (when we support that). IMO, createClient shouldn't call ping. The notchian client doesn't do that, for one. For two, some servers don't reply to pings. What you describe is a hack specific for the forge client, and I think should only belong to a future "nmp-forge" module. The overhead isn't negligeable (initiate a connection, handshake, ping, close connection) for something that people not connecting to forge (which should be most people) don't need at all. |
"ping not doing DNS SRV is a bug." Actually it does, connect is defined in On Sun, Jan 24, 2016, 14:03 Robin Lambertz [email protected] wrote:
|
Pinging before connecting could be an option in createClient, because it's On Sun, Jan 24, 2016, 14:28 Romain Beaumont [email protected] wrote:
|
If a server does not respond to Server List Ping, then how will it appear in the server list? Example of server that doesn't respond? update: edited src/createServer.js, commented out and then after some time "Can't connect to server": although you can still double-click to force connect |
Relevant: https://github.com/Dinnerbone/mcstatus |
I've seen some custom servers do that to put a server in some sort of On Sun, Jan 24, 2016, 5:15 PM deathcap [email protected] wrote:
|
One problem with synchronous createClient() is we don't necessarily know which client code to use before receiving the ping response. Supposedly it is safe to use Forge clients to connect to vanilla servers, so that's not a very big problem. The bigger issue is that for servers that do not respond to ping packets [1], the synchronous createClient() called before the ping will still continue executing -- i.e., a race condition. [1] PrismarineJS/node-minecraft-protocol#327 (comment)
Here's a working prototype along the lines of what I had in mind: https://github.com/deathcap/node-minecraft-protocol-auto Uses a ping to get the protocol version, enables Forge with mod list if server type='FML', and also automatically sets the client protocol version to match the server version. Works in testing a 1.9 snapshot, 1.8.9, some third-party 1.8 server software, and a Forge 1.8.9 server, but has some rough edges:
I haven't published node-minecraft-protocol-auto to NPM, I still think it would be a worthwhile addition to node-minecraft-protocol itself. Maybe not in |
This issue is well-covered by #234 so I'll close it, still would like to see this though =) |
ping(options, cb)
performs a Server List Ping using theSTATUS
protocol, returning a bunch of useful information, example:The version/protocol field could be useful for #234 Cross-version protocol support. Before initiating the connection, perform a ping to get the version and use it accordingly.
description
,favicon
, and other fields could also be saved for consultation later.FML/Forge servers #114 #326 additionally contain more information:
(modinfo.type is also returned on Glowstone++, 'BUKKIT' is a recognized type, to show the Bukkit logo in FML's server list screen. 'VANILLA' as well but not clear if anyone sends it.).
modList
is particularly useful because it gives the list of mods you must have in order to connect to the server. The FML|HS handshake protocol sends this list in the ModList packet, and if it doesn't match the server will kick the client, so the client would have to know it a priori unless retrieved from the Server List Ping.createClient()
already does perform one pre-connect action: resolving DNS srv (_minecraft._tcp) records. ping.js doesn't do this, but it probably should (bug? anyone want to test?). Server List Ping would be another reasonable pre-connect step to perform, imho. Real clients usually show a server list before the player connects, so this would more closely match vanilla behavior as well.Therefore here's the changes I suggest:
ping: false
?), if desired; probably ought to also havedns_srv: false
option to skip the pre-connect DNS resolution step. Some clients may want to skip these steps (and forgo the added benefits - no server description, automatic protocol negotiation, automatic Forge mod support), but I'd imagine most will want the useful default functionalityThe text was updated successfully, but these errors were encountered: