- if writer is not None:
- writer.close()
- self.connection.closed += 1
- # Open connection:
- (r, w) = await asyncio.open_connection(self.hostname,
- self.port,
- ssl=self.ssl)
- self.connection.opened += 1
- # Read banner:
- size_bytes = await r.readexactly(4)
- size_int = struct.unpack('<i', size_bytes)[0]
- message = await r.readexactly(size_int)
- # Set reader and writer in data:
- self.connection.reader = r
- self.connection.writer = w
- raise Exception("Reader or writer missing. Reopened.\n"
- "Currently open contexts:"
- f" {self.connection.contexts}\n"
- "Connections opened since start: "
- f" {self.connection.opened}\n"
- "Connections closed since start: "
+ raise Exception("Reader or writer missing.\n"
+ "Open contexts:"
+ f" {self.connection.contexts}"
+ " Connections opened since start: "
+ f" {self.connection.opened}"
+ " Connections closed since start: "