Reputation: 103
I have a simple TCP client which is connected to twisted using:
reactor.connectTCP(host, port, SomeClientFactory())
The program is able to receive a HUP signal to trigger a reload. I'd like to basically:
However, I can't seem to find a way to acheive the first of these points. Any tips?
Thanks
Upvotes: 1
Views: 1878
Reputation: 48325
IReactorTCP.connectTCP returns an IConnector
provider. As you can see on the definition of the IConnector
interface, the disconnect
method will do something like what you want. You can also use the protocol instance's transport attribute's loseConnection
method, of course. The latter would be more suitable if there's any kind of cleanup you want the protocol to do before actually disconnecting, since you could put that work and a call to loseConnection at the end of a method like shutdown
or quit
or cleanup
on the protocol class and then just call that.
Upvotes: 2