Skip to content

Commit

Permalink
Long running process -> does not free memory. #30
Browse files Browse the repository at this point in the history
  • Loading branch information
chronoxor committed Jun 9, 2020
1 parent 944598a commit 9e5f1bb
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 0 deletions.
5 changes: 5 additions & 0 deletions source/NetCoreServer/SslClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ public virtual bool Connect()
Socket.Close();
// Dispose the client socket
Socket.Dispose();
// Dispose event arguments
_connectEventArg.Dispose();

// Call the client disconnected handler
SendError(ex.SocketErrorCode);
Expand Down Expand Up @@ -292,6 +294,9 @@ public virtual bool Disconnect()
// Dispose the client socket
Socket.Dispose();

// Dispose event arguments
_connectEventArg.Dispose();

// Update the client socket disposed flag
IsSocketDisposed = true;
}
Expand Down
3 changes: 3 additions & 0 deletions source/NetCoreServer/SslServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,9 @@ public virtual bool Stop()
// Dispose the acceptor socket
_acceptorSocket.Dispose();

// Dispose event arguments
_acceptorEventArg.Dispose();

// Update the acceptor socket disposed flag
IsSocketDisposed = true;

Expand Down
9 changes: 9 additions & 0 deletions source/NetCoreServer/TcpClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@ public virtual bool Connect()
Socket.Close();
// Dispose the client socket
Socket.Dispose();
// Dispose event arguments
_connectEventArg.Dispose();
_receiveEventArg.Dispose();
_sendEventArg.Dispose();

// Call the client disconnected handler
SendError(ex.SocketErrorCode);
Expand Down Expand Up @@ -229,6 +233,11 @@ public virtual bool Disconnect()
// Dispose the client socket
Socket.Dispose();

// Dispose event arguments
_connectEventArg.Dispose();
_receiveEventArg.Dispose();
_sendEventArg.Dispose();

// Update the client socket disposed flag
IsSocketDisposed = true;
}
Expand Down
3 changes: 3 additions & 0 deletions source/NetCoreServer/TcpServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,9 @@ public virtual bool Stop()
// Dispose the acceptor socket
_acceptorSocket.Dispose();

// Dispose event arguments
_acceptorEventArg.Dispose();

// Update the acceptor socket disposed flag
IsSocketDisposed = true;

Expand Down
4 changes: 4 additions & 0 deletions source/NetCoreServer/TcpSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ public virtual bool Disconnect()
// Dispose the session socket
Socket.Dispose();

// Dispose event arguments
_receiveEventArg.Dispose();
_sendEventArg.Dispose();

// Update the session socket disposed flag
IsSocketDisposed = true;
}
Expand Down
4 changes: 4 additions & 0 deletions source/NetCoreServer/UdpClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,10 @@ public virtual bool Disconnect()
// Dispose the client socket
Socket.Dispose();

// Dispose event arguments
_receiveEventArg.Dispose();
_sendEventArg.Dispose();

// Update the client socket disposed flag
IsSocketDisposed = true;
}
Expand Down
4 changes: 4 additions & 0 deletions source/NetCoreServer/UdpServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,10 @@ public virtual bool Stop()
// Dispose the server socket
Socket.Dispose();

// Dispose event arguments
_receiveEventArg.Dispose();
_sendEventArg.Dispose();

// Update the server socket disposed flag
IsSocketDisposed = false;
}
Expand Down

0 comments on commit 9e5f1bb

Please sign in to comment.