#NEWLINE# def send_response( self , transaction ) : #NEWLINE# #INDENT# '\n\n        :type transaction: Transaction\n        :param transaction:\n        ' #NEWLINE# logger . debug ( ( 'send_response - ' + str ( transaction . response ) ) ) #NEWLINE# if ( transaction . response . type is None ) : #NEWLINE# #INDENT# if ( ( transaction . request . type == defines . Types [ 'CON' ] ) and ( not self . request . acknowledged ) ) : #NEWLINE# #INDENT# transaction . response . type = defines . Types [ 'ACK' ] #NEWLINE# transaction . response . mid = transaction . request . mid #NEWLINE# transaction . response . acknowledged = True #NEWLINE# transaction . completed = True #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( transaction . request . type == defines . Types [ 'NON' ] ) : #NEWLINE# #INDENT# transaction . response . type = defines . Types [ 'NON' ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# transaction . response . type = defines . Types [ 'CON' ] #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if ( transaction . response . mid is None ) : #NEWLINE# #INDENT# transaction . response . mid = self . _current_mid #NEWLINE# self . _current_mid += ( 1 % 65535 ) #NEWLINE# try : #NEWLINE# #INDENT# ( host , port ) = transaction . response . destination #NEWLINE# #UNINDENT# except AttributeError : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# key_mid = hash ( ( ( str ( host ) + str ( port ) ) + str ( transaction . response . mid ) ) ) #NEWLINE# self . _transactions [ key_mid ] = transaction #NEWLINE# #UNINDENT# transaction . request . acknowledged = True #NEWLINE# return transaction