24 Nov
2009
24 Nov
'09
9:26 p.m.
I am implementing a protocol where a DatagramProtocol "handshaking" subclass get an arbitrary port (by calling "self.udpPort = reactor.listenUDP(0, self)") and communicate it to a remote host. Once this is done, I would like to "switch" to another DatagramProtocol which would use the same port. To avoid a race condition, I would like to "transfert" self.transport from the first DatagramProtocol to the second without calling self.udpPort.stopListening(). Is this the "twisted" way to analyse this? Or should I use some kind of "proxy" DatagramProtocol which would relay datagramReceived calls to the proper DatagramProtocol, depending on the current protocol state (handshaking or data exchange)? Regards.