diff --git a/pymysqlreplication/binlogstream.py b/pymysqlreplication/binlogstream.py index 76e491da..ff2f80c5 100644 --- a/pymysqlreplication/binlogstream.py +++ b/pymysqlreplication/binlogstream.py @@ -11,7 +11,7 @@ class BinLogStreamReader(object): '''Connect to replication stream and read event''' - def __init__(self, connection_settings = {}, resume_stream = False, blocking = False, only_events = None, server_id = 255): + def __init__(self, connection_settings={}, resume_stream=False, blocking=False, only_events=None, server_id=255): ''' resume_stream: Start for latest event of binlog or from older available event blocking: Read on stream is blocking @@ -45,6 +45,7 @@ def __connect_to_ctl(self): self._ctl_connection_settings['db'] = 'information_schema' self._ctl_connection_settings['cursorclass'] = pymysql.cursors.DictCursor self._ctl_connection = pymysql.connect(**self._ctl_connection_settings) + self.__connected_ctl = True def __connect_to_stream(self): self._stream_connection = pymysql.connect(**self.__connection_settings) @@ -61,7 +62,7 @@ def __connect_to_stream(self): # binlog-filename (string.EOF) -- filename of the binlog on the master command = COM_BINLOG_DUMP prelude = struct.pack('