Skip to content

Commit

Permalink
#61: add test runner, fix test
Browse files Browse the repository at this point in the history
Change AsyncSocket to silently drop disposed connections.
  • Loading branch information
ForNeVeR committed Sep 24, 2016
1 parent 3a0feb0 commit 0bf1d51
Show file tree
Hide file tree
Showing 5 changed files with 841 additions and 28 deletions.
1 change: 1 addition & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ project. To build the project using `dotnet`, invoke the following command:
```console
$ dotnet restore
$ dotnet build **/project.json
$ dotnet test tests/JabberNet.Test/project.json
```

Documentation
Expand Down
17 changes: 13 additions & 4 deletions src/JabberNet/bedrock/net/AsyncSocket.cs
Original file line number Diff line number Diff line change
Expand Up @@ -472,10 +472,19 @@ public override void RequestAccept()
/// <param name="ar"></param>
private void ExecuteAccept(IAsyncResult ar)
{
Socket cli = (Socket) m_sock.EndAccept(ar);
AsyncSocket cliCon = new AsyncSocket(m_watcher);
cliCon.m_sock = cli;
AcceptDone(cliCon);
try
{
var cli = m_sock.EndAccept(ar);
var cliCon = new AsyncSocket(m_watcher)
{
m_sock = cli
};
AcceptDone(cliCon);
}
catch (ObjectDisposedException)
{
// Socket is already disposed; don't accept.
}
}

private void AcceptDone(AsyncSocket cliCon)
Expand Down
15 changes: 2 additions & 13 deletions src/JabberNet/project.lock.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
{
"locked": false,
"version": 2,
"version": 1,
"targets": {
".NETFramework,Version=v4.0": {
"zlib.net/1.0.4": {
"type": "package",
"compile": {
"lib/zlib.net.dll": {}
},
"runtime": {
"lib/zlib.net.dll": {}
}
},
"JabberNet.Netlib.Dns/2.1.2": {
"type": "project",
"framework": ".NETFramework,Version=v4.0"
}
}
},
Expand All @@ -28,10 +23,6 @@
"zlib.net.1.0.4.nupkg.sha512",
"zlib.net.nuspec"
]
},
"JabberNet.Netlib.Dns/2.1.2": {
"type": "project",
"path": "../JabberNet.Netlib.Dns/project.json"
}
},
"projectFileDependencyGroups": {
Expand All @@ -44,7 +35,5 @@
"System.Security >= 4.0.0",
"System.Xml >= 4.0.0"
]
},
"tools": {},
"projectFileToolGroups": {}
}
}
14 changes: 8 additions & 6 deletions tests/JabberNet.Test/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@
"buildOptions": {
"debugType": "portable"
},
"frameworks": {
"net451": {
"frameworkAssemblies": {
}
}
},
"dependencies": {
"NUnit": "3.4.1",
"RhinoMocks": "3.6.1",
"dotnet-test-nunit": "3.4.0-beta-2",

"JabberNet": "*"
},
"frameworks": {
"net40": {
"frameworkAssemblies": {
}
}
}
"testRunner": "nunit"
}
Loading

0 comments on commit 0bf1d51

Please sign in to comment.