From e7f5f855ab0e802a46ac26fd05bc0e417c76ab5d Mon Sep 17 00:00:00 2001 From: Jacek Sieka Date: Tue, 2 Feb 2021 15:12:12 +0100 Subject: [PATCH] use constant for ip kind (#151) IPV6_MULTICAST_HOPS already declared in posix.nim while IP_MULTICAST_TTL has a value that will stay constant on linux/x86_64 - better codegen and nlvm compat like this. --- chronos/transports/datagram.nim | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/chronos/transports/datagram.nim b/chronos/transports/datagram.nim index 4333123..f3f2eb4 100644 --- a/chronos/transports/datagram.nim +++ b/chronos/transports/datagram.nim @@ -15,10 +15,11 @@ when defined(windows): import winlean else: import posix - var IP_MULTICAST_TTL* {.importc: "IP_MULTICAST_TTL", - header: "".}: cint - var IPV6_MULTICAST_HOPS* {.importc: "IPV6_MULTICAST_HOPS", - header: "".}: cint + when (defined(linux) and not defined(android)) and defined(amd64): + const IP_MULTICAST_TTL: cint = 33 + else: + var IP_MULTICAST_TTL* {.importc: "IP_MULTICAST_TTL", + header: "".}: cint type VectorKind = enum