Re: CADET: obtaining the channel closure
Christian Grothoff <[email protected]> Sun, 28 Jun 2020 11:26:51 +0200
| Newsgroups | gmane.network.gnunet.general |
|---|---|
| Message-ID | <[email protected]> |
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
(application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEE2EI7yzJseQcDOSnHk55r4eKfw8wFAl74YlwACgkQk55r4eKf w8yjIQ/+Mk4W7yLggja1akN1ecV4kXCWuobbew32Q2kpIhx/u4yw6ZEXTB6KuQB3 Xg/CuD9AStyIOLenB2Ho+pvNi14Z12SaBa9WPS2ZrMkqYTVdz3+zoHSHea0kTqNf KSeu73SQUCrpEu884G9v196aDgeQjywBvoX4j0HOKF5VsXnyH58Z7l7ZFdXyklz2 v00Zk1IqByEsgRYQXz9ped4ciGexWfyqzoDnPoN3xOCmDKvx3QXobPE6p2Xposyk 4yNxbNY1VI8HousBtYa30q3DIwweRkB4jWZF3q7mTd3tDEcz58+snDbrxaZucWj5 5os7Q5ku+HDX+LwvaY8Q/sbZuAyo78v6Z3gzwIanHo2yKjtiBAwUUGCz99K7cjDm A/9GOQVnIW3kR1KM8QRDFyJ5IKaUwxFHRThhBRC+mFZR0jew2Rvy8qxMUlLe/j3R vPArovrFVWN3yBIZVxXpshJBeS+HcTWD+ygLR5S+N37w3OdbkWmamFtq1SBtVkIb h6jI2Ea2ZiNYbAxLwzc0cem2wdiNfxczpu12oxaLkr1P6ieQuvjKe3yGZB0eeNtQ WhU31obmM1s9TJUKrSkJ0Z+1xzFQWiyWFkubdJOa/6aZldDai3In6QbfiHsGCSKp ry20IqHYQDTB4i2LOrEvphCredD8vNP+MrrYIPQy8TRLzVgGi04= =MaAe -----END PGP SIGNATURE-----