Fix deprecation warnings.

This commit is contained in:
cheatfate 2019-03-31 01:32:04 +02:00
parent f8dc3abe36
commit ab8b87be9a
No known key found for this signature in database
GPG Key ID: 46ADD633A7201F95
2 changed files with 6 additions and 6 deletions

View File

@ -673,7 +673,7 @@ proc newDaemonApi*(flags: set[P2PDaemonFlags] = {},
let res = await socketExists(api.address) let res = await socketExists(api.address)
if res: if res:
break break
await sleepAsync(500) await sleepAsync(500.milliseconds)
if Logging in api.flags: if Logging in api.flags:
api.loggerFut = loggingHandler(api) api.loggerFut = loggingHandler(api)
@ -683,7 +683,7 @@ proc newDaemonApi*(flags: set[P2PDaemonFlags] = {},
var peers = await listPeers(api) var peers = await listPeers(api)
if len(peers) >= peersRequired: if len(peers) >= peersRequired:
break break
await sleepAsync(1000) await sleepAsync(1.seconds)
result = api result = api

View File

@ -31,7 +31,7 @@ proc connectStreamTest(): Future[bool] {.async.} =
var stream = await api1.openStream(id2.peer, protos) var stream = await api1.openStream(id2.peer, protos)
let sent = await stream.transp.write(test & "\r\n") let sent = await stream.transp.write(test & "\r\n")
doAssert(sent == len(test) + 2) doAssert(sent == len(test) + 2)
var check = await wait(testFuture, 10000) var check = await wait(testFuture, 10.seconds)
doAssert(check == test) doAssert(check == test)
await stream.close() await stream.close()
await api1.close() await api1.close()
@ -119,7 +119,7 @@ proc pubsubTest(f: set[P2PDaemonFlags]): Future[bool] {.async.} =
var ticket1 = await api1.pubsubSubscribe("test-topic", pubsubHandler1) var ticket1 = await api1.pubsubSubscribe("test-topic", pubsubHandler1)
var ticket2 = await api2.pubsubSubscribe("test-topic", pubsubHandler2) var ticket2 = await api2.pubsubSubscribe("test-topic", pubsubHandler2)
await sleepAsync(2000) await sleepAsync(2.seconds)
var topics1 = await api1.pubsubGetTopics() var topics1 = await api1.pubsubGetTopics()
var topics2 = await api2.pubsubGetTopics() var topics2 = await api2.pubsubGetTopics()
@ -129,10 +129,10 @@ proc pubsubTest(f: set[P2PDaemonFlags]): Future[bool] {.async.} =
var peers2 = await api2.pubsubListPeers("test-topic") var peers2 = await api2.pubsubListPeers("test-topic")
if len(peers1) == 1 and len(peers2) == 1: if len(peers1) == 1 and len(peers2) == 1:
# Publish test data via api1. # Publish test data via api1.
await sleepAsync(500) await sleepAsync(500.milliseconds)
await api1.pubsubPublish("test-topic", msgData) await api1.pubsubPublish("test-topic", msgData)
var andfut = handlerFuture1 and handlerFuture2 var andfut = handlerFuture1 and handlerFuture2
await andfut or sleepAsync(10000) await andfut or sleepAsync(10.seconds)
await api1.close() await api1.close()
await api2.close() await api2.close()