VictorTrapenok/SimpleRedisClient

Possinle double close of the socket

erik-nc opened this issue · 0 comments

Hi,

I've noticed that the FD of the redis connection socket might be closed twice, if redis_close() is called explicitly and afterwards the client object gets out of scope causing a call to the destructor.
Especially in a multi-threaded context an application might already opened a new FD with the very same number. I suggest setting the FD to 0 in redis_close() to avoid the double close. Better would be using -1 to denote an uninitialized or closed FD.

Best regards
Erik