Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

NCBC-375: preferring ipv4-address #11

Closed
wants to merge 1 commit into from

2 participants

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 29, 2014
  1. NCBC-375: preferring ipv4-address

    sdir456 authored
This page is out of date. Refresh to see the latest.
Showing with 6 additions and 5 deletions.
  1. +6 −5 src/Couchbase/CouchbasePool.cs
View
11 src/Couchbase/CouchbasePool.cs
@@ -1,7 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using System.Net;
+using System.Net;
+using System.Net.Sockets;
using System.Threading;
using Couchbase.Management;
using Enyim.Caching.Configuration;
@@ -297,10 +298,10 @@ private static IPAddress GetFirstAddress(string hostname)
{
if (log.IsDebugEnabled)
foreach (IPAddress item in items)
- log.DebugFormat("Found address {0} for {1}", item, hostname);
-
- var retval = items[0];
-
+ log.DebugFormat("Found address {0} for {1}", item, hostname);
+
+ var retval = items.FirstOrDefault(item => item.AddressFamily == AddressFamily.InterNetwork) ?? items[0];
+
if (log.IsDebugEnabled)
log.DebugFormat("Using address {0} for {1}", retval, hostname);
Something went wrong with that request. Please try again.