[Opensrf-commits] r1837 - in trunk: include/opensrf src/libopensrf (scottmk)
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Nov 2 17:59:49 EST 2009
Author: scottmk
Date: 2009-11-02 17:59:43 -0500 (Mon, 02 Nov 2009)
New Revision: 1837
Modified:
trunk/include/opensrf/transport_client.h
trunk/src/libopensrf/transport_client.c
Log:
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
Modified: trunk/include/opensrf/transport_client.h
===================================================================
--- trunk/include/opensrf/transport_client.h 2009-11-02 14:41:22 UTC (rev 1836)
+++ trunk/include/opensrf/transport_client.h 2009-11-02 22:59:43 UTC (rev 1837)
@@ -52,6 +52,8 @@
transport_message* client_recv( transport_client* client, int timeout );
+int client_sock_fd( transport_client* client );
+
#ifdef __cplusplus
}
#endif
Modified: trunk/src/libopensrf/transport_client.c
===================================================================
--- trunk/src/libopensrf/transport_client.c 2009-11-02 14:41:22 UTC (rev 1836)
+++ trunk/src/libopensrf/transport_client.c 2009-11-02 22:59:43 UTC (rev 1837)
@@ -58,14 +58,15 @@
/**
@brief Allocate and initialize a transport_client.
- @param server Hostname or IP address where the Jabber server resides.
+ @param server Domain name where the Jabber server resides.
@param port Port used for connecting to Jabber (0 if using UNIX domain socket).
@param unix_path Name of Jabber's socket in file system (if using UNIX domain socket).
@param component Boolean; true if we're a Jabber component.
@return A pointer to a newly created transport_client.
- Create a transport_client with a transport_session and an empty message queue (but don't open a connection yet).
- Install a callback function in the transport_session to enqueue incoming messages.
+ Create a transport_client with a transport_session and an empty message queue (but don't
+ open a connection yet). Install a callback function in the transport_session to enqueue
+ incoming messages.
The calling code is responsible for freeing the transport_client by calling client_free().
*/
@@ -318,3 +319,10 @@
return 1;
}
+int client_sock_fd( transport_client* client )
+{
+ if( !client )
+ return 0;
+ else
+ return client->session->sock_id;
+}
More information about the opensrf-commits
mailing list