Commit cbbf08a7 authored by Robert Shearman's avatar Robert Shearman Committed by Alexandre Julliard

- Use InterlockedIncrement for the ipid counter instead of a critical

section (suggested by Mike Hearn). - Remove a line added by a bad merge. - Implement RemUnkStub_Disconnect. - Remove all of the RPC disconnect code.
parent 963ac3f0
......@@ -246,7 +246,7 @@ APARTMENT* COM_CreateApartment(DWORD model)
list_init(&apt->proxies);
list_init(&apt->stubmgrs);
apt->ipidc = 1;
apt->ipidc = 0;
apt->refs = 1;
apt->remunk_exported = FALSE;
apt->oidc = 1;
......
......@@ -123,7 +123,7 @@ struct apartment
DWORD tid; /* thread id (RO) */
HANDLE thread; /* thread handle (RO) */
OXID oxid; /* object exporter ID (RO) */
DWORD ipidc; /* interface pointer ID counter, starts at 1 (CS cs) */
DWORD ipidc; /* interface pointer ID counter, starts at 1 (LOCK) */
HWND win; /* message window (RO) */
CRITICAL_SECTION cs; /* thread safety */
LPMESSAGEFILTER filter; /* message filter (CS cs) */
......
......@@ -349,7 +349,6 @@ static HRESULT proxy_manager_construct(
This->oid = oid;
This->refs = 1;
This->sorflags = sorflags;
/* the DCOM draft specification states that the SORF_NOPING flag is
* proxy manager specific, not ifproxy specific, so this implies that we
......
......@@ -509,6 +509,8 @@ static void WINAPI RemUnkStub_Disconnect(LPRPCSTUBBUFFER iface)
{
RemUnkStub *This = (RemUnkStub *)iface;
TRACE("(%p)->Disconnect()\n",This);
IUnknown_Release(This->iface);
This->iface = NULL;
}
static HRESULT WINAPI RemUnkStub_Invoke(LPRPCSTUBBUFFER iface,
......
......@@ -54,7 +54,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(ole);
#define REQTYPE_REQUEST 0
#define REQTYPE_RESPONSE 1
#define REQTYPE_DISCONNECT 2
struct request_header
{
......@@ -71,13 +70,6 @@ struct response_header
DWORD retval;
};
/* used when shutting down a pipe, e.g. at the end of a process */
struct disconnect_header
{
DWORD reqid;
wine_marshal_id mid; /* mid of stub to delete */
};
#define REQSTATE_START 0
#define REQSTATE_REQ_QUEUED 1
......@@ -291,34 +283,11 @@ static ULONG WINAPI
PipeBuf_Release(LPRPCCHANNELBUFFER iface) {
PipeBuf *This = (PipeBuf *)iface;
ULONG ref;
#if 0
struct disconnect_header header;
HANDLE pipe;
DWORD reqtype = REQTYPE_DISCONNECT;
DWORD magic;
#endif
ref = InterlockedDecrement(&This->ref);
if (ref)
return ref;
#if 0 /* no longer needed now we've got IRemUnknown ref counting */
memcpy(&header.mid, &This->mid, sizeof(wine_marshal_id));
pipe = PIPE_FindByMID(&This->mid);
write_pipe(pipe, &reqtype, sizeof(reqtype));
write_pipe(pipe, &header, sizeof(struct disconnect_header));
TRACE("written disconnect packet\n");
/* prevent a disconnect race with the other side: this isn't
* necessary for real dcom but the test suite needs it */
read_pipe(pipe, &magic, sizeof(magic));
if (magic != 0xcafebabe) ERR("bad disconnection magic: expecting 0xcafebabe but got 0x%lx\n", magic);
#endif
HeapFree(GetProcessHeap(),0,This);
return 0;
}
......@@ -771,42 +740,7 @@ COM_RpcReceive(struct pipe *xpipe) {
EnterCriticalSection(&(xpipe->crit));
/* only received by servers */
if (reqtype == REQTYPE_DISCONNECT) {
struct disconnect_header header;
struct stub_manager *stubmgr;
DWORD magic = 0xcafebabe;
APARTMENT *apt;
hres = read_pipe(xhPipe, &header, sizeof(header));
if (hres) {
ERR("could not read disconnect header\n");
goto disconnect_end;
}
TRACE("read disconnect header\n");
if (!(apt = COM_ApartmentFromOXID(header.mid.oxid, TRUE)))
{
ERR("Could not map OXID %s to apartment object in disconnect\n", wine_dbgstr_longlong(header.mid.oxid));
goto disconnect_end;
}
if (!(stubmgr = get_stub_manager(apt, header.mid.oid)))
{
ERR("could not locate stub to disconnect, mid.oid=%s\n", wine_dbgstr_longlong(header.mid.oid));
COM_ApartmentRelease(apt);
goto disconnect_end;
}
stub_manager_ext_release(stubmgr, 1);
stub_manager_int_release(stubmgr);
COM_ApartmentRelease(apt);
disconnect_end:
write_pipe(xhPipe, &magic, sizeof(magic));
goto end;
} else if (reqtype == REQTYPE_REQUEST) {
if (reqtype == REQTYPE_REQUEST) {
struct rpc *xreq;
RPC_GetRequest(&xreq);
......
......@@ -334,9 +334,7 @@ static inline HRESULT generate_ipid(struct stub_manager *m, IPID *ipid)
return hr;
}
EnterCriticalSection(&m->apt->cs);
ipid->Data1 = m->apt->ipidc++;
LeaveCriticalSection(&m->apt->cs);
ipid->Data1 = InterlockedIncrement(&m->apt->ipidc);
ipid->Data2 = (USHORT)m->apt->tid;
ipid->Data3 = (USHORT)GetCurrentProcessId();
return S_OK;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment