Skip to content
This repository has been archived by the owner on Jul 7, 2019. It is now read-only.

Issue 142: Skip Unresolvable DNS #143

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
</PropertyGroup>
<Import Project="..\build\CommonProperties.targets" />
<ItemGroup>
<Reference Include="log4net">
<HintPath>..\binaries\log4net\log4net.dll</HintPath>
<Reference Include="log4net, Version=1.2.13.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\log4net.2.0.3\lib\net35-full\log4net.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand All @@ -42,6 +43,7 @@
<SubType>Designer</SubType>
</None>
<None Include="Enyim.Caching.Log4NetAdapter.nuspec" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
Expand Down
4 changes: 4 additions & 0 deletions Enyim.Caching.Log4NetAdapter/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="log4net" version="2.0.3" targetFramework="net35" />
</packages>
23 changes: 21 additions & 2 deletions Enyim.Caching/Configuration/EndPointElementCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Configuration;
using System.Globalization;
using System.Net;
using System.Net.Sockets;

namespace Enyim.Caching.Configuration
{
Expand Down Expand Up @@ -41,18 +42,36 @@ public IList<IPEndPoint> ToIPEndPointCollection()
List<IPEndPoint> retval = new List<IPEndPoint>(this.Count);
foreach (EndPointElement e in this)
{
retval.Add(e.EndPoint);
try
{
retval.Add(e.EndPoint);
}
catch (SocketException)
{
if (false == SkipUnresolvedDns)
{
throw;
}
}
}

return retval.AsReadOnly();
}

private const string SkipUnresolvedDnsKey = "skipUnresolvedDns";
[ConfigurationProperty(SkipUnresolvedDnsKey, IsRequired = false, DefaultValue = false)]
public bool SkipUnresolvedDns
{
get { return (bool)base[SkipUnresolvedDnsKey]; }
set { base[SkipUnresolvedDnsKey] = value; }
}
}
}

