Skip to content

Commit

Permalink
Merge pull request #405 from Xharze/closeChannel
Browse files Browse the repository at this point in the history
Close channel
  • Loading branch information
kichristensen committed Aug 6, 2014
2 parents c2e749a + 138fd2e commit 2cd42f7
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/NLog/Targets/LogReceiverWebServiceTarget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ namespace NLog.Targets
{
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;
#if WCF_SUPPORTED
using System.ServiceModel;
Expand Down Expand Up @@ -335,11 +336,23 @@ protected virtual WcfLogReceiverClient CreateWcfLogReceiverClient()
{
client = new WcfLogReceiverClient(this.EndpointConfigurationName, new EndpointAddress(this.EndpointAddress));
}

client.ProcessLogMessagesCompleted += ClientOnProcessLogMessagesCompleted;

return client;
}

private void ClientOnProcessLogMessagesCompleted(object sender, AsyncCompletedEventArgs asyncCompletedEventArgs)
{
var client = sender as WcfLogReceiverClient;
if (client != null && client.State == CommunicationState.Opened)
{
client.Close();
}
}
#endif

private void SendBufferedEvents()
private void SendBufferedEvents()
{
lock (this.SyncRoot)
{
Expand Down

0 comments on commit 2cd42f7

Please sign in to comment.