[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: CADET: obtaining the channel closure
From: |
Christian Grothoff |
Subject: |
Re: CADET: obtaining the channel closure |
Date: |
Sun, 28 Jun 2020 11:26:51 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 |
Hi Aliessio,
I would assume that you are storing the 'struct GNUNET_CADET_Channel' in
one of your application's data structures. Simply store the closure in
the same data structure (or: make it that data structure -- that's
actually the usual design pattern to use).
That way, when _you_ call GNUNET_CADET_channel_destroy(), you can get
the closure from your data structure (just like you got the 'struct
GNUNET_CADET_Channel' from your data structure at that time).
If the other peer closes the channel, _then_ the DisconnectEventHandler
is called with your closure.
I hope this helps!
-Christian
On 6/27/20 3:40 PM, Alessio Vanni wrote:
> Hello,
>
> I have a service which opens CADET channels when a client requests them
> and "assigns" them to the client, so that each client can have a set of
> multiple channels opened. Of course clients can also request for the
> associated channels to be closed.
>
> When a channel is opened, a closure is passed to the create function
> containing some local informations, like which client requested its
> creation and so on. The closure is allocated dynamically with
> `GNUNET_new'.
>
> The problem I'm facing is that since this closure is local, when it's
> time to close the channel and free its associated resources, I have no
> way to obtain said closure. The handler called when a disconnect event
> happens is called correctly and I'm able to clean up there, but the
> documentation says that this function is not called when
> `GNUNET_CADET_channel_destroy' is called, which is used by the service
> to close down channels when requested or when the client disconnects.
>
> How can I get this closure so that I can free it when the channel is
> closed?
>
> Thanks,
> A.V.
>
signature.asc
Description: OpenPGP digital signature