Giter Club home page Giter Club logo

Comments (4)

NicolasDorier avatar NicolasDorier commented on August 17, 2024

This commit should fix the problem... waiting for someone with such gateway to test.

from nbitcoin.

lontivero avatar lontivero commented on August 17, 2024

Close it. It worked (it opens the port with lifetime=0).
However, running the ProtocolTest.CanUseUpnp() test, I can see it fails in another place (see the screenshot). That is because the test asserts that lease.IsOpen before Device is assigned. The defect was there before but now that it takes a little more time to open the port, it fails.

Here you have the evidence it is working now.

Another thing to have in mind is AddPortMapping operation can fail for 4 different reasons:

Here you can see what I am talking about. This is part of Open.NAT (not released yet)

            catch(MappingException me)
            {
                switch (me.ErrorCode)
                {
                    case UpnpConstants.OnlyPermanentLeasesSupported:
                        NatUtility.TraceSource.LogWarn("Only Permanent Leases Supported - There is no warranty it will be closed");
                        mapping.Lifetime = 0;
                        break;
                    case UpnpConstants.SamePortValuesRequired:
                        NatUtility.TraceSource.LogWarn("Same Port Values Required - Using internal port {0}", mapping.PrivatePort);
                        mapping.PublicPort = mapping.PrivatePort;
                        break;
                    case UpnpConstants.RemoteHostOnlySupportsWildcard:
                        NatUtility.TraceSource.LogWarn("Remote Host Only Supports Wildcard");
                        mapping.PublicIP = IPAddress.None;
                        break;
                    case UpnpConstants.ExternalPortOnlySupportsWildcard:
                        NatUtility.TraceSource.LogWarn("External Port Only Supports Wildcard");
                        break;
                }
                message = new CreatePortMappingRequestMessage(mapping);
                _soapClient
                    .InvokeAsync("AddPortMapping", message.ToXml())
                    .TimeoutAfter(TimeSpan.FromSeconds(3));
                RegisterMapping(mapping);
            }

from nbitcoin.

NicolasDorier avatar NicolasDorier commented on August 17, 2024

I indeed, added a bug because of the last changes, I just fixed it.
Can you try again ? if it works, I close the issue.
I am not sure how to handle these exception in UPnPLease.
I think, the current situation for these other case is fine (DetectExternalEndpoint will return false, and so the NodeServer will use external web service to deduce external ip instead)

Same ports are tried before anything else.

from nbitcoin.

lontivero avatar lontivero commented on August 17, 2024

Works okey.

from nbitcoin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.