More *nix fixes.

This commit is contained in:
cheatfate 2019-10-30 00:40:02 +02:00
parent fb00b20cfa
commit 811c5f66ae
No known key found for this signature in database
GPG Key ID: 46ADD633A7201F95
3 changed files with 13 additions and 18 deletions

View File

@ -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)

View File

@ -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

View File

@ -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))