# HG changeset patch
# User Thomas P Jakobsen <[email protected]>
# Date 1263974081 -3600
# Node ID 2324d01c74e2c35b5bb6cb4d7bda1304a376b066
# Parent efa1983063d62a8115949a7e63d5ad4e5a23a791
Added option to avoid retrying to connect if socket is already in use.
In some situations it turns out to be more convenient to have VIFF
throw an exception rather than keep retrying to connect to a socket
with exponentially increasing delays. This is now possible using the
new command line parameter --no-socket-retry.
diff -r efa1983063d6 -r 2324d01c74e2 viff/runtime.py
--- a/viff/runtime.py Thu Jan 14 11:36:13 2010 +0100
+++ b/viff/runtime.py Wed Jan 20 08:54:41 2010 +0100
@@ -525,6 +525,9 @@
help="Collect and print profiling information.")
group.add_option("--track-memory", action="store_true",
help="Track memory usage over time.")
+ group.add_option("--no-socket-retry", action="store_true",
+ default=False, help="Fail rather than keep retrying "
+ "to connect if port is already in use.")
try:
# Using __import__ since we do not use the module, we are
@@ -1068,6 +1071,8 @@
try:
runtime.port = listen(port)
except CannotListenError, e:
+ if options and options.no_socket_retry:
+ raise
delay *= 1 + rand.random()
print "Error listening on port %d: %s" % (port, e.socketError[1])
print "Will try again in %d seconds" % delay
_______________________________________________
viff-patches mailing list
[email protected]
http://lists.viff.dk/listinfo.cgi/viff-patches-viff.dk