gnunet-developers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-developers] Consider phasing out GNUNET_SERVICE_MAIN


From: Alessio Vanni
Subject: [GNUnet-developers] Consider phasing out GNUNET_SERVICE_MAIN
Date: Sat, 07 Sep 2019 13:51:24 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)

Hello,

3rd-party applications often require a particular initialization, for
example localization or even just a custom version string.  Currently,
clients can solve some of these situations by calling `GNUNET_OS_init'
in their `main' function, before `GNUNET_PROGRAM_run' (anything else not
covered by GNUNET_OS_ProjectData is left to the application itself.)

For services, however, it is not as simple: the `GNUNET_SERVICE_MAIN'
macro completely hides the `main' function, so it's impossible to call
`GNUNET_OS_init' and the like.  The macro could be expanded manually
(i.e. use an explicit `main' rather than the macro), but
`GNUNET_SERVICE_run_' has a name that, by convention, denotes a private
function that should not be used directly.

I suggest to make the `GNUNET_SERVICE_run' public, so that applications
can run their initialization procedures before the service "connects"
with GNUnet.

In theory this change would only require to change "run_" to "run" and
rewrite the gnunet-ext service accordingly.  There's no need to outright
remove the macro as it can be used internally without problems.

In the meantime, the attached patch adds localization to services.
Until now, even if the locale is changed, any message printed by a
service would not be translated regardless of what the relevat PO file
contains.

Thanks,
A.V.

Attachment: 0001-Make-services-localizable.patch
Description: Patch for GNUnet


reply via email to

[Prev in Thread] Current Thread [Next in Thread]