Add some deprecation routines.

This commit is contained in:
cheatfate 2018-10-27 16:14:55 +03:00
parent 774269f2f0
commit 02c27c95a1
1 changed files with 17 additions and 0 deletions

View File

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