urpConnect update
a=lsv@sparc.spb.su
This commit is contained in:
idk%eng.sun.com 2001-06-23 04:17:49 +00:00
Родитель 3aeb80d883
Коммит 51927a315d
11 изменённых файлов: 258 добавлений и 76 удалений

Просмотреть файл

@ -28,15 +28,16 @@ NS_IMPL_THREADSAFE_ISUPPORTS1(urpComponentFactory, nsIFactory)
//static nsISupports* compM = nsnull;
//nsCOMPtr<nsIComponentManager> compM = nsnull;
urpComponentFactory::urpComponentFactory(const char *_location, const nsCID &aCID, nsIComponentManager* m) {
urpComponentFactory::urpComponentFactory(const char *_location, const nsCID &aCID, nsISupports* m) {
NS_INIT_ISUPPORTS();
location = nsCRT::strdup(_location);
aClass = aCID;
compM = m;
compM = (nsIComponentManager*)m;
}
urpComponentFactory::~urpComponentFactory() {
printf("destructor or urpComponentFactory\n");
NS_RELEASE(compM);
nsCRT::free((char*)location);
}

Просмотреть файл

@ -28,12 +28,12 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSIFACTORY
urpComponentFactory(const char *location, const nsCID &aCID,
nsIComponentManager* m);
nsISupports* m);
virtual ~urpComponentFactory();
private:
char *location;
nsCID aClass;
nsCOMPtr<nsIComponentManager> compM;
nsIComponentManager* compM;
};
#endif

Просмотреть файл

