@@ -74,6 +74,9 @@ def __init__(
74
74
observer .start ()
75
75
self .logger = Logger ()
76
76
77
+ # Load the Twisted reactor
78
+ self .reactor = cast ("IReactorCore" , reactor )
79
+
77
80
# Initialise the UID cache
78
81
uid_cache : UidCache
79
82
if redis_host and redis_port :
@@ -90,7 +93,7 @@ def __init__(
90
93
# Initialise the appropriate OAuth client
91
94
try :
92
95
self .logger .debug (
93
- "Creating an OAuthClient for the ' {backend}' backend." ,
96
+ "Creating an OAuthClient for the {backend} backend." ,
94
97
backend = backend .value ,
95
98
)
96
99
oauth_backend = OAuthClientMap [backend ]
@@ -104,7 +107,7 @@ def __init__(
104
107
** {k : v for k , v in kwargs .items () if k in oauth_backend_args },
105
108
)
106
109
except Exception as exc :
107
- msg = f"Could not construct an OAuth client for the ' { backend .value } ' backend.\n { exc !s} "
110
+ msg = f"Could not construct an OAuth client for the { backend .value } backend.\n { exc !s} "
108
111
raise ValueError (msg ) from exc
109
112
110
113
# Initialise the OAuth data adaptor
@@ -136,7 +139,7 @@ def __init__(
136
139
137
140
# Attach a listening endpoint
138
141
self .logger .info ("Listening for LDAP requests on port {port}." , port = port )
139
- endpoint : IStreamServerEndpoint = serverFromString (reactor , f"tcp:{ port } " )
142
+ endpoint : IStreamServerEndpoint = serverFromString (self . reactor , f"tcp:{ port } " )
140
143
endpoint .listen (factory )
141
144
142
145
# Attach a listening endpoint
@@ -152,14 +155,11 @@ def __init__(
152
155
port = tls_port ,
153
156
)
154
157
ssl_endpoint : IStreamServerEndpoint = serverFromString (
155
- reactor ,
158
+ self . reactor ,
156
159
f"ssl:{ tls_port } :privateKey={ quoteStringArgument (tls_private_key )} :certKey={ quoteStringArgument (tls_certificate )} " ,
157
160
)
158
161
ssl_endpoint .listen (factory )
159
162
160
- # Load the Twisted reactor
161
- self .reactor = cast ("IReactorCore" , reactor )
162
-
163
163
def run (self : Self ) -> None :
164
164
"""Start the Twisted reactor."""
165
165
self .reactor .run ()
0 commit comments