Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/hylasoft-usa/h-opc
Browse files Browse the repository at this point in the history
  • Loading branch information
jmbeach committed Aug 5, 2016
2 parents a030a00 + ec97c7b commit 161157e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
8 changes: 2 additions & 6 deletions h-opc/Ua/UaClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,6 @@ private void SessionClosing(object sender, EventArgs e)
/// </summary>
public void ReConnect()
{
if (Status != OpcStatus.Connected)
return;
Status = OpcStatus.NotConnected;
_session.Reconnect();
Status = OpcStatus.Connected;
Expand All @@ -118,9 +116,6 @@ public void ReConnect()
/// </summary>
public void RecreateSession()
{
if (Status != OpcStatus.Connected)
return;

Status = OpcStatus.NotConnected;
_session = Session.Recreate(_session);
PostInitializeSession();
Expand Down Expand Up @@ -261,7 +256,7 @@ public Task WriteAsync<T>(string tag, T item)
var nodesToWrite = BuildWriteValueCollection(tag, Attributes.Value, item);

// Wrap the WriteAsync logic in a TaskCompletionSource, so we can use C# async/await syntax to call it:
var taskCompletionSource = new TaskCompletionSource<T>();
var taskCompletionSource = new TaskCompletionSource<StatusCode>();
_session.BeginWrite(
requestHeader: null,
nodesToWrite: nodesToWrite,
Expand All @@ -277,6 +272,7 @@ public Task WriteAsync<T>(string tag, T item)
{
CheckReturnValue(response.ServiceResult);
CheckReturnValue(results[0]);
taskCompletionSource.SetResult(response.ServiceResult);
}
catch (Exception ex)
{
Expand Down
1 change: 1 addition & 0 deletions tests/UaTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ public void UaTestSessionRecreate()
Session oldSession = null;
client.ServerConnectionLost += (object sender, EventArgs e) =>
{
if (i > 0) return;
i++;
Assert.AreEqual(OpcStatus.NotConnected, client.Status);
// store the session to make sure a new one is created
Expand Down

0 comments on commit 161157e

Please sign in to comment.