[Opensrf-commits] r1524 - in trunk: include/opensrf src/libopensrf
svn at svn.open-ils.org
svn at svn.open-ils.org
Sat Dec 6 15:37:38 EST 2008
Author: miker
Date: 2008-12-06 15:37:34 -0500 (Sat, 06 Dec 2008)
New Revision: 1524
Modified:
trunk/include/opensrf/transport_client.h
trunk/src/libopensrf/transport_client.c
Log:
Patch from Scott McKellar:
1. Corrected a few minor typos in the header.
2. Made the client_message_handler function static, since no other source
file references it by name.
3. Moved several things from the header to the implementation file, of
which all are internal details not referenced elsewhere:
-- The macros MESSAGE_LIST_HEAD and MESSAGE_LIST_ITEM
-- The declaration for struct message_list_struct, along with the
associated typedefs
Modified: trunk/include/opensrf/transport_client.h
===================================================================
--- trunk/include/opensrf/transport_client.h 2008-12-06 02:28:54 UTC (rev 1523)
+++ trunk/include/opensrf/transport_client.h 2008-12-06 20:37:34 UTC (rev 1524)
@@ -1,3 +1,7 @@
+#ifndef TRANSPORT_CLIENT_H
+#define TRANSPORT_CLIENT_H
+
+#include <time.h>
#include <opensrf/transport_session.h>
#include <opensrf/utils.h>
#include <opensrf/log.h>
@@ -2,30 +6,9 @@
-#include <time.h>
+struct message_list_struct;
-#ifndef TRANSPORT_CLIENT_H
-#define TRANSPORT_CLIENT_H
-
-#define MESSAGE_LIST_HEAD 1
-#define MESSAGE_LIST_ITEM 2
-
-
// ---------------------------------------------------------------------------
-// Represents a node in a linked list. The node holds a pointer to the next
-// node (which is null unless set), a pointer to a transport_message, and
-// and a type variable (which is not really curently necessary).
-// ---------------------------------------------------------------------------
-struct message_list_struct {
- struct message_list_struct* next;
- transport_message* message;
- int type;
-};
-
-typedef struct message_list_struct transport_message_list;
-typedef struct message_list_struct transport_message_node;
-
-// ---------------------------------------------------------------------------
// Our client struct. We manage a list of messages and a controlling session
// ---------------------------------------------------------------------------
struct transport_client_struct {
- transport_message_list* m_list;
+ struct message_list_struct* m_list;
transport_session* session;
@@ -36,7 +19,7 @@
typedef struct transport_client_struct transport_client;
// ---------------------------------------------------------------------------
-// Allocates and initializes and transport_client. This does no connecting
+// Allocates and initializes a transport_client. This does no connecting
// The user must call client_free(client) when finished with the allocated
// object.
// if port > 0 => connect via TCP
@@ -63,7 +46,7 @@
int client_free( transport_client* client );
// ---------------------------------------------------------------------------
-// Sends the given message. The message must at least have the recipient
+// Sends the given message. The message must at least have the recipient
// field set.
// ---------------------------------------------------------------------------
int client_send_message( transport_client* client, transport_message* msg );
@@ -74,14 +57,7 @@
int client_connected( const transport_client* client );
// ---------------------------------------------------------------------------
-// This is the message handler required by transport_session. This handler
-// takes all incoming messages and puts them into the back of a linked list
-// of messages.
-// ---------------------------------------------------------------------------
-void client_message_handler( void* client, transport_message* msg );
-
-// ---------------------------------------------------------------------------
-// If there are any message in the message list, the 'oldest' message is
+// If there are any messages in the message list, the 'oldest' message is
// returned. If not, this function will wait at most 'timeout' seconds
// for a message to arrive. Specifying -1 means that this function will not
// return unless a message arrives.
Modified: trunk/src/libopensrf/transport_client.c
===================================================================
--- trunk/src/libopensrf/transport_client.c 2008-12-06 02:28:54 UTC (rev 1523)
+++ trunk/src/libopensrf/transport_client.c 2008-12-06 20:37:34 UTC (rev 1524)
@@ -1,6 +1,23 @@
#include <opensrf/transport_client.h>
+#define MESSAGE_LIST_HEAD 1
+#define MESSAGE_LIST_ITEM 2
+// ---------------------------------------------------------------------------
+// Represents a node in a linked list. The node holds a pointer to the next
+// node (which is null unless set), a pointer to a transport_message, and
+// and a type variable (which is not really curently necessary).
+// ---------------------------------------------------------------------------
+struct message_list_struct {
+ struct message_list_struct* next;
+ transport_message* message;
+ int type;
+};
+typedef struct message_list_struct transport_message_list;
+typedef struct message_list_struct transport_message_node;
+
+static void client_message_handler( void* client, transport_message* msg );
+
//int main( int argc, char** argv );
/*
@@ -174,8 +191,12 @@
}
}
-/* throw the message into the message queue */
-void client_message_handler( void* client, transport_message* msg ){
+// ---------------------------------------------------------------------------
+// This is the message handler required by transport_session. This handler
+// takes all incoming messages and puts them into the back of a linked list
+// of messages.
+// ---------------------------------------------------------------------------
+static void client_message_handler( void* client, transport_message* msg ){
if(client == NULL) return;
if(msg == NULL) return;
More information about the opensrf-commits
mailing list