File tree 1 file changed +6
-3
lines changed 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -145,6 +145,7 @@ public override async Task CreatePortMapAsync(Mapping mapping)
145
145
if ( mapping . PrivateIP . Equals ( IPAddress . None ) ) mapping . PrivateIP = DeviceInfo . LocalAddress ;
146
146
147
147
NatDiscoverer . TraceSource . LogInfo ( "CreatePortMapAsync - Creating port mapping {0}" , mapping ) ;
148
+ bool retry = false ;
148
149
try
149
150
{
150
151
var message = new CreatePortMappingRequestMessage ( mapping ) ;
@@ -162,17 +163,17 @@ await _soapClient
162
163
mapping . Lifetime = 0 ;
163
164
// We create the mapping anyway. It must be released on shutdown.
164
165
mapping . LifetimeType = MappingLifetime . ForcedSession ;
165
- CreatePortMapAsync ( mapping ) ;
166
+ retry = true ;
166
167
break ;
167
168
case UpnpConstants . SamePortValuesRequired :
168
169
NatDiscoverer . TraceSource . LogWarn ( "Same Port Values Required - Using internal port {0}" , mapping . PrivatePort ) ;
169
170
mapping . PublicPort = mapping . PrivatePort ;
170
- CreatePortMapAsync ( mapping ) ;
171
+ retry = true ;
171
172
break ;
172
173
case UpnpConstants . RemoteHostOnlySupportsWildcard :
173
174
NatDiscoverer . TraceSource . LogWarn ( "Remote Host Only Supports Wildcard" ) ;
174
175
mapping . PublicIP = IPAddress . None ;
175
- CreatePortMapAsync ( mapping ) ;
176
+ retry = true ;
176
177
break ;
177
178
case UpnpConstants . ExternalPortOnlySupportsWildcard :
178
179
NatDiscoverer . TraceSource . LogWarn ( "External Port Only Supports Wildcard" ) ;
@@ -185,6 +186,8 @@ await _soapClient
185
186
throw ;
186
187
}
187
188
}
189
+ if ( retry )
190
+ await CreatePortMapAsync ( mapping ) ;
188
191
}
189
192
#endif
190
193
You can’t perform that action at this time.
0 commit comments