More deprecation warnings fixed.
This commit is contained in:
parent
1be06ee2de
commit
3ffff9ec43
2 changed files with 10 additions and 4 deletions
|
|
@ -232,7 +232,9 @@ when isMainModule:
|
||||||
# check for new new connection & handle it
|
# check for new new connection & handle it
|
||||||
var list: seq[TSocket] = @[server.socket]
|
var list: seq[TSocket] = @[server.socket]
|
||||||
if select(list, 10) > 0:
|
if select(list, 10) > 0:
|
||||||
var client = accept(server.socket)
|
var client: TSocket
|
||||||
|
new(client)
|
||||||
|
accept(server.socket, client)
|
||||||
try:
|
try:
|
||||||
acceptRequest(server, client)
|
acceptRequest(server, client)
|
||||||
except:
|
except:
|
||||||
|
|
|
||||||
|
|
@ -262,8 +262,9 @@ proc accept*(server: PAsyncSocket): PAsyncSocket {.deprecated.} =
|
||||||
## Equivalent to ``sockets.accept``.
|
## Equivalent to ``sockets.accept``.
|
||||||
##
|
##
|
||||||
## **Warning**: This is deprecated.
|
## **Warning**: This is deprecated.
|
||||||
var (client, a) = server.acceptAddr()
|
new(result)
|
||||||
return client
|
var address = ""
|
||||||
|
server.acceptAddr(result, address)
|
||||||
|
|
||||||
proc newDispatcher*(): PDispatcher =
|
proc newDispatcher*(): PDispatcher =
|
||||||
new(result)
|
new(result)
|
||||||
|
|
@ -435,7 +436,10 @@ when isMainModule:
|
||||||
|
|
||||||
proc testAccept(s: PAsyncSocket, arg: PObject) =
|
proc testAccept(s: PAsyncSocket, arg: PObject) =
|
||||||
echo("Accepting client! " & $PMyArg(arg).val)
|
echo("Accepting client! " & $PMyArg(arg).val)
|
||||||
var (client, address) = s.acceptAddr()
|
var client: PAsyncSocket
|
||||||
|
new(client)
|
||||||
|
var address = ""
|
||||||
|
s.acceptAddr(client, address)
|
||||||
echo("Accepted ", address)
|
echo("Accepted ", address)
|
||||||
client.handleRead = testRead
|
client.handleRead = testRead
|
||||||
var userArg: PIntType
|
var userArg: PIntType
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue