Changeset 245 for trunk/pyopencoin/oc
- Timestamp:
- 04/04/08 04:24:15 (4 years ago)
- Location:
- trunk/pyopencoin/oc
- Files:
-
- 2 modified
-
entities.py (modified) (2 diffs)
-
protocols.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pyopencoin/oc/entities.py
r244 r245 734 734 735 735 >>> stt.send('FETCH_CDD_REQUEST', '0') 736 <Message('FETCH_CDD_PASS',[...] ])>736 <Message('FETCH_CDD_PASS',[...])> 737 737 738 738 >>> stt.send('foo') 739 739 <Message('PROTOCOL_ERROR','send again...')> 740 740 741 FIXME: There is a problem here. If we send anything other than a goodbye 742 next, we go into an infinite loop. I believe that the correct response is 743 another PROTOCOL_ERROR at this point 744 #>>> stt.send('FETCH_CDD_REQUEST', '0') 745 #<Message('FETCH_CDD_PASS',[...])> 741 >>> stt.send('FETCH_CDD_REQUEST', '0') 742 <Message('FETCH_CDD_PASS',[...])> 746 743 747 744 >>> stt.send('GOODBYE') … … 750 747 """ 751 748 if hasattr(transport, 'protocol') and transport.protocol: 749 # transport will only have protocol if we are looping on ourselves. Don't 750 # setup protocol again. Just reset the transport to use the protocol and 751 # reset the protocol itself 752 752 transport.setProtocol(self.protocol) 753 self.protocol.newState(self.protocol.start) 753 754 754 755 else: -
trunk/pyopencoin/oc/protocols.py
r244 r245 49 49 message = Message('GOODBYE') 50 50 #we are not done 51 if not self.done: 52 #maybe we need to reset? 51 if not self.done: 52 #maybe we need to reset? 53 53 if message.type != 'GOODBYE' and hasattr(self, 'transport') and hasattr(self.transport, 'autoreset'): 54 54 self.transport.autoreset(self.transport) … … 71 71 self.state = method 72 72 73 def initiateHandshake(self,message): 73 def initiateHandshake(self,message): 74 74 self.newState(self.verifyHandshake) 75 75 return Message('HANDSHAKE',[['protocol', 'opencoin 1.0']]) … … 176 176 nextprotocol = self.mapping[message.type](self.arguments) 177 177 except KeyError: 178 self.newState(self.goodbye)179 return ProtocolErrorMessage('aHP')180 except AttributeError:181 178 self.newState(self.goodbye) 182 179 return ProtocolErrorMessage('aHP')
