From 02c27c95a1bc41cd933633b6269b4781e4bf9881 Mon Sep 17 00:00:00 2001 From: cheatfate Date: Sat, 27 Oct 2018 16:14:55 +0300 Subject: [PATCH] Add some deprecation routines. --- asyncdispatch2/transports/common.nim | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/asyncdispatch2/transports/common.nim b/asyncdispatch2/transports/common.nim index dbe96201..d16a74c1 100644 --- a/asyncdispatch2/transports/common.nim +++ b/asyncdispatch2/transports/common.nim @@ -9,6 +9,7 @@ from net import IpAddressFamily, IpAddress, `$`, parseIpAddress import os, strutils, nativesockets import ../asyncloop +export IpAddressFamily when defined(windows): import winlean @@ -425,6 +426,22 @@ proc resolveTAddress*(address: string, port: Port, it = it.ai_next freeAddrInfo(aiList) +proc resolveTAddress*(address: string, + family: IpAddressFamily): seq[TransportAddress] {. + deprecated.} = + if family == IpAddressFamily.IPv4: + result = resolveTAddress(address, AddressFamily.IPv4) + elif family == IpAddressFamily.IPv6: + result = resolveTAddress(address, AddressFamily.IPv6) + +proc resolveTAddress*(address: string, port: Port, + family: IpAddressFamily): seq[TransportAddress] {. + deprecated.} = + if family == IpAddressFamily.IPv4: + result = resolveTAddress(address, port, AddressFamily.IPv4) + elif family == IpAddressFamily.IPv6: + result = resolveTAddress(address, port, AddressFamily.IPv6) + template checkClosed*(t: untyped) = if (ReadClosed in (t).state) or (WriteClosed in (t).state): raise newException(TransportError, "Transport is already closed!")