private void EndMapPort(IAsyncResult result)
 {
     if (device == null)
     {
         return;
     }
     try{
         device.EndCreatePortMap(result);
         logger.Info("UPnP port mapping successful(" + map.Protocol + "/" + map.Port + ")");
     } catch (MappingException e) {
         logger.Error("UPnP failed to map port(" + map.Protocol + "/" + map.Port + ")" + "Error: " + e.ErrorCode + " " + e.ErrorText);
     }
 }
Exemplo n.º 2
0
 private void EndMapTcpPort(IAsyncResult result)
 {
     try
     {
         INatDevice device = (INatDevice)result.AsyncState;
         device.EndCreatePortMap(result);
         logger.Info("UPnP port mapping successful {0}", tcpMapping);
         device.BeginCreatePortMap(udpMapping, EndMapUdpPort, device);
     }
     catch (MappingException e)
     {
         logger.Error("UPnP failed to map port {0}. Error {1}", tcpMapping, e);
     }
 }
Exemplo n.º 3
0
        private void EndCreateAsync(IAsyncResult ar)
        {
            var mapping = (Mapping)ar.AsyncState;

            _device?.EndCreatePortMap(ar);

            if (_mappings.ContainsKey(mapping.PrivatePort))
            {
                _mappings[mapping.PrivatePort] = mapping;
            }
            else
            {
                _mappings.Add(mapping.PrivatePort, mapping);
            }
        }
Exemplo n.º 4
0
 private void EndMapUdpPort(IAsyncResult result)
 {
     try
     {
         INatDevice device = (INatDevice)result.AsyncState;
         device.EndCreatePortMap(result);
         logger.Info("UPnP port mapping successful {0}", udpMapping);
         GLib.Idle.Add(delegate {
             if (PortMapped != null)
             {
                 PortMapped(this, EventArgs.Empty);
             }
             return(false);
         });
     }
     catch (MappingException e)
     {
         logger.Error("UPnP failed to map port {0}. Error {1}", udpMapping, e);
     }
 }
Exemplo n.º 5
0
 private static void EndCreateAsync(IAsyncResult ar)
 {
     _device?.EndCreatePortMap(ar);
 }