Re: Implementing a cancelable task

dvn <[email protected]> Thu, 23 Jul 2020 23:12:47 +0100
Newsgroups gmane.network.gnunet.general
Message-ID <20200723221247.ffpjufzjj57zk2y6@iyo>
Hi Alessio,

Likely to get more helpful eyes on this if you send it to the "GNUnet
Developers" mailing list: <[email protected]>


Cheers,
Devan

Alessio Vanni transcribed 1.9K bytes:
> Hello,
> 
> I have a service doing the following:
> 
> * waits for a client to send a specific message
> * when the message arrives it opens a CADET channel
> * this channel is left open until the client requests it to be closed
> * the client sends another specific message
> * when the message arrives it is "unpacked" and sent over the channel
> * the remote peer replies with some data
> * when the data arrives it is "packed" and sent to the client
> 
> I'd like to make the parts where the client waits for the service
> "cancelable tasks", i.e. have a "cancel" function that stops any further
> operations on the canceled message from being executed.  Basically
> something like `GNUNET_SCHEDULER_cancel' or what the GNS service
> provides.
> 
> I've peeked at the implementation of some of those functions, but there
> are few things troubling me (might be because I don't know how the code
> works, but still.)
> 
> The first thing I saw was that those tasks use a unique ID embedded in
> the message. I tried something like that, but the CADET part doesn't
> make it practical, as I'd have to send the ID to the remote peer and
> hope that said peer doesn't change its value and/or use it for some
> nefarious purpose.
> 
> Ultimately the problem is that I don't have a reliable way to associate
> a task with the execution of a certain callback.
> 
> I was hoping someone could provide some help on the matter, especially
> since GNUnet has a lot of those cancelable tasks.
> 
> Thank you,
> A.V.
> 
> P.S. I tried subscribing to this list, but I can't tell if it succeeded
> or not. If it requires a mail confirmation, I didn't get anything after
> requesting the subscription.  This is actually the second time I tried
> and still nothing.  In this second attempt it might simply be a late
> delivery, but the first time I got nothing and I didn't receive anything
> of what was sent to the list afterwards.  I can receive mails from other
> sources just fine (though it seems some places can't receive from me) so
> I really don't know what's going on.
>
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEEDMARp8PcbrR1Z5vJrAq6MYZqfnYFAl8aC1QACgkQrAq6MYZq
fnYiBw//XfY+czMj74dSHRmK7UInZCxPLFUqkmeTNZ3FSOniYapTILDpcST2Td10
WsqfOK+Giu765SfhsMcCXD63Tm+XpKFMcJN5hqoFWUHmwmwAkTKvy4hL+lKK7lVJ
50NFBX80O+eDkjZmFvdWRJUALb976cFuoWXFHxtp1HhBsaoQD2mQjbI1rJ0YEyfL
gIyRJVrnc8ZkxPU6IsPHRwJVsHvXCudv0302F2hYMiFA3fUeKk5om0YJXH5BXvFx
1ek83iqVQXozZdyjnwS8E6+djaZKkmaZD3WCOgnWgLQKwedAM5rH15TDq2oTQO++
t/x2tFIMTAUBU7rWO9Tno0jTJW7u5p4Dgth5F/2Taetg7XSVk4jFML/ksHYFnN56
RfUexPE3AeaNNJXBquT4++LQAcAO0QoP8Z/z6bGuYY3zByVvJg1AWuxgQYfBvq2J
du3krfH/l8awjU8n29cqpuugWve5r35V11v+L6HoWNqEJrv5UvxwBmnSUxAYl3tM
flFybeprPFf0qaJjgKF16+0ZXhBkLRIyf7+PxhEqhN9wfxmWnRgUhHASPtFYUzhs
TcSoiC6N2k3deaAcGWZfF1OBphkoaUST3RPPKrtmGc0/Eg4sLvfcHChTc6t46VlT
6KIx/2NxyBDpQdQJiw45TJPH+HYTt2Zy+RrE2m2vTO/2NNwbsK0=
=zdQ1
-----END PGP SIGNATURE-----