The issue was caused by how Mocket._address was used to determine which host and port to connect to in MocketSocket.true_sendall. Mocket._address gets overwritten when another MocketSocket instance's connect method gets called and could be the wrong address to use in that case.
This PR fixes the issue by referencing the current instance's _host and _port attributes instead.
I see that, in MocketSocket.getpeercert, there's code that accounts for the case where _host and _port are not set to truthy values; not sure if that can happen in true_sendall as well and should be accounted for, or if the current simple fix will be enough (or maybe even that it'd be a different kind of bug if _host and _port aren't set by the time true_sendall gets called).
Fixes #221
The issue was caused by how
Mocket._address
was used to determine which host and port to connect to inMocketSocket.true_sendall
.Mocket._address
gets overwritten when anotherMocketSocket
instance'sconnect
method gets called and could be the wrong address to use in that case.This PR fixes the issue by referencing the current instance's
_host
and_port
attributes instead.I see that, in
MocketSocket.getpeercert
, there's code that accounts for the case where_host
and_port
are not set to truthy values; not sure if that can happen intrue_sendall
as well and should be accounted for, or if the current simple fix will be enough (or maybe even that it'd be a different kind of bug if_host
and_port
aren't set by the timetrue_sendall
gets called).