@@ -85,7 +85,7 @@ public SocketFrameHandler(AmqpTcpEndpoint endpoint,
85
85
{
86
86
Endpoint = endpoint ;
87
87
88
- if ( Socket . OSSupportsIPv6 && endpoint . AddressFamily != AddressFamily . InterNetwork )
88
+ if ( ShouldTryIPV6 ( endpoint ) )
89
89
{
90
90
try {
91
91
m_socket = ConnectUsingIPv6 ( endpoint , socketFactory , connectionTimeout ) ;
@@ -155,12 +155,10 @@ public int ReadTimeout
155
155
m_socket . ReceiveTimeout = value ;
156
156
}
157
157
}
158
- #pragma warning disable 0168
159
- catch ( SocketException _ )
158
+ catch ( SocketException )
160
159
{
161
160
// means that the socket is already closed
162
161
}
163
- #pragma warning restore 0168
164
162
}
165
163
}
166
164
@@ -181,13 +179,6 @@ public void Close()
181
179
{
182
180
try
183
181
{
184
- try
185
- {
186
-
187
- } catch ( ArgumentException )
188
- {
189
- // ignore, we are closing anyway
190
- } ;
191
182
m_socket . Close ( ) ;
192
183
}
193
184
catch ( Exception )
@@ -264,6 +255,11 @@ public void Flush()
264
255
}
265
256
}
266
257
258
+ private bool ShouldTryIPV6 ( AmqpTcpEndpoint endpoint )
259
+ {
260
+ return ( Socket . OSSupportsIPv6 && endpoint . AddressFamily != AddressFamily . InterNetwork )
261
+ }
262
+
267
263
private ITcpClient ConnectUsingIPv6 ( AmqpTcpEndpoint endpoint ,
268
264
Func < AddressFamily , ITcpClient > socketFactory ,
269
265
int timeout )
0 commit comments