Skip to content
This repository has been archived by the owner on Sep 8, 2020. It is now read-only.

Commit

Permalink
- Added an address option to start to be able to specify an a…
Browse files Browse the repository at this point in the history
…dapter to bind to
  • Loading branch information
Adam Groszer committed Jan 17, 2010
1 parent 829cb94 commit ce845b4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
6 changes: 6 additions & 0 deletions src/zc/monitor/CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
Change History
==============

0.2.1 (unreleased)
------------------

- Added an ``address`` option to ``start`` to be able to specify an adapter
to bind to

0.2.0 (2009-10-28)
------------------

Expand Down
12 changes: 6 additions & 6 deletions src/zc/monitor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,15 @@ def handle_close(self, connection, reason):
pass # Don't care


def start(port):
def start(port, address=''):
"""start monitor server.
Returns True if monitor server started; returns False if the port is
already in use; and raises an exception otherwise.
"""
import zc.ngi.async
try:
zc.ngi.async.listener(('', port), Server)
zc.ngi.async.listener((address, port), Server)
except socket.error, e:
if e.args[0] == errno.EADDRINUSE:
# Don't kill the process just because somebody else has our port.
Expand All @@ -95,19 +95,19 @@ def start(port):

def interactive(connection):
"""Turn on monitor's interactive mode
Normally, the monitor releases the connection after a single command.
By entering the interactive mode, the monitor will not end the connection
until you enter the "quit" command.
In interactive mode, an empty line repeats the last command.
"""
connection.write('Interactive mode on. Use "quit" To exit.\n')
return INTERACTIVE_MARKER

def quit(connection):
"""Quit the monitor
This is only really useful in interactive mode (see the "interactive"
command).
"""
Expand Down

0 comments on commit ce845b4

Please sign in to comment.