dreamscached / MineQuery

📡 Minecraft Server List Ping library written in Go
https://pkg.go.dev/github.com/dreamscached/minequery/v2
MIT License
27 stars 4 forks source link

sendServerListPing does not use timeout #23

Closed AlexanderMatveev closed 2 years ago

AlexanderMatveev commented 2 years ago

So if server doesn't respond, we just staying locked.

See https://github.com/alteamc/minequery/blob/0902c57917dc366ee7e8fe4750c73942234f3b83/ping/ping.go#L16

// PingWithTimeout performs a Server List Ping interaction with modern (1.7 and newer) Minecraft server running on the specified host and the specified port with
// read and write timeout.
func PingWithTimeout(host string, port uint16, timeout time.Duration) (*Response, error) {
    // ...
    res, err := sendServerListPing(conn, host, port)
    if err != nil {
        return nil, fmt.Errorf("ping error: %w", err)
    }
        // ...
}