Skip to content
This repository has been archived by the owner on Nov 23, 2017. It is now read-only.

Make Server attributes and methods private #180

Closed
GoogleCodeExporter opened this issue Apr 10, 2015 · 3 comments
Closed

Make Server attributes and methods private #180

GoogleCodeExporter opened this issue Apr 10, 2015 · 3 comments

Comments

@GoogleCodeExporter
Copy link

Currently, all Server attributes and methods are public, whereas only close() 
and wait_close() are documented:
https://docs.python.org/dev/library/asyncio-eventloop.html#asyncio.AbstractServe
r

Many unit tests use Server.sockets list. Should it be public and documented?

I proposed to make loop, waiters and active_count attributes private. I also 
propose to make attach(), detach() and wakeup() methods private.

loop and waiters attributes and wakeup() method are private in other classes.

Patch:
http://codereview.appspot.com/111730044

My patch also combines the change proposed by Vajrasky Kok: remove the 
transport parameter from attach() and detach() since it's not used. detach() 
may be more strict and ensure that the transport was attached. Maybe do nothing 
if the transport is not attached? But it requires to maintain a list of 
attached transports, which can be an issue, like introducing a reference cycle.

Original issue reported on code.google.com by victor.s...@gmail.com on 1 Jul 2014 at 10:54

@GoogleCodeExporter
Copy link
Author

I commited my patch to Tulip (f49786bd65fc), Python 3.4 (e6198242a537) and 
Python 3.5 (5a299c3ec120).

I also documented the Server.sockets attribute. By the way, the documentation 
of Server.close() was wrong: "Stop serving. This leaves existing connections 
open." The method closes listening sockets. Or maybe I misunderstood the term 
"connections".

Original comment by victor.s...@gmail.com on 11 Jul 2014 at 9:51

  • Changed state: Fixed

@GoogleCodeExporter
Copy link
Author

The close() docs distinguish between the sockets that are listening for new 
connections (there should be one per IP+port that is listening on the server) 
and the sockets that represent existing incoming connections (one per active 
client).

The close() call stops listening, so no new incoming connections can be made, 
but leaves the already-connected clients untouched.

Original comment by gvanrossum@gmail.com on 11 Jul 2014 at 10:26

@GoogleCodeExporter
Copy link
Author

Ok, it understood something like that but I was not sure.

I changed again the documentation to be more explicit:
---
   .. method:: close()

      Stop serving: close listening sockets and set the :attr:`sockets`
      attribute to ``None``.

      The sockets that represent existing incoming client connections are
      leaved open.

      The server is closed asynchonously, use the :meth:`wait_closed` coroutine
      to wait until the server is closed.
---

You can modify directly the documentation if you want to change it.

Original comment by victor.s...@gmail.com on 12 Jul 2014 at 1:22

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant