Commit in reactos/lib/rpcrt4 on MAIN
rpc_binding.c+11-771.2 -> 1.3
rpc_server.c+4-21.1 -> 1.2
winehq2ros.patch+11-61.1 -> 1.2
+26-85
3 modified files
Sync to Wine-20040716:
Mike Hearn <mh@codeweavers.com>
- Don't ERR on a used connection being destroyed.
- Don't print an extra newline in the olerelay code.
- Remove the RPC connection cache as Windows does not allow multiple
  binds on the same connection.
- Correct connection releases on error path in RPCRT4_OpenBinding.

reactos/lib/rpcrt4
rpc_binding.c 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- rpc_binding.c	16 Jun 2004 18:21:24 -0000	1.2
+++ rpc_binding.c	8 Aug 2004 21:07:12 -0000	1.3
@@ -46,17 +46,6 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(ole);
 
-static RpcConnection* conn_cache;
-
-static CRITICAL_SECTION conn_cache_cs;
-static CRITICAL_SECTION_DEBUG critsect_debug =
-{
-    0, 0, &conn_cache_cs,
-    { &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
-      0, 0, { 0, (DWORD)(__FILE__ ": conn_cache_cs") }
-};
-static CRITICAL_SECTION conn_cache_cs = { &critsect_debug, -1, 0, 0, 0, 0 };
-
 LPSTR RPCRT4_strndupA(LPCSTR src, INT slen)
 {
   DWORD len;
@@ -122,11 +111,6 @@
   NewConnection->Used = Binding;
   NewConnection->MaxTransmissionSize = RPC_MAX_PACKET_SIZE;
 
-  EnterCriticalSection(&conn_cache_cs);
-  NewConnection->Next = conn_cache;
-  conn_cache = NewConnection;
-  LeaveCriticalSection(&conn_cache_cs);
-
   TRACE("connection: %p\n", NewConnection);
   *Connection = NewConnection;
 
@@ -135,21 +119,7 @@
 
 RPC_STATUS RPCRT4_DestroyConnection(RpcConnection* Connection)
 {
-  RpcConnection* PrevConnection;
-
   TRACE("connection: %p\n", Connection);
-  if (Connection->Used) ERR("connection is still in use\n");
-
-  EnterCriticalSection(&conn_cache_cs);
-  PrevConnection = conn_cache;
-  if (PrevConnection == Connection) {
-    conn_cache = Connection->Next;
-  } else {
-    while (PrevConnection && PrevConnection->Next != Connection)
-      PrevConnection = PrevConnection->Next;
-    if (PrevConnection) PrevConnection->Next = Connection->Next;
-  }
-  LeaveCriticalSection(&conn_cache_cs);
 
   RPCRT4_CloseConnection(Connection);
   RPCRT4_strfree(Connection->Endpoint);
@@ -159,44 +129,6 @@
   return RPC_S_OK;
 }
 
-RPC_STATUS RPCRT4_GetConnection(RpcConnection** Connection, BOOL server, LPSTR Protseq, LPSTR NetworkAddr, LPSTR Endpoint, LPSTR NetworkOptions, RpcBinding* Binding)
-{
-  RpcConnection* NewConnection;
-
-  if (!server) {
-    EnterCriticalSection(&conn_cache_cs);
-    for (NewConnection = conn_cache; NewConnection; NewConnection = NewConnection->Next) {
-      if (NewConnection->Used) continue;
-      if (NewConnection->server != server) continue;
-      if (Protseq && strcmp(NewConnection->Protseq, Protseq)) continue;
-      if (NetworkAddr && strcmp(NewConnection->NetworkAddr, NetworkAddr)) continue;
-      if (Endpoint && strcmp(NewConnection->Endpoint, Endpoint)) continue;
-      /* this connection fits the bill */
-      NewConnection->Used = Binding;
-      break;
-    }
-    LeaveCriticalSection(&conn_cache_cs);
-    if (NewConnection) {
-      TRACE("cached connection: %p\n", NewConnection);
-      *Connection = NewConnection;
-      return RPC_S_OK;
-    }
-  }
-  return RPCRT4_CreateConnection(Connection, server, Protseq, NetworkAddr, Endpoint, NetworkOptions, Binding);
-}
-
-RPC_STATUS RPCRT4_ReleaseConnection(RpcConnection* Connection)
-{
-  TRACE("connection: %p\n", Connection);
-  Connection->Used = NULL;
-  if (!Connection->server) {
-    /* cache the open connection for reuse later */
-    /* FIXME: we should probably clean the cache someday */
-    return RPC_S_OK;
-  }
-  return RPCRT4_DestroyConnection(Connection);
-}
-
 RPC_STATUS RPCRT4_OpenConnection(RpcConnection* Connection)
 {
   TRACE("(Connection == ^%p)\n", Connection);
@@ -514,7 +446,9 @@
   if (!Binding->server && Binding->FromConn &&
       memcmp(&Binding->FromConn->ActiveInterface, InterfaceId,
              sizeof(RPC_SYNTAX_IDENTIFIER))) {
-    RPCRT4_ReleaseConnection(Binding->FromConn);
+
+    TRACE("releasing pre-existing connection\n");
+    RPCRT4_DestroyConnection(Binding->FromConn);
     Binding->FromConn = NULL;
   } else {
     /* we already have an connection with acceptable binding, so use it */
@@ -525,7 +459,7 @@
   }
   
   /* create a new connection */
-  RPCRT4_GetConnection(&NewConnection, Binding->server, Binding->Protseq, Binding->NetworkAddr, Binding->Endpoint, NULL, Binding);
+  RPCRT4_CreateConnection(&NewConnection, Binding->server, Binding->Protseq, Binding->NetworkAddr, Binding->Endpoint, NULL, Binding);
   *Connection = NewConnection;
   status = RPCRT4_OpenConnection(NewConnection);
   if (status != RPC_S_OK) {
@@ -547,27 +481,27 @@
 
     status = RPCRT4_Send(*Connection, hdr, NULL, 0);
     if (status != RPC_S_OK) {
-      RPCRT4_ReleaseConnection(*Connection);
+      RPCRT4_DestroyConnection(*Connection);
       return status;
     }
 
     response = HeapAlloc(GetProcessHeap(), 0, RPC_MAX_PACKET_SIZE);
     if (response == NULL) {
       WARN("Can't allocate memory for binding response\n");
-      RPCRT4_ReleaseConnection(*Connection);
+      RPCRT4_DestroyConnection(*Connection);
       return E_OUTOFMEMORY;
     }
 
     /* get a reply */
     if (!ReadFile(NewConnection->conn, response, RPC_MAX_PACKET_SIZE, &count, NULL)) {
       WARN("ReadFile failed with error %ld\n", GetLastError());
-      RPCRT4_ReleaseConnection(*Connection);
+      RPCRT4_DestroyConnection(*Connection);
       return RPC_S_PROTOCOL_ERROR;
     }
 
     if (count < sizeof(response_hdr->common)) {
       WARN("received invalid header\n");
-      RPCRT4_ReleaseConnection(*Connection);
+      RPCRT4_DestroyConnection(*Connection);
       return RPC_S_PROTOCOL_ERROR;
     }
 
@@ -577,13 +511,13 @@
         response_hdr->common.rpc_ver_minor != RPC_VER_MINOR ||
         response_hdr->common.ptype != PKT_BIND_ACK) {
       WARN("invalid protocol version or rejection packet\n");
-      RPCRT4_ReleaseConnection(Binding->FromConn);
+      RPCRT4_DestroyConnection(*Connection);
       return RPC_S_PROTOCOL_ERROR;
     }
 
     if (response_hdr->bind_ack.max_tsize < RPC_MIN_PACKET_SIZE) {
       WARN("server doesn't allow large enough packets\n");
-      RPCRT4_ReleaseConnection(Binding->FromConn);
+      RPCRT4_DestroyConnection(*Connection);
       return RPC_S_PROTOCOL_ERROR;
     }
 
@@ -601,7 +535,7 @@
   TRACE("(Binding == ^%p)\n", Binding);
   if (!Connection) return RPC_S_OK;
   if (Binding->FromConn == Connection) return RPC_S_OK;
-  return RPCRT4_ReleaseConnection(Connection);
+  return RPCRT4_DestroyConnection(Connection);
 }
 
 /* utility functions for string composing and parsing */

reactos/lib/rpcrt4
rpc_server.c 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- rpc_server.c	4 May 2004 20:06:26 -0000	1.1
+++ rpc_server.c	8 Aug 2004 21:07:12 -0000	1.2
@@ -153,6 +153,7 @@
     cif = cif->Next;
   }
   LeaveCriticalSection(&server_cs);
+  TRACE("returning %p for %s\n", cif, debugstr_guid(object));
   return cif;
 }
 
