浏览代码

protocol: only try to close a peer connection when there is a peer

Malte Kraus 8 年之前
父节点
当前提交
20f16c3fa3
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      src/protocol.py

+ 2 - 1
src/protocol.py

@@ -278,7 +278,8 @@ class Protocol:
             except:
             except:
                 logging.exception("unhandled exception in event handler")
                 logging.exception("unhandled exception in event handler")
                 try:
                 try:
-                    peer.close()
+                    if peer is not None:
+                        peer.close()
                 except OSError:
                 except OSError:
                     pass
                     pass