Christian Grothoff <groth...@gnunet.org> writes: > Hi Alessio, > > You should store a copy of the 'cls' together with your channel handle. > Typically, the 'cls' would actually point to the struct in which you > store your channel handle. So if you do this in any reasonable way, you > should not need an API to lookup the 'cls' from the handle. > > If you can point me to your code and where you need the 'cls', I might > be able to suggest how to do this...
Apologies for the late reply, I had some personal troubles I had to take care of and it took a few days. Getting the code out of context is a bit hard, but essentially currently it does this, at a very high level: - on demand, open a channel to some place - stash the channel somewhere until it's requested again or closed - when appropriate, operate on the channel (sending or receiving) - close the channel on demand or after some heuristics decide to Those actions in themselves are not issues conceptually, but as it is I've found myself that in some places I have only the channel but I also need e.g. some informations about the place it was stored in, and those informations are not available "externally", at least for now, thus the attempt at extracting the closure. I'm trying to redesign the thing so that it doesn't depend on that, but so far it's been a bit difficult, which is why I asked if it was possible to get the closure somehow. This was mostly a question about style or best practices, I guess, more than something technical. If it's really "not the right thing" to do, I'll try to depend less on the closure on the channel and see if I can use some other data type somehow. Thanks, A.V.