@ -17,7 +17,7 @@
* Rights Reserved.
*
* Contributor(s):
* Sergey Lunegov <lvv@sparc.spb.su>
* Igor Kushnirskiy <idk@eng.sun.com>
*/
/*
@ -59,12 +59,12 @@ const char xpcomKeyName[] = "software/mozilla/XPCOM/components";
NS_IMPL_THREADSAFE_ISUPPORTS(urpComponentLoader,NS_GET_IID(nsIComponentLoader));
nsCOMPtr<nsIComponentManager> compM = nsnull;
//nsCOMPtr<nsIComponentManager> compM = nsnull;
static bcIORB* orb = nsnull;
static urpTransport* transport;
static urpManager* man;
static bcIStub* stub;
static nsISupports* proxy;
static nsISupports* proxy = nsnull;
urpComponentLoader::urpComponentLoader()
: mCompMgr(NULL),
@ -86,9 +86,9 @@ urpComponentLoader::urpComponentLoader()
}
_orb->GetORB(&orb);
// bcOID oid;
bcOID oid = -860880895;
bcOID oid = 1601175553;
transport = new urpConnector();
PRStatus status = transport->Open("socket,host=localhost,port=20009");
PRStatus status = transport->Open("socket,host=indra,port=20009");
if(status != PR_SUCCESS) {
printf("Error during opening connection\n");
exit(-1);
@ -98,15 +98,15 @@ urpComponentLoader::urpComponentLoader()
stub = new urpStub(man, conn);
// oid = orb->RegisterStub(stub);
orb->RegisterStubWithOID(stub, &oid);
xpcomStubsAndProxies->GetProxy(oid, NS_GET_IID(nsIComponentManager), orb, &proxy);
compM = (nsIComponentManager*)proxy;
xpcomStubsAndProxies->GetProxy(oid, NS_GET_IID(nsIComponentManager), orb, (nsISupports**)&proxy);
// compM = (nsIComponentManager*)proxy;
}
urpComponentLoader::~urpComponentLoader() { //nb
delete stub;
delete man;
delete transport;
NS_RELEASE(proxy);
// NS_RELEASE(proxy);
printf("--urpComponentLoader::~urpComponentLoader \n");
}
@ -124,7 +124,7 @@ NS_IMETHODIMP urpComponentLoader::GetFactory(const nsIID & aCID, const char *aLo
fprintf(stderr, "--urpComponentLoader::GetFactory(%s,%s,%s)\n", cidString, aLocation, aType);
delete [] cidString;
#endif
nsIFactory *f = new urpComponentFactory(aLocation, aCID, compM);
nsIFactory *f = new urpComponentFactory(aLocation, aCID, proxy);
NS_ADDREF(f);
*_retval = f;
return NS_OK;
@ -470,7 +470,8 @@ UnregisterRemoteLoader(nsIComponentManager *aCompMgr, nsIFile *aPath,
// only unregister if we're the current JS component loader
if (!strcmp(urpLoader, URP_COMPONENTLOADER_ContractID)) {
return catman->DeleteCategoryEntry("component-loader",
urpComponentTypeName, PR_TRUE,getter_Copies(urpLoader));
urpComponentTypeName, PR_TRUE,
getter_Copies(urpLoader));
}
return NS_OK;
}

Просмотреть файл

@ -42,8 +42,10 @@ CPPSRCS = \
initImplFactory.cpp \
$(NULL)
EXTRA_DSO_LDOPTS += \
../urpTestImpl.o
LIBS = -L./ -L$(DIST)/bin/components/ $(XPCOM_LIBS) $(NSPR_LIBS) $(EXTRA_DSO_LIBS)
LIBS = -L./ -L$(DIST)/bin/components/ $(XPCOM_LIBS) $(NSPR_LIBS) $(EXTRA_DSO_LIBS)
include $(topsrcdir)/config/rules.mk

Просмотреть файл

@ -27,8 +27,7 @@
#include "nsIInterfaceInfo.h"
#include "nsIInterfaceInfoManager.h"
#include "nsIComponentManager.h"
#include "urpITest.h"
#include "urpTestImpl.h"
#include "bcIJavaSample.h"
static char * className = "initImpl";
@ -38,11 +37,11 @@ initImpl::initImpl() {
NS_INIT_REFCNT();
printf("Constructor of initImpl\n");
nsresult rv;
urpITest * serverComponent;
urpITest* anComp;
rv = nsComponentManager::CreateInstance("urpTest",
bcIJavaSample * serverComponent;
// urpITest* anComp;
rv = nsComponentManager::CreateInstance("bcJavaSample",
nsnull,
NS_GET_IID(urpITest),
NS_GET_IID(bcIJavaSample),
(void**)&serverComponent);
if (NS_FAILED(rv)) {
printf("Create instance failed in initImpl!!!");
@ -59,23 +58,27 @@ initImpl::initImpl() {
}
*/
int l = 2000;
serverComponent->Test1(&l);
serverComponent->Test1(100);
printf("in initImpl after Test1 %d\n",l);
/*
anComp->Test1(&l);
printf("in initImpl after Test1 %d\n",l);
*/
/*******************************************/
/*
PRInt32 l2 = 2000;
l = 1999;
serverComponent->Test2(l,&l2);
printf("--urpTestImpl after Test2 l2=%d\n",l2);
*/
/*******************************************/
/*
const char * s1 = "s1";
char * s2 = "s2";
serverComponent->Test3(s1,&s2);
printf("--urpTestImpl after Test3 s2=%s\n",s2);
*/
int intArray[] = {1,2,3};
serverComponent->Test3(3, intArray);
// printf("--urpTestImpl after Test3 s2=%s\n",s2);
/*******************************************/
char ** valueArray = (char **)malloc(sizeof(char*)*4);
@ -84,9 +87,28 @@ initImpl::initImpl() {
valueArray[2] = "a";
valueArray[3] = "b";
serverComponent->Test4(4,(const char **)valueArray);
/*******************************************/
char *** valueArray2 = &valueArray;
serverComponent->Test4(4,valueArray2);
for (int i = 0; i < 4; i++) {
char *str = (*valueArray2)[i];
printf("--[c++] valueArray2[%d]=%s\n",i,(str == NULL) ? "null" : str);
}
{
nsIComponentManager* cm;
nsresult rv = NS_GetGlobalComponentManager(&cm);
printf("--[c++] bcJavaSample before test->Test5(cm)\n");
serverComponent->Test5(cm);
nsIEnumerator *enumerator;
rv = cm->EnumerateCLSIDs(&enumerator);
if (NS_FAILED(rv)) {
printf("--[c++] can get enumerator\n");
}
printf("--[c++] bcJavaSample after test->Test5(cm)\n");
}
/*******************************************/
/*
char ***valueArray2 = &valueArray;
printf("call object\n");
@ -104,10 +126,6 @@ initImpl::initImpl() {
for (unsigned int i = 0; i < 4; i++) {
printf("valueArray[%d]=%s\n",i,(*valueArray2)[i]);
}
urpITest *object = new urpTestImpl();
object->AddRef();
serverComponent->Test6(object);
{
urpITest *p1;
serverComponent->Test7(&p1);
@ -128,7 +146,8 @@ initImpl::initImpl() {
}
delete serverComponent;
*/
// delete serverComponent;
}
initImpl::~initImpl() {

Просмотреть файл

@ -68,13 +68,19 @@ printf("NS_WITH_SERVICE(bcXPC in Marshal failed\n");
_orb->GetORB(&orb);
bcIStub *stub = nsnull;
NS_WITH_SERVICE(nsIComponentManager, mComp, compManag, &rv);
// nsIComponentManager* cm;
// rv = NS_GetGlobalComponentManager(&cm);
if (NS_FAILED(rv)) {
printf("compManager failed\n");
return -1;
}
/*
urpITest *proxy = nsnull;
xpcomStubsAndProxies->GetStub((nsISupports*)mComp, &stub);
bcOID oid = orb->RegisterStub(stub);
*/
bcOID oid;
xpcomStubsAndProxies->GetOID(mComp, orb, &oid);
urpTransport* trans = new urpAcceptor();
PRStatus status = trans->Open(connectString);
@ -82,17 +88,21 @@ printf("NS_WITH_SERVICE(bcXPC in Marshal failed\n");
else printf("failed\n");
urpManager* mngr = new urpManager(PR_FALSE, orb, nsnull);
rv = NS_OK;
localThreadArg *arg = (localThreadArg*)PR_Malloc(sizeof(localThreadArg));
PRThread *thr;
while(NS_SUCCEEDED(rv)) {
// rv = mngr->HandleRequest(trans->GetConnection());
urpConnection *conn = trans->GetConnection();
if( conn != NULL ) {
// handle request in new thread
localThreadArg *arg = new localThreadArg( mngr, conn );
PRThread *thr = PR_CreateThread( PR_USER_THREAD,
// localThreadArg *arg = new localThreadArg( mngr, conn );
arg->mgr = mngr;
arg->conn = conn;
thr = PR_CreateThread( PR_USER_THREAD,
thread_start_server,
arg,
PR_PRIORITY_NORMAL,
PR_GLOBAL_THREAD,
PR_LOCAL_THREAD,
PR_UNJOINABLE_THREAD,
0);
if( thr == nsnull ) {

Просмотреть файл

@ -95,9 +95,19 @@ struct sendThreadArg {
struct monitCall {
PRMonitor *mon;
bcICall* call;
monitCall(PRMonitor *m, bcICall* c) {
urpPacket* mess;
char header;
bcIID iid;
bcOID oid;
bcTID tid;
bcMID mid;
int request;
monitCall(PRMonitor *m, bcICall* c, urpPacket* mes, char h) {
this->mon = m;
this->call = c;
this->mess = mes;
this->header = h;
this->request = 0;
}
};
@ -120,25 +130,28 @@ void send_thread_start (void * arg) {
urpConnection* conn = ((sendThreadArg *)arg)->connection;
nsresult rv = manager->ReadLongRequest(header, mes, iid, oid,
tid, methodId, conn);
//printf("just run test\n");
}
urpManager::urpManager(PRBool IsClient, bcIORB *orb, urpConnection* conn) {
broker = orb;
monitTable = new nsHashtable(20);
if(IsClient) {
threadTable = nsnull;
localThreadArg *arg = new localThreadArg( this, conn, PR_TRUE );
PRThread *thr = PR_CreateThread( PR_USER_THREAD,
thread_start,
arg,
PR_PRIORITY_NORMAL,
PR_GLOBAL_THREAD,
PR_LOCAL_THREAD,
PR_UNJOINABLE_THREAD,
0);
if(thr == nsnull) {
printf("Error couldn't run listener\n");
exit(-1);
}
}
} else
threadTable = new nsHashtable(20);
}
@ -200,8 +213,21 @@ void urpManager::SendUrpRequest(bcOID oid, bcIID iid,
urpMarshalToolkit* mt = new urpMarshalToolkit(PR_TRUE);
mt->WriteType(iid, message);
mt->WriteOid(oid, message);
bcTID thrID = (bcTID)PR_GetCurrentThread();
printf("OID is written %ld\n", oid);
bcTID thrID;
bcTID* thr;
if(threadTable) {
thrID = (bcTID)PR_GetCurrentThread();
threadHashKey thrHK(thrID);
thr = (bcTID*)threadTable->Get(&thrHK);
if(thr)
thrID = *(bcTID*)thr;
else {
printf("Error with threads in SendUrpRequest\n");
exit(-1);
}
} else
thrID = (bcTID)PR_GetCurrentThread();
printf("OID is written %ld %ld\n", oid, thrID);
mt->WriteThreadID(thrID, message);
broker = call->GetORB();
mt->WriteParams(call, paramCount, info, interfaceInfo, message, methodIndex);
@ -233,6 +259,8 @@ urpManager::ReadMessage(urpConnection* conn, PRBool isClient) {
nsresult rv = NS_OK;
PRBool inserted = PR_FALSE;
bcTID tid;
PRThread *thr;
sendThreadArg *arg = (sendThreadArg *)PR_Malloc(sizeof(sendThreadArg));
while(conn->GetStatus() == urpSuccess) {
urpPacket* message = conn->Read();
char header = message->ReadByte();
@ -258,15 +286,41 @@ urpManager::ReadMessage(urpConnection* conn, PRBool isClient) {
delete mt;
sendThreadArg *arg = new sendThreadArg( this, header,
threadHashKey thrHK(tid);
monitCall* mc = (monitCall*)monitTable->Get(&thrHK);
if(mc != nsnull) {
mc->mess = message;
mc->header = header;
mc->iid = iid;
mc->oid = oid;
mc->tid = tid;
mc->mid = methodId;
mc->request = 1;
PR_EnterMonitor(mc->mon);
PR_Notify(mc->mon);
PR_ExitMonitor(mc->mon);
} else {
arg->man = this;
arg->header = header;
arg->message = message;
arg->iid = iid;
arg->oid = oid;
arg->tid = tid;
arg->methodId = methodId;
arg->connection = conn;
/*
sendThreadArg *arg = new sendThreadArg( this, header,
message, iid, oid, tid, methodId, conn);
PRThread *thr = PR_CreateThread( PR_USER_THREAD,
*/
thr = PR_CreateThread( PR_USER_THREAD,
send_thread_start,
arg,
PR_PRIORITY_NORMAL,
PR_GLOBAL_THREAD,
PR_LOCAL_THREAD,
PR_UNJOINABLE_THREAD,
0);
//ReadLongRequest(header, message, iid, oid, tid, methodId, conn);
}
} else { // a reply
bcIID iid; bcOID oid; bcMID mid;
@ -279,8 +333,11 @@ urpManager::ReadMessage(urpConnection* conn, PRBool isClient) {
printf("old threadID\n");
delete mt;
threadHashKey thrHK(tid);
monitCall* mc = monitTable->Get(&thrHK);
monitCall* mc = (monitCall*)monitTable->Get(&thrHK);
mc->mess = message;
mc->header = header;
mc->request = 0;
/*
mc->call->GetParams(&iid, &oid, &mid);
nsIInterfaceInfo *interfaceInfo;
nsIInterfaceInfoManager* iimgr;
@ -300,6 +357,7 @@ urpManager::ReadMessage(urpConnection* conn, PRBool isClient) {
PRUint32 paramCount = info->GetParamCount();
ReadReply(message, header, mc->call, paramCount,
info, interfaceInfo, mid, conn);
*/
PR_EnterMonitor(mc->mon);
PR_Notify(mc->mon);
PR_ExitMonitor(mc->mon);
@ -310,6 +368,7 @@ urpManager::ReadMessage(urpConnection* conn, PRBool isClient) {
break;
}
}
PR_Free(arg);
return rv;
}
@ -349,6 +408,20 @@ urpManager::ReadLongRequest(char header, urpPacket* message,
PRUint16 methodId, urpConnection* conn) {
nsresult rv = NS_OK;
if(threadTable != nsnull) {
bcTID thrID = (bcTID)PR_GetCurrentThread();
threadHashKey thrHK(thrID);
bcTID* clientTID = (bcTID*)threadTable->Get(&thrHK);
if(clientTID) thrID = *clientTID;
if(clientTID) {
if(thrID != tid) {
printf("Error: threadIDs are not equal in ReadLongRequest\n");
exit(-1);
}
} else
threadTable->Put(&thrHK, &tid);
}
urpMarshalToolkit* mt = new urpMarshalToolkit(PR_FALSE);
printf("method readLongRequest: tid %ld %ld\n",tid,oid);
@ -391,25 +464,55 @@ char* name;
broker->SendReceive(call);
rv = SendReply(tid, call, paramCount, info, interfaceInfo,
methodId, conn);
// delete call;
NS_RELEASE(interfaceInfo);
return rv;
}
nsresult
urpManager::SetCall(bcICall* call, PRMonitor *m) {
printf("method SetCall %p %p %p\n",call, m, this);
monitCall* mc = new monitCall(m, call);
bcTID thrID = (bcTID)PR_GetCurrentThread();
urpManager::SetCall(bcICall* call, PRMonitor *m, bcTID thrID) {
monitCall* mc = new monitCall(m, call, nsnull, 0);
printf("method SetCall %p %p %p %ld\n",call, m, this, thrID);
threadHashKey thrHK(thrID);
monitTable->Put(&thrHK, mc);
return NS_OK;
}
nsresult
urpManager::RemoveCall() {
urpManager::RemoveCall(forReply* fR, bcTID thrID) {
printf("method RemoveCall\n");
bcTID thrID = (bcTID)PR_GetCurrentThread();
threadHashKey thrHK(thrID);
monitCall* mc = monitTable->Remove(&thrHK);
delete mc;
monitCall* mc = (monitCall*)monitTable->Get(&thrHK);
fR->mess= mc->mess;
fR->header = mc->header;
if(!mc->request) {
mc = (monitCall*)monitTable->Remove(&thrHK);
delete mc;
} else {
fR->iid = mc->iid;
fR->oid = mc->oid;
fR->tid = mc->tid;
fR->methodId = mc->mid;
fR->request = mc->request;
}
return NS_OK;
}
bcTID
urpManager::GetThread() {
bcTID thrID;
bcTID* thr;
if(threadTable) {
thrID = (bcTID)PR_GetCurrentThread();
threadHashKey thrHK(thrID);
thr = (bcTID*)threadTable->Get(&thrHK);
if(thr)
thrID = *(bcTID*)thr;
else {
printf("Error with threads in SendUrpRequest\n");
exit(-1);
}
} else
thrID = (bcTID)PR_GetCurrentThread();
return thrID;
}

Просмотреть файл

@ -27,6 +27,15 @@
#define INTERFACE 22
#define INTERFACE_STRING "com.sun.star.uno.XInterface"
typedef struct {
urpPacket* mess;
char header;
bcIID iid;
bcOID oid;
bcTID tid;
bcMID methodId;
int request;
} forReply;
class urpManager {
@ -42,22 +51,23 @@ public:
PRUint32 paramCount, const nsXPTMethodInfo* info,
urpConnection* conn);
nsresult ReadMessage(urpConnection* conn, PRBool ic);
nsresult SetCall(bcICall* call, PRMonitor *m);
nsresult RemoveCall();
private:
nsHashtable* monitTable;
bcIORB *broker;
/* for ReadReply */
nsIInterfaceInfo *interfaceInfo;
void TransformMethodIDAndIID();
nsresult ReadReply(urpPacket* message, char header,
nsresult SetCall(bcICall* call, PRMonitor *m, bcTID tid);
nsresult RemoveCall(forReply* fR, bcTID tid);
nsresult ReadReply(urpPacket* message, char header,
bcICall* call, PRUint32 paramCount,
const nsXPTMethodInfo *info,
nsIInterfaceInfo *interfaceInfo,
PRUint16 methodIndex, urpConnection* conn);
nsresult ReadLongRequest(char header, urpPacket* message,
nsresult ReadLongRequest(char header, urpPacket* message,
bcIID iid, bcOID oid, bcTID tid,
PRUint16 methodId, urpConnection* conn);
bcTID GetThread();
private:
nsHashtable* monitTable;
bcIORB *broker;
nsHashtable* threadTable;
/* for ReadReply */
void TransformMethodIDAndIID();
nsresult ReadShortRequest(char header, urpPacket* message);
nsresult SendReply(bcTID tid, bcICall* call, PRUint32 paramCount,
const nsXPTMethodInfo* info,

Просмотреть файл

@ -69,12 +69,18 @@ urpMarshalToolkit::WriteElement(bcIUnMarshaler *um, nsXPTParamInfo * param, uint
PRUint16 methodIndex, const nsXPTMethodInfo *info,
bcIAllocator * allocator) {
void* data = allocator->Alloc(sizeof(void*));
nsID *id;
char* help;
nsresult r = NS_OK;
switch(type) {
case nsXPTType::T_IID :
data = (char*)new nsIID();
um->ReadSimple(data,XPTType2bcXPType(type));
message->WriteString((char*)data, strlen((char*)data));
id = new nsID();
um->ReadSimple(id,XPTType2bcXPType(type));
help = ((nsID)(*id)).ToString();
printf("nsIID %s\n", help);
message->WriteString(help, strlen(help));
delete id;
PR_Free(help);
break;
case nsXPTType::T_I8 :
um->ReadSimple(data,XPTType2bcXPType(type));
@ -256,12 +262,16 @@ urpMarshalToolkit::ReadElement(nsXPTParamInfo * param, uint8 type,
urpConnection* conn) {
void* data = allocator->Alloc(sizeof(void*));
nsresult r = NS_OK;
char* str;
nsID id;
switch(type) {
case nsXPTType::T_IID :
{
int& size = 0;
data = message->ReadString(size);
m->WriteSimple(data, XPTType2bcXPType(type));
int size;
str = message->ReadString(size);
id.Parse((char*)str);
m->WriteSimple((char*)&id, XPTType2bcXPType(type));
PR_Free(str);
break;
}
case nsXPTType::T_I8 :
@ -307,9 +317,13 @@ urpMarshalToolkit::ReadElement(nsXPTParamInfo * param, uint8 type,
case nsXPTType::T_CHAR_STR :
case nsXPTType::T_WCHAR_STR :
{
int& size = 0;
int size;
/*
*(char**)data = message->ReadString(size);
data = *(char **)data;
*/
str = message->ReadString(size);
data = str;
size_t length = 0;
if (type == nsXPTType::T_WCHAR_STR) {
length = nsCRT::strlen((const PRUnichar*)data);
@ -323,6 +337,7 @@ urpMarshalToolkit::ReadElement(nsXPTParamInfo * param, uint8 type,
length+=1;
}
m->WriteString(data,length);
PR_Free(str);
break;
}
case nsXPTType::T_INTERFACE :
@ -541,7 +556,7 @@ urpMarshalToolkit::ReadType(urpPacket* message) {
short cache_index = message->ReadShort();
int& size = 0;
int size;
nsIID iid;
char* name = message->ReadString(size);
iid.Parse(name);
@ -570,7 +585,7 @@ urpMarshalToolkit::WriteOid(bcOID oid, urpPacket* message) {
bcOID
urpMarshalToolkit::ReadOid(urpPacket* message) {
int& size = 0;
int size;
bcOID result;
char* str = message->ReadString(size);
@ -605,7 +620,7 @@ urpMarshalToolkit::WriteThreadID(bcTID tid, urpPacket* message) {
bcTID
urpMarshalToolkit::ReadThreadID(urpPacket* message) {
int& size = 0;
int size = 0;
bcTID result;
char* array = message->ReadOctetStream(size);
short cache_index = message->ReadShort();

Просмотреть файл

@ -33,6 +33,7 @@
urpStub::urpStub(urpManager* man, urpConnection* conn) {
manager = man;
connection = conn;
_mOwningThread = PR_CurrentThread();
}
@ -43,6 +44,10 @@ printf("destructor of urpStub\n");
}
void urpStub::Dispatch(bcICall *call) {
if (_mOwningThread == PR_CurrentThread())
printf("RavnYYYYYYYYY\n");
else
printf("NEEEEE RAAAAVVVNNNYYY\n");
printf("this is method Dispatch of urpStub\n");
bcIID iid; bcOID oid; bcMID mid;
@ -67,20 +72,35 @@ void urpStub::Dispatch(bcICall *call) {
PRMonitor* mon = PR_NewMonitor();
PR_EnterMonitor(mon);
printf("ThreadID is written %d %p %p %p %p\n",paramCount, call, mon, manager, this);
nsresult rv = manager->SetCall(call, mon);
bcTID tid = manager->GetThread();
nsresult rv = manager->SetCall(call, mon, tid);
if(NS_FAILED(rv)) {
printf("Error of SetCall in method Dispatch\n");
exit(-1);
}
manager->SendUrpRequest(oid, iid, mid, interfaceInfo, call, paramCount,
info, connection);
if(NS_FAILED(PR_Wait(mon, PR_INTERVAL_NO_TIMEOUT))) {
forReply* fR = (forReply*)PR_Malloc(sizeof(forReply));
while(1) {
fR->request = 0;
if(NS_FAILED(PR_Wait(mon, PR_INTERVAL_NO_TIMEOUT))) {
printf("Can't wait on cond var\n");
exit(-1);
}
rv = manager->RemoveCall(fR, tid);
if(fR->request)
manager->ReadLongRequest(fR->header, fR->mess, fR->iid,
fR->oid, fR->tid, fR->methodId, connection);
else
break;
}
rv = manager->RemoveCall();
manager->ReadReply(fR->mess, fR->header, call, paramCount,
info, interfaceInfo, mid, connection);
NS_RELEASE(interfaceInfo);
PR_ExitMonitor(mon);
PR_DestroyMonitor(mon);
delete fR->mess;
PR_Free(fR);
}

Просмотреть файл

@ -36,6 +36,7 @@ class urpStub : public bcIStub {
private:
urpManager* manager;
urpConnection* connection;
void* _mOwningThread;
};
#endif