#region [ License information ]
/* ************************************************************
*
* Copyright (c) 2010 Attila Kisk�, enyim.com
* Copyright (c) 2010 Attila Kiskó, enyim.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
4 changes: 2 additions & 2 deletions Enyim.Caching/Memcached/Locators/VBucketNodeLocator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ public VBucketNodeLocator(string hashAlgorithm, VBucket[] buckets)
throw new ArgumentException("Unknown hash algorithm: " + hashAlgorithm, "hashAlgorithm");
}

[ThreadStatic]
private static HashAlgorithm currentAlgo;
//[ThreadStatic]
//private static HashAlgorithm currentAlgo;

//private HashAlgorithm GetAlgo()
//{
Expand Down
6 changes: 1 addition & 5 deletions Enyim.Caching/Memcached/Results/Helpers/ResultHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,14 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Enyim.Caching.Memcached.Results.Factories;

namespace Enyim.Caching.Memcached.Results.Helpers
{

public static class ResultHelper
{

public static string ProcessResponseData(ArraySegment<byte> data, string message = "")
{

if (data != null && data.Count > 0)
if (data.Count > 0)
{
try
{
Expand Down
24 changes: 12 additions & 12 deletions Enyim.Caching/MemcachedClient.Results.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public IStoreOperationResult ExecuteStore(StoreMode mode, string key, object val
ulong tmp = 0;
int status;

return this.PerformStore(mode, key, value, MemcachedClient.GetExpiration(validFor, null), ref tmp, out status);
return this.PerformStore(mode, key, value, MemcachedClient.GetExpiration(validFor), ref tmp, out status);
}

/// <summary>
Expand All @@ -58,7 +58,7 @@ public IStoreOperationResult ExecuteStore(StoreMode mode, string key, object val
ulong tmp = 0;
int status;

return this.PerformStore(mode, key, value, MemcachedClient.GetExpiration(null, expiresAt), ref tmp, out status);
return this.PerformStore(mode, key, value, MemcachedClient.GetExpiration(expiresAt), ref tmp, out status);
}

#endregion
Expand Down Expand Up @@ -101,7 +101,7 @@ public IStoreOperationResult ExecuteCas(StoreMode mode, string key, object value
/// <returns>A CasResult object containing the version of the item and the result of the operation (true if the item was successfully stored in the cache; false otherwise).</returns>
public IStoreOperationResult ExecuteCas(StoreMode mode, string key, object value, TimeSpan validFor, ulong cas)
{
return this.PerformStore(mode, key, value, MemcachedClient.GetExpiration(validFor, null), cas);
return this.PerformStore(mode, key, value, MemcachedClient.GetExpiration(validFor), cas);
}

/// <summary>
Expand All @@ -115,7 +115,7 @@ public IStoreOperationResult ExecuteCas(StoreMode mode, string key, object value
/// <returns>A CasResult object containing the version of the item and the result of the operation (true if the item was successfully stored in the cache; false otherwise).</returns>
public IStoreOperationResult ExecuteCas(StoreMode mode, string key, object value, DateTime expiresAt, ulong cas)
{
return this.PerformStore(mode, key, value, MemcachedClient.GetExpiration(null, expiresAt), cas);
return this.PerformStore(mode, key, value, MemcachedClient.GetExpiration(expiresAt), cas);
}
#endregion

Expand Down Expand Up @@ -222,7 +222,7 @@ public IMutateOperationResult ExecuteIncrement(string key, ulong defaultValue, u
/// <remarks>If the client uses the Text protocol, the item must be inserted into the cache before it can be changed. It must be inserted as a <see cref="T:System.String"/>. Moreover the Text protocol only works with <see cref="System.UInt32"/> values, so return value -1 always indicates that the item was not found.</remarks>
public IMutateOperationResult ExecuteIncrement(string key, ulong defaultValue, ulong delta, TimeSpan validFor)
{
return this.PerformMutate(MutationMode.Increment, key, defaultValue, delta, MemcachedClient.GetExpiration(validFor, null));
return this.PerformMutate(MutationMode.Increment, key, defaultValue, delta, MemcachedClient.GetExpiration(validFor));
}

/// <summary>
Expand All @@ -236,7 +236,7 @@ public IMutateOperationResult ExecuteIncrement(string key, ulong defaultValue, u
/// <remarks>If the client uses the Text protocol, the item must be inserted into the cache before it can be changed. It must be inserted as a <see cref="T:System.String"/>. Moreover the Text protocol only works with <see cref="System.UInt32"/> values, so return value -1 always indicates that the item was not found.</remarks>
public IMutateOperationResult ExecuteIncrement(string key, ulong defaultValue, ulong delta, DateTime expiresAt)
{
return this.PerformMutate(MutationMode.Increment, key, defaultValue, delta, MemcachedClient.GetExpiration(null, expiresAt));
return this.PerformMutate(MutationMode.Increment, key, defaultValue, delta, MemcachedClient.GetExpiration(expiresAt));
}

/// <summary>
Expand Down Expand Up @@ -265,7 +265,7 @@ public IMutateOperationResult ExecuteIncrement(string key, ulong defaultValue, u
/// <remarks>If the client uses the Text protocol, the item must be inserted into the cache before it can be changed. It must be inserted as a <see cref="T:System.String"/>. Moreover the Text protocol only works with <see cref="System.UInt32"/> values, so return value -1 always indicates that the item was not found.</remarks>
public IMutateOperationResult ExecuteIncrement(string key, ulong defaultValue, ulong delta, TimeSpan validFor, ulong cas)
{
return this.CasMutate(MutationMode.Increment, key, defaultValue, delta, MemcachedClient.GetExpiration(validFor, null), cas);
return this.CasMutate(MutationMode.Increment, key, defaultValue, delta, MemcachedClient.GetExpiration(validFor), cas);
}

/// <summary>
Expand All @@ -280,7 +280,7 @@ public IMutateOperationResult ExecuteIncrement(string key, ulong defaultValue, u
/// <remarks>If the client uses the Text protocol, the item must be inserted into the cache before it can be changed. It must be inserted as a <see cref="T:System.String"/>. Moreover the Text protocol only works with <see cref="System.UInt32"/> values, so return value -1 always indicates that the item was not found.</remarks>
public IMutateOperationResult ExecuteIncrement(string key, ulong defaultValue, ulong delta, DateTime expiresAt, ulong cas)
{
return this.CasMutate(MutationMode.Increment, key, defaultValue, delta, MemcachedClient.GetExpiration(null, expiresAt), cas);
return this.CasMutate(MutationMode.Increment, key, defaultValue, delta, MemcachedClient.GetExpiration(expiresAt), cas);
}

/// <summary>
Expand All @@ -307,7 +307,7 @@ public IMutateOperationResult ExecuteDecrement(string key, ulong defaultValue, u
/// <remarks>If the client uses the Text protocol, the item must be inserted into the cache before it can be changed. It must be inserted as a <see cref="T:System.String"/>. Moreover the Text protocol only works with <see cref="System.UInt32"/> values, so return value -1 always indicates that the item was not found.</remarks>
public IMutateOperationResult ExecuteDecrement(string key, ulong defaultValue, ulong delta, TimeSpan validFor)
{
return this.PerformMutate(MutationMode.Decrement, key, defaultValue, delta, MemcachedClient.GetExpiration(validFor, null));
return this.PerformMutate(MutationMode.Decrement, key, defaultValue, delta, MemcachedClient.GetExpiration(validFor));
}

/// <summary>
Expand All @@ -321,7 +321,7 @@ public IMutateOperationResult ExecuteDecrement(string key, ulong defaultValue, u
/// <remarks>If the client uses the Text protocol, the item must be inserted into the cache before it can be changed. It must be inserted as a <see cref="T:System.String"/>. Moreover the Text protocol only works with <see cref="System.UInt32"/> values, so return value -1 always indicates that the item was not found.</remarks>
public IMutateOperationResult ExecuteDecrement(string key, ulong defaultValue, ulong delta, DateTime expiresAt)
{
return this.PerformMutate(MutationMode.Decrement, key, defaultValue, delta, MemcachedClient.GetExpiration(null, expiresAt));
return this.PerformMutate(MutationMode.Decrement, key, defaultValue, delta, MemcachedClient.GetExpiration(expiresAt));
}

/// <summary>
Expand Down Expand Up @@ -350,7 +350,7 @@ public IMutateOperationResult ExecuteDecrement(string key, ulong defaultValue, u
/// <remarks>If the client uses the Text protocol, the item must be inserted into the cache before it can be changed. It must be inserted as a <see cref="T:System.String"/>. Moreover the Text protocol only works with <see cref="System.UInt32"/> values, so return value -1 always indicates that the item was not found.</remarks>
public IMutateOperationResult ExecuteDecrement(string key, ulong defaultValue, ulong delta, TimeSpan validFor, ulong cas)
{
return this.CasMutate(MutationMode.Decrement, key, defaultValue, delta, MemcachedClient.GetExpiration(validFor, null), cas);
return this.CasMutate(MutationMode.Decrement, key, defaultValue, delta, MemcachedClient.GetExpiration(validFor), cas);
}

/// <summary>
Expand All @@ -365,7 +365,7 @@ public IMutateOperationResult ExecuteDecrement(string key, ulong defaultValue, u
/// <remarks>If the client uses the Text protocol, the item must be inserted into the cache before it can be changed. It must be inserted as a <see cref="T:System.String"/>. Moreover the Text protocol only works with <see cref="System.UInt32"/> values, so return value -1 always indicates that the item was not found.</remarks>
public IMutateOperationResult ExecuteDecrement(string key, ulong defaultValue, ulong delta, DateTime expiresAt, ulong cas)
{
return this.CasMutate(MutationMode.Decrement, key, defaultValue, delta, MemcachedClient.GetExpiration(null, expiresAt), cas);
return this.CasMutate(MutationMode.Decrement, key, defaultValue, delta, MemcachedClient.GetExpiration(expiresAt), cas);
}
#endregion

Expand Down
Loading