scottmk [Thu, 5 Nov 2009 20:23:49 +0000 (20:23 +0000)]
1. Further refinement of comments.
2. In osrfRouterClassHandleIncoming() and osrfRouterClassHandleBounce():
rearranged the logic a bit for clarity.
3. In _osrfRouterFillFDSet(): reuse the osrfHashIterator that's available
in the osrfRouter instead of creating and destroying a fresh one.
M src/router/osrf_router.c
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1843
9efc2488-bf62-4759-914b-
345cdb29e865
scottmk [Wed, 4 Nov 2009 20:53:20 +0000 (20:53 +0000)]
Eliminate a potential (if unlikely) memory leak: Free a
transport_message.error_type before overlaying it.
M src/libopensrf/transport_message.c
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1842
9efc2488-bf62-4759-914b-
345cdb29e865
scottmk [Wed, 4 Nov 2009 16:32:10 +0000 (16:32 +0000)]
1. Added an osrfHashIterator as a member of osrfRouter, so that
we can reuse it when repeatedly traversing the list of classes.
This way we don't have to create and destroy an osrfHashIterator
on every iteration.
2. In osrfRouterRun(): eliminated a pointless hash look up in the
innermost loop.
M src/router/osrf_router.c
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1841
9efc2488-bf62-4759-914b-
345cdb29e865
scottmk [Tue, 3 Nov 2009 22:25:12 +0000 (22:25 +0000)]
1. Changed several functions that were returning int so that
they return void instead. We weren't checking the return codes
anyway, since the functions in question handle their error
conditions on their own.
2. Eliminated a pointless memset().
3. For message received from the top-level transport_client, we
have to branch according to whether the message is a command
or an app request. I moved that decision up one level in the
calling hierarchy.
Rationale: the two branches are peers. Neither should be
treated as if it is a subordinate of the other. That peerage
is better expressed by making them two branches of the same if
statement, rather than conditionally calling one of the branches
from inside the other.
Minor performance benefit: for one of the branches we avoid an
extra layer of function call.
4. Related to the above: renamed osrfRouterHandleMessage() to
osrfRouterHandleCommand(), since handling commands is all it
does now. Also rearranged its logic a bit.
5. Extended and refined the comments.
M src/router/osrf_router.c
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1840
9efc2488-bf62-4759-914b-
345cdb29e865
scottmk [Tue, 3 Nov 2009 00:00:59 +0000 (00:00 +0000)]
In the main loop of the router: if the select call fails for
any reason other than an harmless signal (i.e. one whose
handler didn't set a switch to stop the loop), then break
out of the loop and terminate.
The old code would ignore the error and keep looping, using up
ca. 98% of the CPU until somebody killed it.
M src/router/osrf_router.c
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1839
9efc2488-bf62-4759-914b-
345cdb29e865
scottmk [Mon, 2 Nov 2009 23:21:52 +0000 (23:21 +0000)]
1. Move the declaration of osrfRouter out of the header
and into osrf_router.c. There's no need for any other
source file to know about the internals.
2. Eliminate the ROUTER_SOCKFD macro in favor of the new
client_sock_fd() function. Reason: it needlessly coupled
the osrfRouter and osrfRouterClass structures by requiring
each of them to have a member named "connection".
3. Further tinkering with the comments.
M src/router/osrf_router.h
M src/router/osrf_router.c
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1838
9efc2488-bf62-4759-914b-
345cdb29e865
scottmk [Mon, 2 Nov 2009 22:59:43 +0000 (22:59 +0000)]
New function: client_sock_fd(). It returns the socket fd used
by the transport_session underlying a specified transport_client.
Purpose: increase the level of encapsulation, so that the
calling code doesn't need to know about three layers of internals.
M include/opensrf/transport_client.h
M src/libopensrf/transport_client.c
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1837
9efc2488-bf62-4759-914b-
345cdb29e865
scottmk [Mon, 2 Nov 2009 14:41:22 +0000 (14:41 +0000)]
Changed the signal handling.
There are very few things you can safely do within a signal handler, and
shutting down an osrfRouter is not among them.
Now the signal handler just sets a switch for the main loop to look at.
The select call looks for errno == EINTR and then looks at the switch
that the signal handler sets. If the switch is set, we exit the otherwise
infinite loop. Then we free the osrfRouter and re-raise the signal.
M src/router/osrf_router.h
M src/router/osrf_router.c
M src/router/osrf_router_main.c
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1836
9efc2488-bf62-4759-914b-
345cdb29e865
scottmk [Sat, 31 Oct 2009 16:49:15 +0000 (16:49 +0000)]
Fixed a bug in osrfRouterClassFree(). We were trying free
the same osrfRouterClass twice -- once directly, and once
by an unintended recursion.
M src/router/osrf_router.c
M src/router/osrf_router_main.c
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1835
9efc2488-bf62-4759-914b-
345cdb29e865
scottmk [Sat, 31 Oct 2009 16:28:38 +0000 (16:28 +0000)]
Tinkering with white space and comments. No
substantive changes.
M src/router/osrf_router.c
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1834
9efc2488-bf62-4759-914b-
345cdb29e865
scottmk [Fri, 30 Oct 2009 05:04:01 +0000 (05:04 +0000)]
1. Tidy up the white space.
2. Add copious comments, mostly doxygen-style, to document
the functions and the transport_client struct.
3. In client_connect(): plug a memory leak by freeing
client->xmpp_id before overlaying it. Plug a potential
similar leak in client_send_message().
4. In client_send_message(): return 1 (an error) instead of
0 (success) when the first parameter is NULL.
M include/opensrf/transport_client.h
M src/libopensrf/transport_client.c
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1833
9efc2488-bf62-4759-914b-
345cdb29e865
sboyette [Thu, 29 Oct 2009 21:26:06 +0000 (21:26 +0000)]
exit with error code when tools are not found
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1832
9efc2488-bf62-4759-914b-
345cdb29e865
miker [Thu, 29 Oct 2009 19:48:33 +0000 (19:48 +0000)]
give decodeJS a way to try to load a class that was requested but does not yet exist
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1831
9efc2488-bf62-4759-914b-
345cdb29e865
scottmk [Thu, 29 Oct 2009 19:25:39 +0000 (19:25 +0000)]
Add doxygen-style comments to document the
transport_message structure.
M include/opensrf/transport_message.h
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1830
9efc2488-bf62-4759-914b-
345cdb29e865
scottmk [Thu, 29 Oct 2009 18:02:48 +0000 (18:02 +0000)]
1. Tidy up the white space.
2. Add doxygen-style comments to document all functions.
M src/libopensrf/transport_message.c
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1829
9efc2488-bf62-4759-914b-
345cdb29e865
scottmk [Wed, 28 Oct 2009 15:15:08 +0000 (15:15 +0000)]
1. In endElementHandler(), responding to an error: don't explain what a
401 error is unless that's the error that happened.
2. In parseWarningHandler() and parseErrorHandler(): issue messages via
the usual logging routines instead of writing them to stdout and stderr.
3. Finish the doxygen-style commenting.
M include/opensrf/transport_session.h
M src/libopensrf/transport_session.c
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1828
9efc2488-bf62-4759-914b-
345cdb29e865
scottmk [Wed, 28 Oct 2009 04:22:44 +0000 (04:22 +0000)]
1. Added comments to document the process of connecting to Jabber.
2. Added doxygen-style comments to document the final two functions.
3. Several minor performance tweaks and rearrangements.
M src/libopensrf/transport_session.c
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1827
9efc2488-bf62-4759-914b-
345cdb29e865
dbs [Sun, 25 Oct 2009 21:44:26 +0000 (21:44 +0000)]
Improve the 'help' output for srfsh:
* Document the method-name parameter for the introspect command
* Document the currently supported srfsh variables
* Reorganize the help slightly to place more emphasis on
introspect and request and cut down on some of the blank lines.
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1826
9efc2488-bf62-4759-914b-
345cdb29e865
scottmk [Sun, 25 Oct 2009 17:02:06 +0000 (17:02 +0000)]
1. Moved several macros from the header to the implementation file. They aren't used
anywhere else.
2. Renamed SERVER_SOCKET and CLIENT_SOCKET to LISTENER_SOCKET and DATA_SOCKET,
respectively. The new names more accurately reflect the uses to which the two
socket types are put. (Note that some so-called CLIENT_SOCKETs were, in fact,
opened by servers.)
3. Changed socket_open_udp_server() to open a DATA_SOCKET (formerly called a
CLIENT_SOCKET) instead of a LISTENER_SOCKET (formerly called a SERVER_SOCKET).
Otherwise an attempt to wait on such a socket would wind up treating it like
a listener. That doesn't work for UDP. In practice this change has no effect,
since no application ever calls this function anyway.
4. Always close a socket before removing the associated socket_node. Otherwise we
will leak sockets in some situations.
5. Tinkered further with the comments, especially in the header file.
M include/opensrf/socket_bundle.h
M src/libopensrf/socket_bundle.c
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1825
9efc2488-bf62-4759-914b-
345cdb29e865
scottmk [Sun, 25 Oct 2009 05:35:47 +0000 (05:35 +0000)]
Merged _socket_route_data() into its only caller, after untangling its logic.
The old function traversed the linked list of socket_nodes in a loop,
examining each node at the bottom of the loop in order to identify the next
node. It went through elaborate and confusing gyrations to avoid dereferencing
a pointer for a node that had been deleted.
A better solution is to get a pointer to the next node *before* deleting the
current one. The resulting code is simple and easy to understand.
M src/libopensrf/socket_bundle.c
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1824
9efc2488-bf62-4759-914b-
345cdb29e865
scottmk [Sat, 24 Oct 2009 14:05:55 +0000 (14:05 +0000)]
Implemented session_connected(), which had been declared in the header but never
defined.
Changed transport_client.c to use session_connected(), so that it wouldn't need to
see a declaration of jabber_machine.
Moved from transport_session.h to transport_session.c: several macros and the
declaration of jabber_machine, of which none are needed elsewhere.
Removed some comments from the header so that they won't override more complete
comments in the implementation file.
In session_connect(): inserted a return statement in order to bypass some
superfluous string comparisons.
Added the const qualifier to the return type of get_xml_attr(). We don't want to
be able to overwrite the text returned by the XML parser.
In endElementHandler(): look for "stream:error", to match the opening tag, instead
of "error:error".
Resest status_buffer along with the other buffers.
Introduced several minor performance tweaks.
Added more doxygen-style comments for documentation.
M include/opensrf/transport_session.h
M src/libopensrf/transport_session.c
M src/libopensrf/transport_client.c
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1823
9efc2488-bf62-4759-914b-
345cdb29e865
scottmk [Thu, 22 Oct 2009 03:21:31 +0000 (03:21 +0000)]
Various cleanups in transport_session.c:
1. In init_transport(): guard against a NULL server parameter.
2. In session_free(): if the session is still open, disconnect it.
3. In session_connect(): if we open a socket but are unable to connect to Jabber, close the
socket and set the sock_id member to zero. If the socket is already open, return an error,
instead of reusing the existing socket (and trying to overlay any open Jabber session).
4. In session_connect(): guard against an invalid auth_type.
5. In session_connect(): corrected some errors in the way we calculate buffer sizes,
6. In session_disconnect(): send a disconnect message only if the socket is still open.
7. Tidied up white space and comments in various places.
8. Added doxygen-style comments to document some of the functions.
M src/libopensrf/transport_session.c
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1822
9efc2488-bf62-4759-914b-
345cdb29e865
scottmk [Sun, 18 Oct 2009 02:00:18 +0000 (02:00 +0000)]
Eliminated _socket_route_data_id() as a separate function, incorporating
its contents into the end of socket_wait().
Rationale: _socket_route_data_id() was called in only a single place.
It was little more than a mildly obfuscated if test, branching to two
very different functions. Having this code fragment in a separate function
just made the logic harder to follow.
Also: added a couple more doxygen-style comments.
M src/libopensrf/socket_bundle.c
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1821
9efc2488-bf62-4759-914b-
345cdb29e865
scottmk [Sat, 17 Oct 2009 17:15:54 +0000 (17:15 +0000)]
1. In socket_connected(): if the select() fails because it is interrupted
by a signal, it doesn't mean that the socket is invalid, so try again.
2. In _socket_handle_client_data(): remove two unnecessary calls to the
osrf_clearbuf macro.
3. Add more doxygen-style comments to document the functions; edit a few
existing comments in various ways.
M src/libopensrf/socket_bundle.c
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1820
9efc2488-bf62-4759-914b-
345cdb29e865
scottmk [Tue, 13 Oct 2009 23:07:01 +0000 (23:07 +0000)]
1. In socket_open_tcp_client(): use getaddrinfo() instead of gethostbyname().
The latter is obsolete, according to the man page and other sources.
2. Add doxygen-style comments to document several more functions.
M src/libopensrf/socket_bundle.c
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1819
9efc2488-bf62-4759-914b-
345cdb29e865
scottmk [Tue, 13 Oct 2009 01:51:34 +0000 (01:51 +0000)]
1. Moved the declaration of socket_node from the header into the
implementation file. No other source files need to be exposed
to it.
2. Contrived to avoid leaking sockets in case of error exits;
sometimes by changing the sequence of operations, sometimes by
inserting a close().
3. In socket_open_tcp_client() and socket_open_udp_client():
removed the call to bind(). Ordinarily a client socket doesn't
need to know or care what its local address is.
4. In socket_open_udp_client(): eliminated the second and third
parameters, which define the remote address. That information
wasn't going anywhare anyway. For a UDP socket, you have no
use for the remote address until you actually try to send or
receive.
5. Added doxygen-style comments to document some of the functions.
M include/opensrf/socket_bundle.h
M src/libopensrf/socket_bundle.c
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1818
9efc2488-bf62-4759-914b-
345cdb29e865
scottmk [Mon, 12 Oct 2009 18:09:18 +0000 (18:09 +0000)]
1. Replace the old JSON parser (jsonParseString()) with a newer, faster one
(jsonParse()).
2. Because the new JSON parser is strict about syntax errors that the old
parser would ignore, it was necessary to parse the srfsh command line more
intelligently. Otherwise it would be impossible to build a JSON string
internally with reliably correct syntax.
Hence: instead of using strtok() to break up the command line into tokens, we
now use a rudimentary recursive descent parser to isolate JSON strings as
distinct arguments, even if they contain embedded white space.
As a fairly benign side effect of these changes, the treatment of commas
in the command line is changing a bit. All parts of the command line
(not just JSON strings) may now be optionally separated by commas.
3. We now use an osrfStringArray to hold the results of parsing, rather
than a bare array of pointers.
4. The function formerly known as "parse_request" is now named "process_request",
because it does a lot more than just parsing.
M src/srfsh/srfsh.c
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1817
9efc2488-bf62-4759-914b-
345cdb29e865
dbs [Mon, 12 Oct 2009 00:38:47 +0000 (00:38 +0000)]
Clean up and clarify configure help and messages a wee bit
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1816
9efc2488-bf62-4759-914b-
345cdb29e865
dbs [Mon, 12 Oct 2009 00:25:15 +0000 (00:25 +0000)]
Chop chopchop out of the default make / install target
chopchop is a basic XMPP server that is not used in production, so
let's not bother with building and installing it in the default configuration.
We introduce a new configure option, --enable-chopchop, for those who do
want to build and install chopchop.
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1815
9efc2488-bf62-4759-914b-
345cdb29e865
scottmk [Sun, 11 Oct 2009 18:39:16 +0000 (18:39 +0000)]
Add doxygen-style comments to document macros, and an overview
at the top.
M include/opensrf/log.h
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1814
9efc2488-bf62-4759-914b-
345cdb29e865
scottmk [Sun, 11 Oct 2009 17:31:03 +0000 (17:31 +0000)]
Add doxygen-style comments to document all functions and all variables
at file scope.
In log.h: remove some existing comments so that they won't override
the more complete comments in log.c.
M include/opensrf/log.h
M src/libopensrf/log.c
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1813
9efc2488-bf62-4759-914b-
345cdb29e865
dbs [Sun, 11 Oct 2009 03:43:19 +0000 (03:43 +0000)]
Add a '-l' option to treat the hostname as 'localhost', to match osrf_ctl.sh.
This will be useful in testing and tutorial scenarios.
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1812
9efc2488-bf62-4759-914b-
345cdb29e865
scottmk [Sat, 10 Oct 2009 19:19:27 +0000 (19:19 +0000)]
1. osrfLogGetXid now returns a pointer to const. We don't want the
calling code to be able to overwrite the cached copy of the
transaction id.
2. Add doxygen-style comments to document some of the functions.
M include/opensrf/log.h
M src/libopensrf/log.c
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1811
9efc2488-bf62-4759-914b-
345cdb29e865
scottmk [Sat, 10 Oct 2009 02:28:49 +0000 (02:28 +0000)]
Performance tweak to the logging routines.
_osrfLogToFile() is no longer a variadic function. We always sent it the
same format string, and there was no point in sending a variable-length
parameter list that never actually varied in length.
Now we send it a fixed-length parameter list -- and thereby avoid two
calls to vsnprintf() that had been hidden in the VA_LIST_TO_STRING macro.
Also: added doxygen-style comments to several of the functions.
M src/libopensrf/log.c
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1810
9efc2488-bf62-4759-914b-
345cdb29e865
scottmk [Thu, 8 Oct 2009 18:26:37 +0000 (18:26 +0000)]
Fix a bug in md5sum() (which only affected code compiled
with debugging turned on).
md5sum() builds an md5 message digest in a buffer. Originally
it used memset() to initialize the buffer with binary zeroes.
At some point the call to memset() was replaced with the
osrf_clearbuf() macro. When compiled in debugging mode,
osrf_clearbuf() fills the buffer with exclamation points;
otherwise it reverts to the original memset().
In this case the use of osrf_clearbuf is inappropriate, because
we use strcat() to build the message digest, two bytes at a
time. We don't need to use memset(), but the first byte needs
to be initialized to a nul byte so that strcat() will work as
intended. Hence:
1. Remove the call to osrf_clearbuf().
2. Put a nul byte at the beginning of the buffer.
Also, I made the buffer smaller. There's no reason for it
to be 256 bytes long.
M src/libopensrf/utils.c
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1809
9efc2488-bf62-4759-914b-
345cdb29e865
scottmk [Mon, 5 Oct 2009 18:53:02 +0000 (18:53 +0000)]
Small performance tweak.
Replaced two occurrences of jsonParseString( "[]" ) with the
equivalant (and faster) call to jsonNewObject( JSON_ARRAY ).
M src/libopensrf/osrf_application.c
M src/srfsh/srfsh.c
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1808
9efc2488-bf62-4759-914b-
345cdb29e865
scottmk [Mon, 5 Oct 2009 16:29:57 +0000 (16:29 +0000)]
Performance tweak to message handling.
In five locations in osrf_message.c, we were turning a jsonObject into
a JSON string, only to parse it again back into a jsonObject:
-- osrf_message_add_object_param()
-- osrfMessageToJSON() (two occurrences)
-- osrf_message_deserialize() (two occurrences)
That's silly.
This new version copies the original jsonObject directly, with no round
trip through a JSON string. We use jsonObjectDecodeClass() to do the
copy, in order to make sure that all class hints are decoded into
classnames.
(Until recently, jsonObjectDecodeClass() would remove classnames that were
already present. That's presumably the reason for the curious and
inefficient two-step procedure that we were using up till now.)
Also: In two locations (in osrf_message_add_object_param() and
osrf_message_add_param()) We used jsonParseString() to parse a
hard-coded "[]". I replaced those calls with equivalent (and faster)
calls to jsonNewObjectType( JSON_ARRAY );
Also: in osrf_message_set_result_content() I eliminated a pointless test
for nullity of the json_string variable. An earlier test already
guarantees that json_string is not NULL.
M src/libopensrf/osrf_message.c
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1807
9efc2488-bf62-4759-914b-
345cdb29e865
scottmk [Mon, 5 Oct 2009 14:48:24 +0000 (14:48 +0000)]
Created a new function osrfHashExtract(). It extracts an item with a
given key from an osrfHash, without destroying it, leaving the rest
of the osrfHash intact.
M include/opensrf/osrf_hash.h
M src/libopensrf/osrf_hash.c
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1806
9efc2488-bf62-4759-914b-
345cdb29e865
scottmk [Mon, 5 Oct 2009 02:01:39 +0000 (02:01 +0000)]
Tweak jsonObjectDecodeClass so that it preserves classnames
that are already present. The previous version would add
new classnames, if it found them encoded, but would drop
any old ones.
At present this change will have no effect. Apart from a
couple of recursive calls, the only function that calls
jsonObjectDecodeClass() is jsonParseString(). In that case,
we pass a freshly parsed jsonObject that can't possibly
have any classnames yet.
However this change will enable us to use this function
elsewhere (specifically in osrf_message.c), resulting in
simpler and faster code.
M src/libopensrf/osrf_json_tools.c
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1805
9efc2488-bf62-4759-914b-
345cdb29e865
scottmk [Sun, 4 Oct 2009 15:13:36 +0000 (15:13 +0000)]
Enhance the performance of the recursive descent JSON parser,
mainly the jsonParse() function.
1. The old version would create a jsonObject and then copy it, with
possible modifications, via a call to jsonObjectDecodeClass(), in
order to decode class hints into the classname member. Finally, it
would throw away the original jsonObject.
The copying operation is expensive, and the new version eliminates
it. When decoding is desired (which is nearly always), execution
passes through a parallel version of the get_hash() function, which
does the decoding on the fly.
In my benchmarking, the new version reduces the parsing time by
around 35 - 45 percent. It is now at least twice as fast as the
older jsonParseString() function, which uses a finite state
machine instead of recursive descent.
2. In get_number(): instead of allocating and destroying a
temporary growing_buffer, use the one available in the
Parser structure.
3. In osrf_json.h: Applied some pedantic corrections to the
doxygen comments for the old parser.
--------
In all cases tested, the new version produces results identical
to those of the old version. The results are also identical to
those of the older parser, apart from error detection.
M include/opensrf/osrf_json.h
M src/libopensrf/osrf_parse_json.c
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1804
9efc2488-bf62-4759-914b-
345cdb29e865
scottmk [Fri, 2 Oct 2009 19:02:25 +0000 (19:02 +0000)]
Change the return type of jsonObjectGetString so that it
is a pointer to const char, instead of to non-const char.
We don't want the calling code to be able to modify the innards
of the jsonObject, at least not by this back door.
I have already examined all uses of this function and modified
them where necessary to avoid compile problems.
M include/opensrf/osrf_json.h
M src/libopensrf/osrf_json_object.c
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1803
9efc2488-bf62-4759-914b-
345cdb29e865
scottmk [Fri, 2 Oct 2009 16:34:12 +0000 (16:34 +0000)]
1. Add doxygen-style comments to document functions in the
recursive-descent JSON parser. Tidy up or correct existing
comments here and there.
2. In report_error(): add the const qualifier to the
third parameter.
M include/opensrf/osrf_json.h
M src/libopensrf/osrf_parse_json.c
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1802
9efc2488-bf62-4759-914b-
345cdb29e865
scottmk [Tue, 29 Sep 2009 05:13:38 +0000 (05:13 +0000)]
We routinely grab a chunk of configuration file that doesn't
apply to the router process. When we detect the spurious hit,
we throw it away and go on to the next one.
We had been detecting the spurious hit after forking, thus
wasting a fork.
Now we detect the spurious hit before forking, so that we
don't waste a fork.
M src/router/osrf_router_main.c
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1801
9efc2488-bf62-4759-914b-
345cdb29e865
scottmk [Tue, 29 Sep 2009 03:58:13 +0000 (03:58 +0000)]
Comment out an error message added in the previous patch.
The error message reported what looks like an error condition:
the config file doesn't provide transport info. However what
appears to be happening is that the program tries to read
several different sections of the config file, of which some
are relevant and some aren't, due to some overloading of the
<routers> tag. As a result it routinely spawns irrelevant
children, only to watch them die.
There's got to be a better way, but for now I'll just
suppress the error message.
M src/router/osrf_router_main.c
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1800
9efc2488-bf62-4759-914b-
345cdb29e865
dbs [Tue, 29 Sep 2009 01:47:23 +0000 (01:47 +0000)]
Let's give OpenSRF a spin on Ubuntu Karmic
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1799
9efc2488-bf62-4759-914b-
345cdb29e865
scottmk [Mon, 28 Sep 2009 16:03:33 +0000 (16:03 +0000)]
1. Eliminated some memory leaks by replacing calls to
jsonObjectFindPath() (whose return values weren't getting
freed) with calls to jsonObjectGetKey(). This change will
also speed up the configuration a bit by avoiding the
cloning of objects.
2. Changed setupRouter so that it returns void instead of int.
We weren't looking at the return value anyway. Since the
function normally enters an infinite loop, any return
represents some kind of error.
3. If the configuration file has no transport information,
issue a message before exiting (to standard error, since we
don't have a log file yet).
4. Add doxygen-style comments for documentation.
M src/router/osrf_router_main.c
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1798
9efc2488-bf62-4759-914b-
345cdb29e865
scottmk [Mon, 28 Sep 2009 12:26:21 +0000 (12:26 +0000)]
1. Changed osrfLogFacilityToInt() so that it accepts
a const pointer.
2. Added the const qualifier to various variables.
3. In osrf_router_main.c: Removed three inappropriate
calls to free(). Some memory leaks remain, where we
fetch some cloned jsonObjects from jsonObjectFindPath()
and don't free them.
M include/opensrf/log.h
M src/router/osrf_router_main.c
M src/gateway/osrf_http_translator.c
M src/libopensrf/osrf_prefork.c
M src/libopensrf/log.c
M src/libopensrf/osrf_application.c
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1797
9efc2488-bf62-4759-914b-
345cdb29e865
dbs [Mon, 28 Sep 2009 04:38:16 +0000 (04:38 +0000)]
And place headers in /prefix/include/opensrf/ again, fixing regression to /prefix/include/
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1796
9efc2488-bf62-4759-914b-
345cdb29e865
dbs [Mon, 28 Sep 2009 04:18:27 +0000 (04:18 +0000)]
W h i t e s p a c e matters when defining automake targets
Headers weren't being installed as the include_HEADER target wasn't being parsed.
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1795
9efc2488-bf62-4759-914b-
345cdb29e865
scottmk [Fri, 25 Sep 2009 14:35:18 +0000 (14:35 +0000)]
1. Add doxygen markup for documentation.
2. In jsonNewObjectType(): explicitly initialize a JSON_BOOL to false, instead
of implicitly relying on the expectation that a NULL pointer is represented
by all-bits-zero.
3. In jsonObjectExtractIndex(): set the parent pointer to NULL in the
extracted jsonObject.
M include/opensrf/osrf_json.h
M src/libopensrf/osrf_json_object.c
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1794
9efc2488-bf62-4759-914b-
345cdb29e865
sboyette [Fri, 18 Sep 2009 12:57:58 +0000 (12:57 +0000)]
LogServer was removed from distro but not from MANIFEST - fixed
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1793
9efc2488-bf62-4759-914b-
345cdb29e865
phasefx [Thu, 17 Sep 2009 13:35:43 +0000 (13:35 +0000)]
correct the test for modifying the *.xml.example files
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1792
9efc2488-bf62-4759-914b-
345cdb29e865
sboyette [Tue, 15 Sep 2009 16:39:33 +0000 (16:39 +0000)]
POD/docs cleanup
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1791
9efc2488-bf62-4759-914b-
345cdb29e865
sboyette [Tue, 15 Sep 2009 16:19:48 +0000 (16:19 +0000)]
100% test coverage
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1790
9efc2488-bf62-4759-914b-
345cdb29e865
sboyette [Tue, 15 Sep 2009 16:19:47 +0000 (16:19 +0000)]
WIP
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1789
9efc2488-bf62-4759-914b-
345cdb29e865
sboyette [Tue, 15 Sep 2009 16:19:46 +0000 (16:19 +0000)]
WIP
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1788
9efc2488-bf62-4759-914b-
345cdb29e865
sboyette [Tue, 15 Sep 2009 16:19:45 +0000 (16:19 +0000)]
more test
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1787
9efc2488-bf62-4759-914b-
345cdb29e865
sboyette [Tue, 15 Sep 2009 16:19:45 +0000 (16:19 +0000)]
sync
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1786
9efc2488-bf62-4759-914b-
345cdb29e865
sboyette [Tue, 15 Sep 2009 16:19:44 +0000 (16:19 +0000)]
stowing WIP
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1785
9efc2488-bf62-4759-914b-
345cdb29e865
sboyette [Tue, 15 Sep 2009 16:19:43 +0000 (16:19 +0000)]
WIP
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1784
9efc2488-bf62-4759-914b-
345cdb29e865
dbs [Mon, 14 Sep 2009 04:02:04 +0000 (04:02 +0000)]
Make building & installing the core components of OpenSRF optional.
For now, this will be of most interest to those interested in installing only
the JavaScript files from OpenSRF. If you disable the core components in
configure, then dependency checking for those core components is skipped and
the JavaScript files will be installed to the desired location.
For example:
./autogen.sh
./configure --prefix=/openils --sysconfdir=/openils/conf --disable-core
sudo make install
... will result in only the OpenSRF JavaScript files being installed in
/openils/lib/javascript/ (although at the moment, the other directories
will still be created).
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1783
9efc2488-bf62-4759-914b-
345cdb29e865
scottmk [Sun, 13 Sep 2009 03:04:04 +0000 (03:04 +0000)]
Changed the signature of osrfStringArrayGetString():
1. It receives a pointer to osrfStringArray. That pointer
is now a pointer to const.
2. It returns a character pointer. That pointer is now a
pointer to const.
I have already examined all existing calls to this function,
and modified them where necessary.
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1782
9efc2488-bf62-4759-914b-
345cdb29e865
scottmk [Sun, 13 Sep 2009 01:51:12 +0000 (01:51 +0000)]
In osrf_json_gateway.c: added the const qualifier to three
different local variables, all named "str".
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1781
9efc2488-bf62-4759-914b-
345cdb29e865
scottmk [Sat, 12 Sep 2009 18:19:35 +0000 (18:19 +0000)]
In apacheGetParamValues() and apacheGetFirstParamValue():
applied const qualifier to nkey.
Also: changed the ensuing NULL tests to look at nkey
instead of key, since key has already been verified as
non-NULL.
Actually it looks like nkey is guaranteed to be non-NULL
as well, but that depends on the correct functioning
of osrfStringArray; so I left the NULL test, as
revised, in place.
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1780
9efc2488-bf62-4759-914b-
345cdb29e865
scottmk [Sat, 12 Sep 2009 17:59:39 +0000 (17:59 +0000)]
In osrfAppSessionClientInit(): added a const
qualifier to domain.
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1779
9efc2488-bf62-4759-914b-
345cdb29e865
scottmk [Sat, 12 Sep 2009 17:53:39 +0000 (17:53 +0000)]
In osrfSystemBootstrap(): added a const qualifier
to appname.
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1778
9efc2488-bf62-4759-914b-
345cdb29e865
scottmk [Sat, 12 Sep 2009 17:47:37 +0000 (17:47 +0000)]
In osrfBigHashFree: added a const qualifier to key,
and removed a pointless cast.
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1777
9efc2488-bf62-4759-914b-
345cdb29e865
scottmk [Sat, 12 Sep 2009 16:47:12 +0000 (16:47 +0000)]
In osrfStringArrayRemove(): fixed a bug whereby we would decrement
the size member even if no string was actually removed.
Added Doxygen-style comments to document everything.
Removed a few comments in the header so that they wouldn't
override comments in the implementation file.
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1776
9efc2488-bf62-4759-914b-
345cdb29e865
scottmk [Fri, 11 Sep 2009 19:38:48 +0000 (19:38 +0000)]
In osrfNewHash(): specify a size for the osrfList used as a hash table,
so as to avoid wasting memory.
In osrfHashSet(): rearranged the logic a bit for clarity; no change in
behavior.
In osrfHashIteratorNext(): added a bit of protection against a corrupted
iterator.
Throughout: added Doxygen-style comments for documentation. Removed
some comments from the header so that they wouldn't override more
complete comments from the implementation file.
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1775
9efc2488-bf62-4759-914b-
345cdb29e865
erickson [Thu, 10 Sep 2009 22:25:26 +0000 (22:25 +0000)]
initial support for capturing bytes read from gateway response
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1774
9efc2488-bf62-4759-914b-
345cdb29e865
dbs [Thu, 10 Sep 2009 01:09:03 +0000 (01:09 +0000)]
Use working Perl syntax in example print hostname command.
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1773
9efc2488-bf62-4759-914b-
345cdb29e865
dbs [Thu, 10 Sep 2009 01:06:30 +0000 (01:06 +0000)]
Add a linefeed to the Perl "print hostname" command
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1772
9efc2488-bf62-4759-914b-
345cdb29e865
scottmk [Tue, 8 Sep 2009 20:46:23 +0000 (20:46 +0000)]
1. Moved the declaration of the osrf_host_config struct out of the header.
Nothing outside of osrf_settings.c needs access to any members of this
struct.
2. Made the osrf_settings_new_host_config function static; removed its
prototype from the header.
3. Made the "config" pointer static.
4. Rearranged osrf_settings_free_host_config a bit to protect against
attempts to free the cached config twice.
5. Finished adding doxygen-style markup comments.
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1771
9efc2488-bf62-4759-914b-
345cdb29e865
scottmk [Tue, 8 Sep 2009 14:29:45 +0000 (14:29 +0000)]
Tweaking comments for doxygen:
Moved the overview from the implementation file to the header.
Deleted some comments from the header so that they wouldn't
override more complete comments from the implementation file.
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1770
9efc2488-bf62-4759-914b-
345cdb29e865
scottmk [Fri, 4 Sep 2009 21:47:55 +0000 (21:47 +0000)]
Enhanced the error messages from osrf_settings_host_value() and
osrf_settings_host_value_object() to include the requested
search path. That should make it easier to identify the caller
and thereby figure out what went wrong.
Also: added a couple of Doxygen-style comments.
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1769
9efc2488-bf62-4759-914b-
345cdb29e865
erickson [Fri, 4 Sep 2009 15:38:46 +0000 (15:38 +0000)]
for consistency with other config files and ease of install automation, set the default password to 'password'
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1768
9efc2488-bf62-4759-914b-
345cdb29e865
erickson [Fri, 4 Sep 2009 13:22:05 +0000 (13:22 +0000)]
assume 'yes' to fetching dependencies; reduce the verbosity of package downloads
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1767
9efc2488-bf62-4759-914b-
345cdb29e865
scottmk [Thu, 3 Sep 2009 20:00:49 +0000 (20:00 +0000)]
1. In osrfListSetDefault(): install the standard function
free() as the default item-freeing callback function,
instead of the gossamer-thin and useless wrapper for it,
osrfListVanillaFree(). This change eliminates a layer of
function call overhead.
2. Eliminate osrfListVanillaFree() as neither used nor useful.
3. Add doxygen-style comments to document every function.
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1766
9efc2488-bf62-4759-914b-
345cdb29e865
scottmk [Thu, 3 Sep 2009 12:34:42 +0000 (12:34 +0000)]
1. A minor streamlining of va_list_to_string(), to eliminate
a layer of copying.
2. Corrected some faulty comments for doxygen.
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1765
9efc2488-bf62-4759-914b-
345cdb29e865
erickson [Mon, 31 Aug 2009 17:17:28 +0000 (17:17 +0000)]
repaired partial change from 'class' to 'pkg'. added use strict/warnings
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1764
9efc2488-bf62-4759-914b-
345cdb29e865
scottmk [Mon, 31 Aug 2009 03:48:26 +0000 (03:48 +0000)]
1. Add comments to be recognized by doxygen or other such
documentation generators.
2. Change the values returned by buffer_fadd(), buffer_add(),
buffer_add_n(), and buffer_add_char() to make them more
consistent. In practice we never pay any attention to the
return values anyway.
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1763
9efc2488-bf62-4759-914b-
345cdb29e865
sboyette [Fri, 28 Aug 2009 20:31:31 +0000 (20:31 +0000)]
changed 'my' globals to 'our' globals for testing purposes
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1762
9efc2488-bf62-4759-914b-
345cdb29e865
sboyette [Fri, 28 Aug 2009 20:31:30 +0000 (20:31 +0000)]
first tests
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1761
9efc2488-bf62-4759-914b-
345cdb29e865
sboyette [Fri, 28 Aug 2009 20:31:30 +0000 (20:31 +0000)]
more cleanup and documentation in progress
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1760
9efc2488-bf62-4759-914b-
345cdb29e865
sboyette [Fri, 28 Aug 2009 20:31:29 +0000 (20:31 +0000)]
yanking LogServer test file
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1759
9efc2488-bf62-4759-914b-
345cdb29e865
sboyette [Fri, 28 Aug 2009 20:31:28 +0000 (20:31 +0000)]
removing use of LogServer
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1758
9efc2488-bf62-4759-914b-
345cdb29e865
sboyette [Fri, 28 Aug 2009 20:31:28 +0000 (20:31 +0000)]
removing _json_hint_to_class
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1757
9efc2488-bf62-4759-914b-
345cdb29e865
sboyette [Fri, 28 Aug 2009 20:31:27 +0000 (20:31 +0000)]
shuffling around, adding POD stubs
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1756
9efc2488-bf62-4759-914b-
345cdb29e865
sboyette [Tue, 25 Aug 2009 18:51:00 +0000 (18:51 +0000)]
removing OSRF::Utils::LogServer at berick's suggestion
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1755
9efc2488-bf62-4759-914b-
345cdb29e865
sboyette [Tue, 25 Aug 2009 18:51:00 +0000 (18:51 +0000)]
rearranging things a bit, docs. no actual code changes.
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1754
9efc2488-bf62-4759-914b-
345cdb29e865
sboyette [Tue, 25 Aug 2009 15:45:01 +0000 (15:45 +0000)]
new test files for Utils breakout
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1753
9efc2488-bf62-4759-914b-
345cdb29e865
sboyette [Tue, 25 Aug 2009 15:45:01 +0000 (15:45 +0000)]
removed $VERSION construct which caused undef warnings when not under svn, and only occurred in 2 modules
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1752
9efc2488-bf62-4759-914b-
345cdb29e865
sboyette [Tue, 25 Aug 2009 15:04:43 +0000 (15:04 +0000)]
method prettyJSON doesnt exist anymore
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1751
9efc2488-bf62-4759-914b-
345cdb29e865
sboyette [Tue, 25 Aug 2009 15:04:42 +0000 (15:04 +0000)]
ditto
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1750
9efc2488-bf62-4759-914b-
345cdb29e865
sboyette [Tue, 25 Aug 2009 15:04:41 +0000 (15:04 +0000)]
that last version change was rather poorly timed, as it turns out
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1749
9efc2488-bf62-4759-914b-
345cdb29e865
sboyette [Fri, 21 Aug 2009 13:17:29 +0000 (13:17 +0000)]
local doc updates for recent changes. wondering how much point there is in keeping these around, long-term
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1748
9efc2488-bf62-4759-914b-
345cdb29e865
sboyette [Fri, 21 Aug 2009 13:17:28 +0000 (13:17 +0000)]
preƫmptive version bump
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1747
9efc2488-bf62-4759-914b-
345cdb29e865
sboyette [Fri, 21 Aug 2009 13:17:28 +0000 (13:17 +0000)]
'make check' works as promised. perl tests moved to 'check' target
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1746
9efc2488-bf62-4759-914b-
345cdb29e865
sboyette [Thu, 20 Aug 2009 13:02:50 +0000 (13:02 +0000)]
updating MANIFEST for Module::Build-ness
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1744
9efc2488-bf62-4759-914b-
345cdb29e865
sboyette [Mon, 17 Aug 2009 00:34:51 +0000 (00:34 +0000)]
added separate install fail diagnostic message
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1743
9efc2488-bf62-4759-914b-
345cdb29e865