On Wed, Jul 26, 2023 at 10:14:39AM -0700, Thangalin wrote:
> The example code provided gives users a great start. I'm wondering if some
> of the example code could be pulled into the library itself? My guess is
> that many people who use the library will basically copy/paste portions
> into their own code.
> 
> What do you think of something like the following:
> 
> int main() {
>   chrony_session *csess;
>   chrony_socket *csock = chrony_socket_open();
> 
>   int r = chrony_session_init(&csess, csock);

Getting back to this.

Yes, I agree that would simplify the application code. I tried to
minimize the amount of system specific code in the library. Maybe that
should be reconsidered.

If the code opening, connecting and binding sockets is in the library,
it needs to be able to accept remote addresses. There also needs to be
some mechanism to avoid collisions between sockets of different
applications or one application using multiple chrony sockets.

chronyc and example-reports use a socket name based containing the
process ID. That won't work generally. Randomly generated names would
leave a mess in the directory if the application is buggy or not
terminated correctly.

Is there a portable way to detect when a Unix socket is no longer
referenced by anything? I think that would allow libchrony to reuse
old sockets with predictable names.

-- 
Miroslav Lichvar


-- 
To unsubscribe email chrony-dev-requ...@chrony.tuxfamily.org with "unsubscribe" 
in the subject.
For help email chrony-dev-requ...@chrony.tuxfamily.org with "help" in the 
subject.
Trouble?  Email listmas...@chrony.tuxfamily.org.

Reply via email to