Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

netplay: some more IClientConnection improvements (safety and completeness) #4210

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ManManson
Copy link
Member

The changeset contains the following two fixes:

  1. Make IClientConnection as generic as possible by moving readAll() implementation from TCPClientConnection to IClientConnection level
  2. Enforce safe disposal pattern for client connections, so that one doesn't have the ability to accidentally call delete on a connection instance directly and has to use IClientConnection::close(), which will ensure that connection disposal is performed in a safe way (i.e. doesn't interfere with PendingWritesManager).

@ManManson ManManson requested a review from past-due February 24, 2025 09:15
@ManManson ManManson added this to the 4.6.0-beta1 milestone Feb 24, 2025
@ManManson ManManson changed the title netplay: some more IClientConnection improvements netplay: some more IClientConnection improvements (safety and completeness) Feb 24, 2025
This method is generic enough to be lifted to the `IClientConnection`
level since it only relies on the following two things:

1. `IDescriptorSet` implementation, provided by the parent
   `WzConnectionProvider`
2. `recvImpl()` method from a concrete implementation of
   `IClientConnection`

Signed-off-by: Pavel Solodovnikov <[email protected]>
Mark `IClientConnection` destructor as `protected`, so that
external code cannot accidentally invoke `delete` on a connection
object directly, and thus is forced to call `close()` method on
it for safe disposal.

Signed-off-by: Pavel Solodovnikov <[email protected]>
@ManManson ManManson force-pushed the netplay_client_connection_refactoring_02_2025 branch from c5f8d78 to c0046b5 Compare February 24, 2025 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant