Пример #1
0
        internal void RemoveSubscriberLink(SubscriberLink link)
        {
            SubscriberLink lnk = null;

            lock (gate)
            {
                if (Dropped)
                {
                    return;
                }
                if (subscriberLinks.Contains(link))
                {
                    lnk = link;
                    subscriberLinks.Remove(lnk);
                    if (subscriberLinks.Count == 0)
                    {
                        StopPublishLoop();
                    }
                }
            }
            if (lnk != null)
            {
                HandlePeerDisconnect(lnk);
            }
        }
Пример #2
0
        public void removeSubscriberLink(SubscriberLink link)
        {
            SubscriberLink lnk = null;

            lock ( subscriber_links_mutex )
            {
                if (Dropped)
                {
                    return;
                }
                if (subscriber_links.Contains(link))
                {
                    lnk = link;
                    subscriber_links.Remove(lnk);
                    if (subscriber_links.Count == 0)
                    {
                        PollManager.Instance.RemovePollThreadListener(processPublishQueue);
                    }
                }
            }
            if (lnk != null)
            {
                peerDisconnect(lnk);
            }
        }
Пример #3
0
 internal void HandlePeerDisconnect(SubscriberLink sub_link)
 {
     //Logger.LogDebug("PEER DISCONNECT: [" + sub_link.topic + "]");
     foreach (SubscriberCallbacks cbs in callbacks)
     {
         if (cbs.OnDisconnect != null && cbs.CallbackQueue != null)
         {
             var cb = new PeerConnDisconnCallback(cbs.OnDisconnect, sub_link);
             cbs.CallbackQueue.AddCallback(cb, cbs);
         }
     }
 }
Пример #4
0
 internal void HandlePeerConnect(SubscriberLink sub_link)
 {
     //Logger.LogDebug($"PEER CONNECT: Id: {sub_link.connection_id} Dest: {sub_link.destination_caller_id} Topic: {sub_link.topic}");
     foreach (SubscriberCallbacks cbs in callbacks)
     {
         if (cbs.OnConnect != null && cbs.CallbackQueue != null)
         {
             var cb = new PeerConnDisconnCallback(cbs.OnConnect, sub_link);
             cbs.CallbackQueue.AddCallback(cb, cbs);
         }
     }
 }
Пример #5
0
 public void peerDisconnect(SubscriberLink sub_link)
 {
     //ROS.Debug()( $"[{ThisNode.Name}]  PEER DISCONNECT: [{sub_link.topic}]" );
     foreach (SubscriberCallbacks cbs in callbacks)
     {
         if (cbs.disconnect != null && cbs.CallbackQueue != null)
         {
             var cb = new PeerConnDisconnCallback(cbs.disconnect, sub_link);
             cbs.CallbackId = cb.Uid;
             cbs.CallbackQueue.AddCallback(cb);
         }
     }
 }
Пример #6
0
 public void peerConnect(SubscriberLink sub_link)
 {
     //ROS.Debug()( $"[{ThisNode.Name}] PEER CONNECT: Id: {sub_link.connection_id} Dest: {sub_link.destination_caller_id} Topic: {sub_link.topic}" );
     foreach (SubscriberCallbacks cbs in callbacks)
     {
         if (cbs.connect != null && cbs.CallbackQueue != null)
         {
             var cb = new PeerConnDisconnCallback(cbs.connect, sub_link);
             cbs.CallbackId = cb.Uid;
             cbs.CallbackQueue.AddCallback(cb);
         }
     }
 }
Пример #7
0
        internal void AddSubscriberLink(SubscriberLink link)
        {
            lock (gate)
            {
                if (Dropped)
                {
                    return;
                }

                subscriberLinks.Add(link);
                this.StartPublishLoop();
            }

            if (Latch && lastMessage != null)
            {
                link.EnqueueMessage(lastMessage);
            }

            HandlePeerConnect(link);
        }
Пример #8
0
        public void addSubscriberLink(SubscriberLink link)
        {
            lock ( subscriber_links_mutex )
            {
                if (Dropped)
                {
                    return;
                }

                subscriber_links.Add(link);
                PollManager.Instance.AddPollThreadListener(processPublishQueue);
            }

            if (Latch && last_message != null)
            {
                link.EnqueueMessage(last_message);
            }

            peerConnect(link);
        }
Пример #9
0
 public PeerConnDisconnCallback(SubscriberStatusCallback callback, SubscriberLink subscriberLink)
 {
     this.callback       = callback;
     this.subscriberLink = subscriberLink;
 }