def shutdown(self, how):
if (how == <NUM_LIT:0>) or (how == <NUM_LIT:2>):<EOL><INDENT>self.eof_received = <NUM_LIT:1><EOL><DEDENT>if (how == <NUM_LIT:1>) or (how == <NUM_LIT:2>):<EOL><INDENT>self.lock.acquire()<EOL>try:<EOL><INDENT>m = self._send_eof()<EOL><DEDENT>finally:<EOL><INDENT>self.lock.release()<EOL><DEDENT>if m is not None:<EOL><INDENT>self.transport._send_user_message(m)<EOL><DEDENT><DEDENT>
Shut down one or both halves of the connection.  If C{how} is 0,
further receives are disallowed.  If C{how} is 1, further sends
are disallowed.  If C{how} is 2, further sends and receives are
disallowed.  This closes the stream in one or both directions.

@param how: 0 (stop receiving), 1 (stop sending), or 2 (stop
    receiving and sending).
@type how: int