Hi, let us first try to unpack the "normal" case (GNUNET_PROGRAM_run or run2 with scheduler):
The scheduler is basically GNUnet's "main loop". It will run the tasks for service communications, for example. The scheduler intercepts all signals and handles them, including SIGTERM et al. It also prevents the program from shutting down if we still have open connections/operations with services. In order to terminate your program, you need to close all running connections and stop all tasks. You can do this "cleanup" in the shutdown task. The shudown task will run on ctrl-c or the respective signals for termination. To define the shutdown task, use GNUNET_SCHEDULER_add_shutdown(). To terminate the scheduler programatically, you can use GNUNET_SCHEDULER_shutdown() (which will also run the shutdown tasks). My assuption now would be that you initiate a connection (GNUNET_*_connect()) or an operation on a connected handle without cleaning it up properly. That is why your program does not terminate. The other case is running without scheduler (_run2 without scheduler). In this case you can handle your signals as you wish. You are not in the schduler "main loop". The program terminates when the control flow ends. But you will also not be able to use API which requires the scheduler (basically any service API interation). So it is used rarely. BR Martin > On 25. Feb 2021, at 21:49, Danny <danny.de.j...@protonmail.com> wrote: > > Hey guys, > > I've been using GNUNET_PROGRAM_run2, and have been trying it with and > without the scheduler. What strikes me as odd is that I'm not able to > ctrl+c my application. I am also not able to catch the SIGINT in my > application. How is this done? Is this intended behavoir? > > Thanks a lot, > Danny > > >
signature.asc
Description: Message signed with OpenPGP