]> git.evergreen-ils.org Git - OpenSRF.git/commit
Patch from Scott McKellar:
authormiker <miker@9efc2488-bf62-4759-914b-345cdb29e865>
Thu, 31 Jan 2008 18:23:52 +0000 (18:23 +0000)
committermiker <miker@9efc2488-bf62-4759-914b-345cdb29e865>
Thu, 31 Jan 2008 18:23:52 +0000 (18:23 +0000)
commitd104bbbcf3476df93b10dd7f69f4686523c9367c
treebac78fddc28778d076459d218aa742726761665b
parentdf9a85f8d86e82a47ff92abcc56bcca04690b7a4
Patch from Scott McKellar:

1. I renamed __osrfRouter simply to router, and made it static.  We
had one global variable and one auto variable pointing to the same
object, causing some needless juggling.  Now we have just one
pointer.

2. I removed the leading underscores from __setupRouter().

3. I renamed the parameter to routerSignalHandler() from "signal"
to "signo", since "signal" is a reserved identifier.  I also added
some code to re-raise the signal caught.

[from a followup email]

> I chose instead to terminate the program by re-raising the signal.
> That way the parent process has a chance to detect that the program
> was terminated by a signal rather than by a normal return.

After posting this I realized that the router program runs as a
daemon, and its adopted parent process doesn't care whether it
terminates by a signal or by a normal return.  So there's not
much point in re-raising the signal.

It remains true that the signal handler should contrive to
terminate the program, either by exiting or by setting a flag that
the rest of the program tests.

[ The original patch, re-raising the signal, is applied. ]

4. In main() I moved two calls to free() so that they are reachable.

5. In main() I return either EXIT_SUCCESS or EXIT_FAILURE, which are
portable.  Otherwise we could find ourselves returning -1, which is
not portable.

6. In setupRouter() I arranged to free resource, and to free
tservers and tclients in the case of an early return.  I also free
router in the unlikely event that osrfRouterRun returns.

7. I reworded an error message to something that I think is more
clear.

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1233 9efc2488-bf62-4759-914b-345cdb29e865
src/router/osrf_router_main.c