#NEWLINE# def close( self , reply_code = 0 , reply_text = '' , class_id = 0 , method_id = 0 ) : #NEWLINE# #INDENT# '\n        Close this channel.  Caller has the option of specifying the reason for\n        closure and the class and method ids of the current frame in which an\n        error occurred.  If in the event of an exception, the channel will be\n        marked as immediately closed.  If channel is already closed, call is\n        ignored.\n        ' #NEWLINE# if ( ( not getattr ( self , 'channel' , None ) ) or self . channel . _closed ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# self . channel . _close_info = { #NEWLINE# #INDENT# 'reply_code' : reply_code , #NEWLINE# 'reply_text' : reply_text , #NEWLINE# 'class_id' : class_id , #NEWLINE# 'method_id' : method_id , #NEWLINE# #UNINDENT# } #NEWLINE# try : #NEWLINE# #INDENT# args = Writer ( ) #NEWLINE# args . write_short ( reply_code ) #NEWLINE# args . write_shortstr ( reply_text [ : 255 ] ) #NEWLINE# args . write_short ( class_id ) #NEWLINE# args . write_short ( method_id ) #NEWLINE# self . send_frame ( MethodFrame ( self . channel_id , 20 , 40 , args ) ) #NEWLINE# self . channel . add_synchronous_cb ( self . _recv_close_ok ) #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# if self . channel : #NEWLINE# #INDENT# self . channel . _closed = True