diff --git a/internal/net/ping.go b/internal/net/ping.go index 40caefa..0414df8 100644 --- a/internal/net/ping.go +++ b/internal/net/ping.go @@ -58,12 +58,17 @@ func Ping(ctx context.Context, ip net.IP) (bool, error) { } defer conn.Close() + err = conn.SetWriteDeadline(time.Now().Add(5 * time.Second)) + if err != nil { + return false, err + } + _, err = conn.WriteTo(msgBytes, &net.IPAddr{IP: ip}) if err != nil { return false, err } - err = conn.SetReadDeadline(time.Now().Add(1 * time.Second)) + err = conn.SetReadDeadline(time.Now().Add(5 * time.Second)) if err != nil { return false, err } @@ -90,7 +95,7 @@ func Ping(ctx context.Context, ip net.IP) (bool, error) { } var pingDialer = &net.Dialer{ - Timeout: 1 * time.Second, + Timeout: 2 * time.Second, } // PingWithTCPFallback pings the IP address using ICMP and TCP fallback. diff --git a/internal/proxmox/lxc.go b/internal/proxmox/lxc.go index a3b9035..fde5b57 100644 --- a/internal/proxmox/lxc.go +++ b/internal/proxmox/lxc.go @@ -42,9 +42,6 @@ const ( ) func (n *Node) LXCAction(ctx context.Context, vmid int, action LXCAction) error { - ctx, cancel := context.WithTimeout(ctx, proxmoxReqTimeout) - defer cancel() - var upid proxmox.UPID if err := n.client.Post(ctx, fmt.Sprintf("/nodes/%s/lxc/%d/status/%s", n.name, vmid, action), nil, &upid); err != nil { return err