From 811c5f66aec23f62afc518bc49fcfda397d43490 Mon Sep 17 00:00:00 2001 From: cheatfate Date: Wed, 30 Oct 2019 00:40:02 +0200 Subject: [PATCH] More *nix fixes. --- chronos/transports/datagram.nim | 9 +++++---- chronos/transports/osnet.nim | 16 ++++++++-------- chronos/transports/stream.nim | 6 ------ 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/chronos/transports/datagram.nim b/chronos/transports/datagram.nim index 30cd049..93500f3 100644 --- a/chronos/transports/datagram.nim +++ b/chronos/transports/datagram.nim @@ -69,10 +69,6 @@ template setReadError(t, e: untyped) = (t).state.incl(ReadError) (t).error = getTransportOsError(e) -template setWriterWSABuffer(t, v: untyped) = - (t).wwsabuf.buf = cast[cstring](v.buf) - (t).wwsabuf.len = cast[int32](v.buflen) - proc setupDgramTransportTracker(): DgramTransportTracker {.gcsafe.} proc getDgramTransportTracker(): DgramTransportTracker {.inline.} = @@ -106,6 +102,11 @@ proc setupDgramTransportTracker(): DgramTransportTracker {.gcsafe.} = addTracker(DgramTransportTrackerName, result) when defined(windows): + + template setWriterWSABuffer(t, v: untyped) = + (t).wwsabuf.buf = cast[cstring](v.buf) + (t).wwsabuf.len = cast[int32](v.buflen) + const IOC_VENDOR = DWORD(0x18000000) SIO_UDP_CONNRESET = DWORD(winlean.IOC_IN) or IOC_VENDOR or DWORD(12) diff --git a/chronos/transports/osnet.nim b/chronos/transports/osnet.nim index ec3659c..8a0d7d3 100644 --- a/chronos/transports/osnet.nim +++ b/chronos/transports/osnet.nim @@ -342,15 +342,15 @@ when defined(linux): NETLINK_ROUTE = cint(0) NLMSG_ALIGNTO = 4'u RTA_ALIGNTO = 4'u - RTA_UNSPEC = 0'u16 + # RTA_UNSPEC = 0'u16 RTA_DST = 1'u16 - RTA_SRC = 2'u16 - RTA_IIF = 3'u16 + # RTA_SRC = 2'u16 + # RTA_IIF = 3'u16 RTA_OIF = 4'u16 RTA_GATEWAY = 5'u16 - RTA_PRIORITY = 6'u16 + # RTA_PRIORITY = 6'u16 RTA_PREFSRC = 7'u16 - RTA_METRICS = 8'u16 + # RTA_METRICS = 8'u16 RTM_F_LOOKUP_TABLE = 0x1000 @@ -364,9 +364,9 @@ when defined(linux): IFLIST_REPLY_BUFFER = 8192 InvalidSocketHandle = SocketHandle(-1) NLMSG_DONE = 0x03 - NLMSG_MIN_TYPE = 0x10 + # NLMSG_MIN_TYPE = 0x10 NLMSG_ERROR = 0x02 - MSG_TRUNC = 0x20 + # MSG_TRUNC = 0x20 IFLA_ADDRESS = 1 IFLA_IFNAME = 3 @@ -375,7 +375,7 @@ when defined(linux): IFA_ADDRESS = 1 IFA_LOCAL = 2 - IFA_BROADCAST = 4 + # IFA_BROADCAST = 4 # ARPHRD_NETROM = 0 ARPHRD_ETHER = 1 diff --git a/chronos/transports/stream.nim b/chronos/transports/stream.nim index 4a2982e..657d4de 100644 --- a/chronos/transports/stream.nim +++ b/chronos/transports/stream.nim @@ -974,12 +974,6 @@ when defined(windows): else: import ../sendfile - template initBufferStreamVector(v, p, n, t: untyped) = - (v).kind = DataBuffer - (v).buf = cast[pointer]((p)) - (v).buflen = int(n) - (v).writer = (t) - proc isConnResetError(err: OSErrorCode): bool {.inline.} = result = (err == OSErrorCode(ECONNRESET)) or (err == OSErrorCode(EPIPE))