diff --git a/pyVoIP/sock/sock.py b/pyVoIP/sock/sock.py index 8a74833..bb2cd4f 100644 --- a/pyVoIP/sock/sock.py +++ b/pyVoIP/sock/sock.py @@ -133,9 +133,7 @@ def _udp_recv(self, nbytes: int, timeout=0, peak=False) -> bytes: conn.close() return row["msg"].encode("utf8") try: - self.sock.buffer.commit() conn.execute('DELETE FROM "msgs" WHERE "id" = ?', (row["id"],)) - self.sock.buffer.commit() except sqlite3.OperationalError: pass conn.close() @@ -184,7 +182,9 @@ def __init__( self.s = self.server_context.wrap_socket(self.s, server_side=True) self.buffer = sqlite3.connect( - pyVoIP.SIP_STATE_DB_LOCATION, check_same_thread=False + pyVoIP.SIP_STATE_DB_LOCATION, + isolation_level=None, + check_same_thread=False, ) """ RFC 3261 Section 12, Paragraph 2 states: @@ -225,10 +225,6 @@ def __init__( PRIMARY KEY("call_id", "local_tag", "remote_tag") );""" ) - try: - self.buffer.commit() - except sqlite3.OperationalError: - pass conn.close() self.conns_lock = threading.Lock() self.conns: List[VoIPConnection] = [] @@ -300,7 +296,6 @@ def __register_connection(self, connection: VoIPConnection) -> int: conn_id, ), ) - self.buffer.commit() except sqlite3.IntegrityError as e: e.add_note( "Error is from registering connection for message: " @@ -348,7 +343,6 @@ def deregister_connection(self, connection: VoIPConnection) -> None: conn.execute( 'DELETE FROM "listening" WHERE "connection" = ?', (conn_id,) ) - self.buffer.commit() except sqlite3.OperationalError: pass finally: @@ -446,10 +440,6 @@ def _handle_incoming_message( + "VALUES (?, ?, ?, ?)", (call_id, local_tag, remote_tag, raw_message), ) - try: - self.buffer.commit() - except sqlite3.OperationalError: - pass conn.close() if conn_id: self.sip.handle_new_connection(self.conns[conn_id])