Skip to content

Commit d985747

Browse files
[Client] Fix reconnect when ReverseConnection is used (#2985)
* Update SessionReconnectHandler.cs There is chance that m_session.DetachChannel can clear the member "Endpoint" info of the session, once that happened, there will be crash when use member "Endpoint" of the session as parameter of m_reverseConnectManager.WaitForConnection. * Update SessionReconnectHandler.cs
1 parent cbf789d commit d985747

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Libraries/Opc.Ua.Client/Session/SessionReconnectHandler.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -459,9 +459,12 @@ private async Task<bool> DoReconnectAsync()
459459
ITransportWaitingConnection connection;
460460
do
461461
{
462+
var endpointDescription = m_session.Endpoint;
463+
if(endpointDescription == null)
464+
endpointDescription = transportChannel.EndpointDescription;
462465
connection = await m_reverseConnectManager.WaitForConnection(
463-
new Uri(m_session.Endpoint.EndpointUrl),
464-
m_session.Endpoint.Server.ApplicationUri
466+
new Uri(endpointDescription.EndpointUrl),
467+
endpointDescription.Server.ApplicationUri
465468
).ConfigureAwait(false);
466469

467470
if (m_updateFromServer)

0 commit comments

Comments
 (0)