X-Git-Url: http://git.dolda2000.com/gitweb/?a=blobdiff_plain;f=pdm%2Fcli.py;h=df04883bc894d5a8c077e05209d41c1e621e5725;hb=dc1b10b810fa36c126aba450616e9292b85798c5;hp=667e2ed5f851a64189b92921b0297fc7bc0e000b;hpb=578de289fa6936c1a6b21cc962b5a64d5a3a0e52;p=pdm.git diff --git a/pdm/cli.py b/pdm/cli.py index 667e2ed..df04883 100644 --- a/pdm/cli.py +++ b/pdm/cli.py @@ -71,13 +71,19 @@ class client(object): if proto is not None: self.select(proto) + @property + def closed(self): + return self.sk is None + def close(self): """Close this connection""" - self.sk.close() + if self.sk is not None: + self.sk.close() + self.sk = None def fileno(self): """Return the file descriptor of the underlying socket.""" - return self.sk.fileno() + return self.sk.fileno() if self.sk else None def readline(self): """Read a single NL-terminated line and return it.""" @@ -197,7 +203,8 @@ class perfproxy(object): def close(self): if self.id is not None: - self.cl.run("unbind", self.id) + if not self.cl.closed: + self.cl.run("unbind", self.id) del self.cl.proxies[self.id] self.id = None @@ -324,7 +331,7 @@ class perfclient(client): used by the server process. The proxy objects returned by this function are cached and the - same object are returned the next time the same name is + same object is returned the next time the same name is requested, which means that they are kept live until the client connection is closed. """