@@ -100,7 +100,7 @@ def readexactly(self, n):
100
100
return buf
101
101
102
102
def readline (self ):
103
- if __debug__ :
103
+ if DEBUG and __debug__ :
104
104
log .debug ("StreamReader.readline()" )
105
105
buf = b""
106
106
while True :
@@ -156,7 +156,7 @@ def awrite(self, buf):
156
156
sz -= res
157
157
yield IOWrite (self .s )
158
158
#assert s2.fileno() == self.s.fileno()
159
- if __debug__ :
159
+ if DEBUG and __debug__ :
160
160
log .debug ("StreamWriter.awrite(): can write more" )
161
161
162
162
def aclose (self ):
@@ -182,7 +182,7 @@ def open_connection(host, port):
182
182
except OSError as e :
183
183
if e .args [0 ] != uerrno .EINPROGRESS :
184
184
raise
185
- if __debug__ :
185
+ if DEBUG and __debug__ :
186
186
log .debug ("open_connection: After connect" )
187
187
yield IOWrite (s )
188
188
# if __debug__:
@@ -193,7 +193,8 @@ def open_connection(host, port):
193
193
194
194
195
195
def start_server (client_coro , host , port , backlog = 10 ):
196
- log .debug ("start_server(%s, %s)" , host , port )
196
+ if DEBUG and __debug__ :
197
+ log .debug ("start_server(%s, %s)" , host , port )
197
198
s = _socket .socket ()
198
199
s .setblocking (False )
199
200
@@ -203,10 +204,10 @@ def start_server(client_coro, host, port, backlog=10):
203
204
s .bind (addr )
204
205
s .listen (backlog )
205
206
while True :
206
- if __debug__ :
207
+ if DEBUG and __debug__ :
207
208
log .debug ("start_server: Before accept" )
208
209
yield IORead (s )
209
- if __debug__ :
210
+ if DEBUG and __debug__ :
210
211
log .debug ("start_server: After iowait" )
211
212
s2 , client_addr = s .accept ()
212
213
s2 .setblocking (False )
0 commit comments