INNER CODE UNIT · Go
clientDetectReadDeadline
GoMudEngine/GoMud · main.go:610
clientDetectReadDeadline = 200 * time.Millisecond // per-read slice so we can re-check the budget
)
// detectClientType probes a raw telnet client with an MNES NEW-ENVIRON request
// and synchronously waits (with a bounded timeout) for the reply so the caller
// can choose the correct echo baseline before the first prompt is shown.
//
// Replies are fed through the normal input handler chain, where TelnetIACHandler
// performs the NEW-ENVIRON negotiation and records IsMudlet/DetectionComplete on
// the connection's client settings. The login handler is intentionally not in
// the chain yet, so stray pre-login input is simply buffered (not echoed) and is
// preserved for the main loop. On timeout the client defaults to non-Mudlet.
//
// AI connections skip the probe entirely and keep the historical raw-telnet
// baseline, so automated clients are not delayed by the detection window.
func detectClientType(connDetails *connections.ConnectionDetails, clientInput *connections.ClientInput, sharedState map[string]any) {
connId := connDetails.ConnectionId()