public void receiveAttach(final Attach attach)
{
if(_state == SessionState.ACTIVE)
{
UnsignedInteger handle = attach.getHandle();
if(_remoteLinkEndpoints.containsKey(handle))
{
// TODO - Error - handle busy?
}
else
{
LinkEndpoint endpoint = getLinkMap().get(attach.getName());
if(endpoint == null)
{
endpoint = attach.getRole() == Role.RECEIVER
? new SendingLinkEndpoint(this, attach)
: new ReceivingLinkEndpoint(this, attach);
// TODO : fix below - distinguish between local and remote owned
endpoint.setSource(attach.getSource());
endpoint.setTarget(attach.getTarget());
}
if(attach.getRole() == Role.SENDER)
{
endpoint.setDeliveryCount(attach.getInitialDeliveryCount());
}
_remoteLinkEndpoints.put(handle, endpoint);
if(!_localLinkEndpoints.containsKey(endpoint))
{
UnsignedInteger localHandle = findNextAvailableHandle();
endpoint.setLocalHandle(localHandle);
_localLinkEndpoints.put(endpoint, localHandle);
_sessionEventListener.remoteLinkCreation(endpoint);