Fix two races in interface.py.
Fix two races in interface.py.

First, close the socket from the thread itself rather than from
the stop() function.  This prevents another thread closing the
socket that the interface thread is simultaneously using.

Second, it occasionally would happen that the parent thread such as
network.py start() an interface, do a send_request() and timeout
waiting for a response (timeouts are 0.1s).  It would check
is_connected(), get False, and assume the connection has failed.
In fact the thread hadn't even been scheduled or gotten around to
completing the socket connection.  Fix by having self.connected
start out True.  If the connection fails or times out, we set
connected to False soon enough.

Finally for correctness we need to deepcopy a send_request() rather
than take a reference to it.

pknight007/electrum-vtc,imrehg/electrum,imrehg/electrum,cryptapus/electrum,asfin/electrum,vertcoin/electrum-vtc,romanz/electrum,romanz/electrum,imrehg/electrum,fujicoin/electrum-fjc,fyookball/electrum,FairCoinTeam/electrum-fair,neocogent/electrum,cryptapus/electrum-uno,aasiutin/electrum,vertcoin/electrum-vtc,cryptapus/electrum-uno,spesmilo/electrum,dabura667/electrum,dabura667/electrum,argentumproject/electrum-arg,digitalbitbox/electrum,fyookball/electrum,neocogent/electrum,pknight007/electrum-vtc,lbryio/lbryum,argentumproject/electrum-arg,digitalbitbox/electrum,procrasti/electrum,spesmilo/electrum,cryptapus/electrum-myr,cryptapus/electrum-myr,dashpay/electrum-dash,pooler/electrum-ltc,fireduck64/electrum,wakiyamap/electrum-mona,spesmilo/electrum,protonn/Electrum-Cash,protonn/Electrum-Cash,molecular/electrum,fireduck64/electrum,vertcoin/electrum-vtc,wakiyamap/electrum-mona,molecular/electrum,fyookball/electrum,pooler/electrum-ltc,FairCoinTeam/electrum-fair,procrasti/electrum,pknight007/electrum-vtc,cryptapus/electrum,dabura667/electrum,cryptapus/electrum-uno,pknight007/electrum-vtc,spesmilo/electrum,vialectrum/vialectrum,fujicoin/electrum-fjc,fireduck64/electrum,procrasti/electrum,procrasti/electrum,aasiutin/electrum,argentumproject/electrum-arg,kyuupichan/electrum,vialectrum/vialectrum,molecular/electrum,dashpay/electrum-dash,protonn/Electrum-Cash,imrehg/electrum,wakiyamap/electrum-mona,lbryio/lbryum,aasiutin/electrum,aasiutin/electrum,argentumproject/electrum-arg,romanz/electrum,protonn/Electrum-Cash,vialectrum/vialectrum,vertcoin/electrum-vtc,kyuupichan/electrum,wakiyamap/electrum-mona,dashpay/electrum-dash,cryptapus/electrum-myr,FairCoinTeam/electrum-fair,dashpay/electrum-dash,pooler/electrum-ltc,digitalbitbox/electrum,dabura667/electrum,kyuupichan/electrum,asfin/electrum,cryptapus/electrum-uno,neocogent/electrum,FairCoinTeam/electrum-fair,molecular/electrum,digitalbitbox/electrum,asfin/electrum,cryptapus/electrum,fireduck64/electrum,fujicoin/electrum-fjc,cryptapus/electrum-myr,pooler/electrum-ltc