Mike McCormack : rpcrt4: Abstract RPCRT4_SpawnConnection.
Alexandre Julliard
julliard at wine.codeweavers.com
Fri Apr 21 05:02:39 CDT 2006
Module: wine
Branch: refs/heads/master
Commit: 83109e493704890968b6d850e60521ecbc729e6e
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=83109e493704890968b6d850e60521ecbc729e6e
Author: Mike McCormack <mike at codeweavers.com>
Date: Fri Apr 21 15:39:27 2006 +0900
rpcrt4: Abstract RPCRT4_SpawnConnection.
---
dlls/rpcrt4/rpc_binding.h | 6 ++++++
dlls/rpcrt4/rpc_transport.c | 31 +++++++++++++++++--------------
2 files changed, 23 insertions(+), 14 deletions(-)
diff --git a/dlls/rpcrt4/rpc_binding.h b/dlls/rpcrt4/rpc_binding.h
index 6a6d4c4..6f973ca 100644
--- a/dlls/rpcrt4/rpc_binding.h
+++ b/dlls/rpcrt4/rpc_binding.h
@@ -44,6 +44,7 @@ struct protseq_ops {
char *name;
RPC_STATUS (*open_connection)(RpcConnection *conn);
HANDLE (*get_connect_wait_handle)(RpcConnection *conn);
+ RPC_STATUS (*handoff)(RpcConnection *old_conn, RpcConnection *new_conn);
int (*read)(RpcConnection *conn, void *buffer, unsigned int len);
int (*write)(RpcConnection *conn, const void *buffer, unsigned int len);
int (*close)(RpcConnection *conn);
@@ -121,4 +122,9 @@ static inline HANDLE rpcrt4_conn_get_wai
return Connection->ops->get_connect_wait_handle(Connection);
}
+static inline RPC_STATUS rpcrt4_conn_handoff(RpcConnection *old_conn, RpcConnection *new_conn)
+{
+ return old_conn->ops->handoff(old_conn, new_conn);
+}
+
#endif
diff --git a/dlls/rpcrt4/rpc_transport.c b/dlls/rpcrt4/rpc_transport.c
index be10065..7f61506 100644
--- a/dlls/rpcrt4/rpc_transport.c
+++ b/dlls/rpcrt4/rpc_transport.c
@@ -20,8 +20,6 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * TODO:
- * - a whole lot
*/
#include <stdarg.h>
@@ -161,6 +159,18 @@ static HANDLE rpcrt4_conn_np_get_connect
return conn->ovl.hEvent;
}
+static RPC_STATUS rpcrt4_conn_np_handoff(RpcConnection *old_conn, RpcConnection *new_conn)
+{
+ /* because of the way named pipes work, we'll transfer the connected pipe
+ * to the child, then reopen the server binding to continue listening */
+
+ new_conn->conn = old_conn->conn;
+ new_conn->ovl = old_conn->ovl;
+ old_conn->conn = 0;
+ memset(&old_conn->ovl, 0, sizeof(old_conn->ovl));
+ return RPCRT4_OpenConnection(old_conn);
+}
+
static int rpcrt4_conn_np_read(RpcConnection *Connection,
void *buffer, unsigned int count)
{
@@ -198,6 +208,7 @@ struct protseq_ops protseq_list[] = {
{ "ncacn_np",
rpcrt4_ncalrpc_open,
rpcrt4_conn_np_get_connect_event,
+ rpcrt4_conn_np_handoff,
rpcrt4_conn_np_read,
rpcrt4_conn_np_write,
rpcrt4_conn_np_close,
@@ -205,6 +216,7 @@ struct protseq_ops protseq_list[] = {
{ "ncalrpc",
rpcrt4_ncacn_np_open,
rpcrt4_conn_np_get_connect_event,
+ rpcrt4_conn_np_handoff,
rpcrt4_conn_np_read,
rpcrt4_conn_np_write,
rpcrt4_conn_np_close,
@@ -261,23 +273,14 @@ RPC_STATUS RPCRT4_CreateConnection(RpcCo
RPC_STATUS RPCRT4_SpawnConnection(RpcConnection** Connection, RpcConnection* OldConnection)
{
- RpcConnection* NewConnection;
RPC_STATUS err;
- err = RPCRT4_CreateConnection(&NewConnection, OldConnection->server,
+ err = RPCRT4_CreateConnection(Connection, OldConnection->server,
rpcrt4_conn_get_name(OldConnection),
OldConnection->NetworkAddr,
OldConnection->Endpoint, NULL, NULL);
- if (err == RPC_S_OK) {
- /* because of the way named pipes work, we'll transfer the connected pipe
- * to the child, then reopen the server binding to continue listening */
- NewConnection->conn = OldConnection->conn;
- NewConnection->ovl = OldConnection->ovl;
- OldConnection->conn = 0;
- memset(&OldConnection->ovl, 0, sizeof(OldConnection->ovl));
- *Connection = NewConnection;
- RPCRT4_OpenConnection(OldConnection);
- }
+ if (err == RPC_S_OK)
+ rpcrt4_conn_handoff(OldConnection, *Connection);
return err;
}
More information about the wine-cvs
mailing list