Remove deprecated modules (asyncio, sockets, ftpclient) (#10401)

This commit is contained in:
Miran
2019-01-22 16:06:44 +01:00
committed by GitHub
parent 54fecdb8df
commit 0ebfcd4c0f
11 changed files with 61 additions and 3187 deletions

View File

@@ -1,7 +1,7 @@
discard """
output: "5000"
"""
import asyncdispatch, nativesockets, net, strutils, os
import asyncdispatch, asyncnet, nativesockets, net, strutils, os
var msgCount = 0
@@ -12,20 +12,22 @@ const
var clientCount = 0
proc sendMessages(client: AsyncFD) {.async.} =
for i in 0 .. <messagesToSend:
for i in 0 ..< messagesToSend:
await send(client, "Message " & $i & "\c\L")
proc launchSwarm(port: Port) {.async.} =
for i in 0 .. <swarmSize:
var sock = newAsyncNativeSocket()
for i in 0 ..< swarmSize:
var sock = createAsyncNativeSocket()
await connect(sock, "localhost", port)
await sendMessages(sock)
closeSocket(sock)
proc readMessages(client: AsyncFD) {.async.} =
# wrapping the AsyncFd into a AsyncSocket object
var sockObj = newAsyncSocket(client)
while true:
var line = await recvLine(client)
var line = await recvLine(sockObj)
if line == "":
closeSocket(client)
clientCount.inc
@@ -37,7 +39,7 @@ proc readMessages(client: AsyncFD) {.async.} =
doAssert false
proc createServer(port: Port) {.async.} =
var server = newAsyncNativeSocket()
var server = createAsyncNativeSocket()
block:
var name: Sockaddr_in
name.sin_family = toInt(AF_INET).uint16

View File

@@ -9,7 +9,7 @@ type
AsyncScgiState* = object of RootObj ## SCGI state object
#bug #442
import sockets, asyncio, strtabs
import asyncnet, strtabs
proc handleSCGIRequest[TScgi: ScgiState | AsyncScgiState](s: TScgi) =
discard
proc handleSCGIRequest(client: AsyncSocket, headers: StringTableRef,

View File

@@ -1,3 +1,6 @@
discard """
disabled: true
"""
# This is a regression of the new lambda lifting; detected by Aporia
import asyncio, sockets

View File

@@ -1,4 +1,4 @@
import genpacket_enet, sockets, md5, enet
import genpacket_enet, nativesockets, net, md5, enet
defPacketImports()
type

View File

@@ -5,7 +5,7 @@ discard """
"""
import events
import sockets
import net
import strutils
import os