Am 26.06.2017 um 17:24 schrieb Steven Schveighoffer:

On 6/26/17 8:58 AM, Paolo Invernizzi wrote:

(...)

Basically, if some of the pooled connection is closed, the pool
suddenly become useless... or at least, as you pointed out, it's not
usable with the TCPConnection.
In my opinion, at least a method to tell the pool to discard a pooled
connection is needed, what do you think?

It's not a terrible idea, but you could also just wrap the connection in
something that can recreate the TCPConnection, and then pool on that.

I can see it being easier to deal with instructing the pool to discard
or reuse an instance than this.

-Steve

In general, nothing speaks against adding a way to discard connections.
It's mostly just that all previous use cases involved high level
connections that had to carry a connection reestablishment logic anyway,
and removing an arbitrary connection is not efficient for many
concurrent connections, because right now they are kept in an array.

(Having said that, I've just looked at the code and lockConnection
currently iterates over the array to find a free connection, so the
efficiency argument is kind of moot, and this needs to be improved anyway.)