From b32baa65b1179923e9c240d6729b7a93a9abf3a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?poljar=20=28Damir=20Jeli=C4=87=29?= Date: Thu, 1 Feb 2018 18:02:58 +0100 Subject: [PATCH] Fix some style issues. --- main.py | 16 ++++++++-------- matrix/server.py | 7 +++---- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/main.py b/main.py index 78b04a4..7500cc2 100644 --- a/main.py +++ b/main.py @@ -163,23 +163,23 @@ def ssl_fd_cb(server_name, file_descriptor): def try_ssl_handshake(server): - socket = server.socket + sock = server.socket while True: try: - socket.do_handshake() + sock.do_handshake() - cipher = socket.cipher() + cipher = sock.cipher() cipher_message = ("{prefix}matrix: Connected using {tls}, and " "{bit} bit {cipher} cipher suite.").format( - prefix=W.prefix("network"), - tls=cipher[1], - bit=cipher[2], - cipher=cipher[0]) + prefix=W.prefix("network"), + tls=cipher[1], + bit=cipher[2], + cipher=cipher[0]) W.prnt(server.server_buffer, cipher_message) # TODO print out the certificates - # cert = socket.getpeercert() + # cert = sock.getpeercert() # W.prnt(server.server_buffer, pprint.pformat(cert)) finalize_connection(server) diff --git a/matrix/server.py b/matrix/server.py index 099fe98..1f18c46 100644 --- a/matrix/server.py +++ b/matrix/server.py @@ -304,7 +304,6 @@ def matrix_server_disconnect(server, reconnect=True): if server.fd_hook: W.unhook(server.fd_hook) - # TODO close socket close_socket(server.socket) server.fd_hook = None @@ -400,17 +399,17 @@ def send_or_queue(server, message): def try_send(server, message): # type: (MatrixServer, bytes) -> bool - socket = server.socket + sock = server.socket total_sent = 0 message_length = len(message) while total_sent < message_length: try: - sent = socket.send(message[total_sent:]) + sent = sock.send(message[total_sent:]) except ssl.SSLWantWriteError: hook = W.hook_fd( - server.socket.fileno(), + server.sock.fileno(), 0, 1, 0, "send_cb", server.name