@@ -114,6 +114,7 @@ def shutdown_threadless_process(self) -> None:
114
114
self .threadless_client_queue .close ()
115
115
116
116
def _start_threadless_work (self , conn : socket .socket , addr : Tuple [str , int ]) -> None :
117
+ assert self .threadless_process and self .threadless_client_queue
117
118
self .threadless_client_queue .send (addr )
118
119
send_handle (
119
120
self .threadless_client_queue ,
@@ -137,11 +138,6 @@ def _start_threaded_work(self, conn: socket.socket, addr: Tuple[str, int]) -> No
137
138
)
138
139
work_thread .start ()
139
140
140
- def _can_execute_threadless (self ) -> bool :
141
- return self .flags .threadless and \
142
- self .threadless_client_queue and \
143
- self .threadless_process
144
-
145
141
def run_once (self ) -> None :
146
142
with self .lock :
147
143
assert self .selector and self .sock
@@ -150,7 +146,12 @@ def run_once(self) -> None:
150
146
return
151
147
conn , addr = self .sock .accept ()
152
148
self ._start_threadless_work (conn , addr ) \
153
- if self ._can_execute_threadless () else self ._start_threaded_work (conn , addr )
149
+ if (
150
+ self .flags .threadless and
151
+ self .threadless_client_queue and
152
+ self .threadless_process
153
+ ) \
154
+ else self ._start_threaded_work (conn , addr )
154
155
155
156
def run (self ) -> None :
156
157
setup_logger (
0 commit comments