@@ -232,17 +233,18 @@
       /* FIXME: do more checks! */
       if (hdr->bind.max_tsize < RPC_MIN_PACKET_SIZE ||
           !UuidIsNil(&conn->ActiveInterface.SyntaxGUID, &status)) {
+        TRACE("packet size less than min size, or active interface syntax guid non-null\n");
         sif = NULL;
       } else {
         sif = RPCRT4_find_interface(NULL, &hdr->bind.abstract, FALSE);
       }
       if (sif == NULL) {
-        TRACE("rejecting bind request\n");
+        TRACE("rejecting bind request on connection %p\n", conn);
         /* Report failure to client. */
         response = RPCRT4_BuildBindNackHeader(NDR_LOCAL_DATA_REPRESENTATION,
                                               RPC_VER_MAJOR, RPC_VER_MINOR);
       } else {
-        TRACE("accepting bind request\n");
+        TRACE("accepting bind request on connection %p\n", conn);
 
         /* accept. */
         response = RPCRT4_BuildBindAckHeader(NDR_LOCAL_DATA_REPRESENTATION,

reactos/lib/rpcrt4
winehq2ros.patch 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- winehq2ros.patch	4 May 2004 20:06:26 -0000	1.1
+++ winehq2ros.patch	8 Aug 2004 21:07:12 -0000	1.2
@@ -1,6 +1,11 @@
---- rpc_server.c	Tue May  4 17:37:56 2004
-+++ rpc_server.c	Tue May  4 19:54:24 2004
-@@ -184,6 +184,7 @@
+Index: rpc_server.c
+===================================================================
+RCS file: /home/wine/wine/dlls/rpcrt4/rpc_server.c,v
+retrieving revision 1.30
+diff -u -r1.30 rpc_server.c
+--- rpc_server.c	17 Jun 2004 19:54:34 -0000	1.30
++++ rpc_server.c	8 Aug 2004 21:19:01 -0000
+@@ -185,6 +185,7 @@
    return packet;
  }
  
@@ -8,7 +13,7 @@
  typedef struct {
    PRPC_MESSAGE msg;
    void* buf;
-@@ -204,20 +205,25 @@
+@@ -205,20 +206,25 @@
    TRACE("returning failure packet\n");
    return EXCEPTION_EXECUTE_HANDLER;
  }
@@ -34,7 +39,7 @@
  
    switch (hdr->common.ptype) {
      case PKT_BIND:
-@@ -303,11 +309,15 @@
+@@ -305,11 +311,15 @@
                    MAKEWORD(hdr->common.drep[2], hdr->common.drep[3]));
  
        /* dispatch */
@@ -50,7 +55,7 @@
  
        /* send response packet */
        I_RpcSend(msg);
-@@ -331,7 +341,9 @@
+@@ -333,7 +343,9 @@
    I_RpcFreeBuffer(msg);
    msg->Buffer = NULL;
    RPCRT4_FreeHeader(hdr);
CVSspam 0.2.8