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

Fold the SimpleObjectPool into ConnectedSocketPool #113

Merged
merged 2 commits into from
Oct 4, 2018

Conversation

AnthonySteele
Copy link
Contributor

@AnthonySteele AnthonySteele commented Oct 3, 2018

Summarise the changes this Pull Request makes.

Fold the SimpleObjectPool into ConnectedSocketPool, as that is the only place that it used.

Follow on from #109

Todo in later PRs:
ConnectedSocketPool is used in PooledUdpTransport.
We also have:

  • UdpTransport - the unpooled version, suggest that that one is deleted in 4.0.0
  • IpTransport which is useful for AWS Lambdas, but could also benefit from pooling? ConnectedSocketPool could also be extended to have option to store the IP sockets if need be?

Please include a reference to a GitHub issue if appropriate.

Fold the `SimpleObjectPool` into `ConnectedSocketPool`
as that is the only place that it used.
@AnthonySteele AnthonySteele requested a review from a team as a code owner October 3, 2018 14:39
private readonly SimpleObjectPool<Socket> _pool;
private readonly ConcurrentBag<Socket> _pool = new ConcurrentBag<Socket>();

public IPEndPoint IpEndPoint { get; }

public ConnectedSocketPool(IPEndPoint ipEndPoint)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should make count a parameter and have the caller specify the value? (which would happen to be Environment.ProcessorCount)

{
var socket = UdpTransport.CreateSocket();
if (socket == null)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UdpTransport.CreateSocket() never returns null.

- remove redundant null check
- hoist the `Environment.ProcessorCount` up to `PooledUdpTransport`
@AnthonySteele AnthonySteele merged commit 7117001 into justeattakeaway:master Oct 4, 2018
@AnthonySteele AnthonySteele deleted the integrated-pool branch October 4, 2018 14:10
@martincostello martincostello added this to the v4.0.0 milestone Oct 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants