@@ -132,7 +132,7 @@ class Proxy:
132
132
133
133
def __init__ (self , input_args : Optional [List [str ]], ** opts : Any ) -> None :
134
134
self .flags = Proxy .initialize (input_args , ** opts )
135
- self .acceptors : Optional [AcceptorPool ] = None
135
+ self .pool : Optional [AcceptorPool ] = None
136
136
# TODO(abhinavsingh): Allow users to override the worker class itself
137
137
# e.g. A clear text protocol. Or imagine a TelnetProtocolHandler instead
138
138
# of default HttpProtocolHandler.
@@ -150,11 +150,11 @@ def delete_pid_file(self) -> None:
150
150
os .remove (self .flags .pid_file )
151
151
152
152
def __enter__ (self ) -> 'Proxy' :
153
- self .acceptors = AcceptorPool (
153
+ self .pool = AcceptorPool (
154
154
flags = self .flags ,
155
155
work_klass = self .work_klass
156
156
)
157
- self .acceptors .setup ()
157
+ self .pool .setup ()
158
158
self .write_pid_file ()
159
159
return self
160
160
@@ -163,8 +163,8 @@ def __exit__(
163
163
exc_type : Optional [Type [BaseException ]],
164
164
exc_val : Optional [BaseException ],
165
165
exc_tb : Optional [TracebackType ]) -> None :
166
- assert self .acceptors
167
- self .acceptors .shutdown ()
166
+ assert self .pool
167
+ self .pool .shutdown ()
168
168
self .delete_pid_file ()
169
169
170
170
@staticmethod
@@ -449,7 +449,10 @@ def main(
449
449
input_args : Optional [List [str ]] = None ,
450
450
** opts : Any ) -> None :
451
451
try :
452
- with Proxy (input_args = input_args , ** opts ):
452
+ with Proxy (input_args = input_args , ** opts ) as proxy :
453
+ assert proxy .pool is not None
454
+ logger .info ('Listening on %s:%d' %
455
+ (proxy .pool .flags .hostname , proxy .pool .flags .port ))
453
456
# TODO: Introduce cron feature
454
457
# https://github.com/abhinavsingh/proxy.py/issues/392
455
458
while True :
0 commit comments