Skip to content

Commit

Permalink
Add some more comments to _get_my_ip().
Browse files Browse the repository at this point in the history
bug 930513.

This patch adds some additional comments to _get_my_ip() to try to make
the code a bit more clear and to clarify that no traffic is actually
sent out by this code.

Change-Id: I6f8d4a0a51596e5c531da53f3c79c5bffca59b39
  • Loading branch information
russellb committed Feb 12, 2012
1 parent d8f8bad commit e023c28
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion nova/flags.py
Expand Up @@ -59,7 +59,14 @@ def DECLARE(name, module_string, flag_values=FLAGS):


def _get_my_ip():
"""Returns the actual ip of the local machine."""
"""
Returns the actual ip of the local machine.
This code figures out what source address would be used if some traffic
were to be sent out to some well known address on the Internet. In this
case, a Google DNS server is used, but the specific address does not
matter much. No traffic is actually sent.
"""
try:
csock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
csock.connect(('8.8.8.8', 80))
Expand Down

0 comments on commit e023c28

Please sign in to comment.