remotePeerAddrToOrdinalKey.SetAt(addr, new POrdinalKey(sr->ordinal));
}
remoteServiceRelationships.Append(sr);
monitorTickle.Signal();
return TRUE;
}
BOOL H323PeerElement::RemoveServiceRelationship(const OpalGloballyUniqueID & serviceID, int reason)
{
{
PWaitAndSignal m(remotePeerListMutex);
// if no service relationship exists for this peer, then nothing to do
PSafePtr<H323PeerElementServiceRelationship> sr = remoteServiceRelationships.FindWithLock(H323PeerElementServiceRelationship(serviceID), PSafeReadOnly);
if (sr == NULL) {
return FALSE;
}
}
return ServiceRelease(serviceID, reason);
}
BOOL H323PeerElement::RemoveServiceRelationship(const H323TransportAddress & peer, int reason)
{
OpalGloballyUniqueID serviceID;
// if no service relationship exists for this peer, then nothing to do
// check to see if we have a service relationship with the peer already
PSafePtr<H323PeerElementServiceRelationship> sr = remoteServiceRelationships.FindWithLock(H323PeerElementServiceRelationship(serviceID), PSafeReadWrite);
PSafePtr<H323PeerElementServiceRelationship> sr = localServiceRelationships.FindWithLock(H323PeerElementServiceRelationship(serviceID), PSafeReadWrite);
if (sr == NULL) {
PTRACE(2, "PeerElement\nRejecting unknown service ID " << serviceID << " received from peer " << info.GetReplyAddress());
PTRACE(2, "PeerElement\nNew service relationship with " << sr->name << " at " << info.GetReplyAddress() << " created - next update in " << info.scf.m_timeToLive);
// remove any previous check to see if we have a service relationship with the peer already
PSafePtr<H323PeerElementServiceRelationship> sr = remoteServiceRelationships.FindWithLock(H323PeerElementServiceRelationship(serviceID), PSafeReadWrite);
if (sr == NULL)
return FALSE;
// send the request - no response
H501PDU pdu;
H501_ServiceRelease & body = pdu.BuildServiceRelease(GetNextSequenceNumber());
PSafePtr<H323PeerElementServiceRelationship> sr = remoteServiceRelationships.FindWithLock(H323PeerElementServiceRelationship(serviceID), PSafeReadOnly);
if (sr != NULL)
remoteServiceRelationships.Remove(sr);
InternalRemoveServiceRelationship(peer);
// attempt to create a new service relationship
if (ServiceRequestByAddr(peer, serviceID) != Confirmed) {
PTRACE(2, "PeerElement\tService relationship with " << peer << " disappeared and refused new relationship");
OnRemoveServiceRelationship(peer);
return FALSE;
}
// we have a new service ID
PTRACE(2, "PeerElement\tService relationship with " << peer << " disappeared and new relationship established");
// put correct service descriptor into the common data
{
// check to see if we have a service relationship with the peer already
PSafePtr<H323PeerElementServiceRelationship> sr = remoteServiceRelationships.FindWithLock(H323PeerElementServiceRelationship(serviceID), PSafeReadOnly);
// if there is no service relationship, then nothing to do
PSafePtr<H323PeerElementServiceRelationship> sr = remoteServiceRelationships.FindWithLock(H323PeerElementServiceRelationship(serviceID), PSafeReadOnly);