Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Köplinger <alex.koeplinger@outlook.com>2017-08-31 11:53:35 +0300
committerGitHub <noreply@github.com>2017-08-31 11:53:35 +0300
commite7a2d94f75e00c1f00ebe8bf02b67df7110a0b9a (patch)
tree98d857fc47b22fd971c867eca01cb7bcfded4edc /mcs/class/test-helpers
parent2439f17bef29b0bf5ae4fc81a1e7f96514810ff5 (diff)
[bcl] Fix a few hardcoded socket ports in tests (#5471)
* [System] Fix a few hardcoded socket ports in tests Those could've shown up as "address already in use" in CI. * [System.Runtime.Remoting] Fix a few hardcoded socket ports in tests Those could've shown up as "address already in use" in CI. Additionally remove a copy of RemotingServicesTest.cs from corlib which also exists in System.Runtime.Remoting in updated form. * [System.ServiceModel] Fix a few hardcoded socket ports in tests Those could've shown up as "address already in use" in CI. * [System.Net.Http] Fix a few hardcoded socket ports in tests Those could've shown up as "address already in use" in CI. The additional "keep-alive" header in Send_Complete_NoContent() and Send_Transfer_Encoding_Chunked() is because we were using the same port for all tests before so other tests would clear the header. This doesn't happen now that we use distinct test ports. * [System.ServiceModel.Web] Fix a few hardcoded socket ports in tests Those could've shown up as "address already in use" in CI.
Diffstat (limited to 'mcs/class/test-helpers')
-rw-r--r--mcs/class/test-helpers/NetworkHelpers.cs7
1 files changed, 4 insertions, 3 deletions
diff --git a/mcs/class/test-helpers/NetworkHelpers.cs b/mcs/class/test-helpers/NetworkHelpers.cs
index 7ebc1fc9c15..9d5eb114081 100644
--- a/mcs/class/test-helpers/NetworkHelpers.cs
+++ b/mcs/class/test-helpers/NetworkHelpers.cs
@@ -17,11 +17,12 @@ namespace MonoTests.Helpers {
{
while (true) {
var ep = new IPEndPoint (IPAddress.Loopback, rndPort.Next (10000, 60000));
- var socket = new Socket (ep.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
try {
- socket.Bind (ep);
- socket.Close ();
+ using (var socket = new Socket (ep.AddressFamily, SocketType.Stream, ProtocolType.Tcp)) {
+ socket.Bind (ep);
+ socket.Close ();
+ }
return ep;
} catch (SocketException) { }
}