mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-02 17:29:22 +01:00
Added check for successful PyOpenSSL import in Twisted driver and increased log level
This commit is contained in:
parent
32e0b29fcd
commit
eb970c09d7
@ -44,7 +44,8 @@ from twisted.internet.protocol import ReconnectingClientFactory
|
|||||||
try:
|
try:
|
||||||
from OpenSSL import SSL
|
from OpenSSL import SSL
|
||||||
except ImportError:
|
except ImportError:
|
||||||
drivers.log.debug('PyOpenSSL is not available, can not connect to SSL servers.')
|
drivers.log.warning('PyOpenSSL is not available, can not connect to SSL servers.')
|
||||||
|
SSL = None
|
||||||
|
|
||||||
class TwistedRunnerDriver(drivers.IrcDriver):
|
class TwistedRunnerDriver(drivers.IrcDriver):
|
||||||
def name(self):
|
def name(self):
|
||||||
@ -125,9 +126,12 @@ class SupyReconnectingFactory(ReconnectingClientFactory, drivers.ServersMixin):
|
|||||||
|
|
||||||
def connectSSL(self, server, port, vhost):
|
def connectSSL(self, server, port, vhost):
|
||||||
"""Connect to the server using an SSL socket."""
|
"""Connect to the server using an SSL socket."""
|
||||||
drivers.log.debug('Attempting an SSL connection.')
|
drivers.log.info('Attempting an SSL connection.')
|
||||||
|
if SSL:
|
||||||
reactor.connectSSL(server, port, self,
|
reactor.connectSSL(server, port, self,
|
||||||
ssl.ClientContextFactory(), bindAddress=(vhost, 0))
|
ssl.ClientContextFactory(), bindAddress=(vhost, 0))
|
||||||
|
else:
|
||||||
|
drivers.log.error('PyOpenSSL is not available. Not connecting.')
|
||||||
|
|
||||||
def clientConnectionFailed(self, connector, r):
|
def clientConnectionFailed(self, connector, r):
|
||||||
drivers.log.connectError(self.currentServer, errorMsg(r))
|
drivers.log.connectError(self.currentServer, errorMsg(r))
|
||||||
|
Loading…
Reference in New Issue
Block a user