@@ -28,7 +28,7 @@ public class MemcachedNode : IMemcachedNode
2828
2929 private bool isDisposed ;
3030
31- private readonly EndPoint endPoint ;
31+ private readonly EndPoint _endPoint ;
3232 private readonly ISocketPoolConfiguration config ;
3333 private InternalPoolImpl internalPoolImpl ;
3434 private bool isInitialized = false ;
@@ -40,7 +40,8 @@ public MemcachedNode(
4040 ISocketPoolConfiguration socketPoolConfig ,
4141 ILogger logger )
4242 {
43- this . endPoint = endpoint ;
43+ _endPoint = endpoint ;
44+ EndPointString = endpoint ? . ToString ( ) . Replace ( "Unspecified/" , string . Empty ) ;
4445 this . config = socketPoolConfig ;
4546
4647 if ( socketPoolConfig . ConnectionTimeout . TotalMilliseconds >= Int32 . MaxValue )
@@ -72,9 +73,11 @@ protected INodeFailurePolicy FailurePolicy
7273 /// </summary>
7374 public EndPoint EndPoint
7475 {
75- get { return this . endPoint ; }
76+ get { return _endPoint ; }
7677 }
7778
79+ public string EndPointString { get ; private set ; }
80+
7881 /// <summary>
7982 /// <para>Gets a value indicating whether the server is working or not. Returns a <b>cached</b> state.</para>
8083 /// <para>To get real-time information and update the cached state, use the <see cref="M:Ping"/> method.</para>
@@ -771,7 +774,7 @@ protected internal virtual PooledSocket CreateSocket()
771774 {
772775 try
773776 {
774- var ps = new PooledSocket ( this . endPoint , this . config . ConnectionTimeout , this . config . ReceiveTimeout , _logger ) ;
777+ var ps = new PooledSocket ( _endPoint , this . config . ConnectionTimeout , this . config . ReceiveTimeout , _logger ) ;
775778 ps . Connect ( ) ;
776779 return ps ;
777780 }
@@ -787,13 +790,13 @@ protected internal virtual async Task<PooledSocket> CreateSocketAsync()
787790 {
788791 try
789792 {
790- var ps = new PooledSocket ( this . endPoint , this . config . ConnectionTimeout , this . config . ReceiveTimeout , _logger ) ;
793+ var ps = new PooledSocket ( _endPoint , this . config . ConnectionTimeout , this . config . ReceiveTimeout , _logger ) ;
791794 await ps . ConnectAsync ( ) ;
792795 return ps ;
793796 }
794797 catch ( Exception ex )
795798 {
796- var endPointStr = endPoint . ToString ( ) . Replace ( "Unspecified/" , string . Empty ) ;
799+ var endPointStr = _endPoint . ToString ( ) . Replace ( "Unspecified/" , string . Empty ) ;
797800 _logger . LogError ( ex , $ "Failed to { nameof ( CreateSocketAsync ) } to { endPointStr } ") ;
798801 throw ;
799802 }
@@ -835,7 +838,7 @@ protected virtual IPooledSocketResult ExecuteOperation(IOperation op)
835838 }
836839 catch ( IOException e )
837840 {
838- _logger . LogError ( nameof ( MemcachedNode ) , e ) ;
841+ _logger . LogError ( e , $ "Failed to ExecuteOperation on { EndPointString } " ) ;
839842
840843 result . Fail ( "Exception reading response" , e ) ;
841844 return result ;
@@ -887,14 +890,14 @@ protected virtual async Task<IPooledSocketResult> ExecuteOperationAsync(IOperati
887890 }
888891 catch ( IOException e )
889892 {
890- _logger . LogError ( nameof ( MemcachedNode ) , e ) ;
893+ _logger . LogError ( e , $ "IOException occurs when ExecuteOperationAsync( { op } ) on { EndPointString } " ) ;
891894
892895 result . Fail ( "IOException reading response" , e ) ;
893896 return result ;
894897 }
895898 catch ( SocketException e )
896899 {
897- _logger . LogError ( nameof ( MemcachedNode ) , e ) ;
900+ _logger . LogError ( e , $ "SocketException occurs when ExecuteOperationAsync( { op } ) on { EndPointString } " ) ;
898901
899902 result . Fail ( "SocketException reading response" , e ) ;
900903 return result ;
@@ -936,7 +939,7 @@ protected virtual async Task<bool> ExecuteOperationAsync(IOperation op, Action<b
936939 }
937940 catch ( IOException e )
938941 {
939- _logger . LogError ( nameof ( MemcachedNode ) , e ) ;
942+ _logger . LogError ( e , $ "Failed to ExecuteOperationAsync( { op } ) with next action on { EndPointString } " ) ;
940943 ( ( IDisposable ) socket ) . Dispose ( ) ;
941944
942945 return false ;
@@ -956,7 +959,7 @@ private void LogExecutionTime(string title, DateTime startTime, int thresholdMs)
956959
957960 EndPoint IMemcachedNode . EndPoint
958961 {
959- get { return this . EndPoint ; }
962+ get { return _endPoint ; }
960963 }
961964
962965 bool IMemcachedNode . IsAlive
0 commit comments