Close the socket underlying this connection.
(self)
| 1205 | linger = False |
| 1206 | |
| 1207 | def close(self): |
| 1208 | """Close the socket underlying this connection.""" |
| 1209 | self.rfile.close() |
| 1210 | |
| 1211 | if not self.linger: |
| 1212 | # Python's socket module does NOT call close on the kernel socket |
| 1213 | # when you call socket.close(). We do so manually here because we |
| 1214 | # want this server to send a FIN TCP segment immediately. Note this |
| 1215 | # must be called *before* calling socket.close(), because the latter |
| 1216 | # drops its reference to the kernel socket. |
| 1217 | self.socket._sock.close() |
| 1218 | self.socket.close() |
| 1219 | else: |
| 1220 | # On the other hand, sometimes we want to hang around for a bit |
| 1221 | # to make sure the client has a chance to read our entire |
| 1222 | # response. Skipping the close() calls here delays the FIN |
| 1223 | # packet until the socket object is garbage-collected later. |
| 1224 | # Someday, perhaps, we'll do the full lingering_close that |
| 1225 | # Apache does, but not today. |
| 1226 | pass |
| 1227 | |
| 1228 | |
| 1229 | def format_exc(limit=None): |