[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnunet-nim] 20/61: let's try out ports and channels
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnunet-nim] 20/61: let's try out ports and channels |
Date: |
Sat, 13 Apr 2019 13:35:55 +0200 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository gnunet-nim.
commit 4b7a974c085cf6791c12e9970439cced5a3d1c53
Author: lurchi <address@hidden>
AuthorDate: Sun Jul 29 20:01:49 2018 +0200
let's try out ports and channels
---
asynccadet.nim | 1 +
gnunet_nim.nim | 10 ++++++----
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/asynccadet.nim b/asynccadet.nim
index 171382a..1d4366a 100644
--- a/asynccadet.nim
+++ b/asynccadet.nim
@@ -100,6 +100,7 @@ proc openPort*(handle: var CadetHandle, port: string): ref
CadetPort =
proc closePort*(handle: var CadetHandle, port: ref CadetPort) =
GNUNET_CADET_close_port(port.handle)
+ port.channels.complete()
handle.openPorts.delete(handle.openPorts.find(port))
proc createChannel*(handle: CadetHandle, peer: string, port: string):
CadetChannel =
diff --git a/gnunet_nim.nim b/gnunet_nim.nim
index bfeff69..65cf0a6 100644
--- a/gnunet_nim.nim
+++ b/gnunet_nim.nim
@@ -7,10 +7,12 @@ proc firstTask(gnunetApp: ref GnunetApplication) {.async.} =
var cadet = await gnunetApp.connectCadet()
echo "connected"
let port = cadet.openPort("test")
- let channel = await port.channels.read()
- echo "incoming connection!"
- let message = await channel.messages.read()
- echo "got message: ", message
+ let (finished, channel) = await port.channels.read()
+ if not finished:
+ echo "incoming connection!"
+ let (finished, message) = await channel.messages.read()
+ if not finished:
+ echo "got message: ", message
cadet.disconnect()
echo "disconnected"
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [gnunet-nim] 02/61: initial commit, (continued)
- [GNUnet-SVN] [gnunet-nim] 02/61: initial commit, gnunet, 2019/04/13
- [GNUnet-SVN] [gnunet-nim] 03/61: add sample gnunet config, gnunet, 2019/04/13
- [GNUnet-SVN] [gnunet-nim] 05/61: .gitignore: fix typo, gnunet, 2019/04/13
- [GNUnet-SVN] [gnunet-nim] 04/61: .gitignore: ignore the main binary, and nim_cache directory, gnunet, 2019/04/13
- [GNUnet-SVN] [gnunet-nim] 01/61: license for lurchi's code, gnunet, 2019/04/13
- [GNUnet-SVN] [gnunet-nim] 06/61: .gitignore: fix syntax error, gnunet, 2019/04/13
- [GNUnet-SVN] [gnunet-nim] 07/61: add asynccadet code (does not compile yet), gnunet, 2019/04/13
- [GNUnet-SVN] [gnunet-nim] 19/61: make the cleanup proc the finalizer (no explicit call necessary anymore), gnunet, 2019/04/13
- [GNUnet-SVN] [gnunet-nim] 13/61: connection to cadet service successful, gnunet, 2019/04/13
- [GNUnet-SVN] [gnunet-nim] 15/61: use the bundled gnunet.conf, gnunet, 2019/04/13
- [GNUnet-SVN] [gnunet-nim] 20/61: let's try out ports and channels,
gnunet <=
- [GNUnet-SVN] [gnunet-nim] 11/61: make cadetConnect an async proc, gnunet, 2019/04/13
- [GNUnet-SVN] [gnunet-nim] 39/61: add shutdown procedure, gnunet, 2019/04/13
- [GNUnet-SVN] [gnunet-nim] 30/61: gitignore: add gnunet generated files and folders, gnunet, 2019/04/13
- [GNUnet-SVN] [gnunet-nim] 27/61: cli option: add option to specify gnunet config, gnunet, 2019/04/13
- [GNUnet-SVN] [gnunet-nim] 14/61: don't use AsyncEvent but store Futures in GnunetApplication, gnunet, 2019/04/13
- [GNUnet-SVN] [gnunet-nim] 22/61: we get notified about an incoming CADET channel (and then we crash), gnunet, 2019/04/13
- [GNUnet-SVN] [gnunet-nim] 24/61: command line parsing; application code for creating channel, gnunet, 2019/04/13
- [GNUnet-SVN] [gnunet-nim] 17/61: Merge branch 'master' of ssh://gnunet.org/gnunet-nim, gnunet, 2019/04/13
- [GNUnet-SVN] [gnunet-nim] 16/61: disconnect after connecting (shuts down the application), gnunet, 2019/04/13
- [GNUnet-SVN] [gnunet-nim] 12/61: fix segfaults using heap allocation, gnunet, 2019/04/13