print a debug message when the sock plugin cannot bind

This commit is contained in:
Yann Leboulanger 2005-03-01 23:27:21 +00:00
parent 997942778e
commit 4cfea45b01
1 changed files with 7 additions and 1 deletions

View File

@ -19,6 +19,7 @@
import socket, select import socket, select
import pickle import pickle
import Queue import Queue
import sys
from common import i18n from common import i18n
_ = i18n._ _ = i18n._
@ -142,7 +143,12 @@ class plugin:
HOST = socket.gethostbyname(socket.gethostname()) HOST = socket.gethostbyname(socket.gethostname())
if self.config.has_key('host'): if self.config.has_key('host'):
HOST = socket.gethostbyname(self.config['host']) HOST = socket.gethostbyname(self.config['host'])
try:
self.socket.bind((HOST, self.config['port'])) self.socket.bind((HOST, self.config['port']))
except:
print _('plugin sock cannot be launched : ') + \
str(sys.exc_info()[1][0:])
return
self.socket.listen(5) self.socket.listen(5)
self.active_socket = [self.socket] self.active_socket = [self.socket]