Skip to content

Commit 3ab90d9

Browse files
Fixed bug when connecting to a database using listener redirects with
asyncio (#285).
1 parent 2baa27f commit 3ab90d9

File tree

2 files changed

+23
-12
lines changed

2 files changed

+23
-12
lines changed

doc/src/release_notes.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ Thin Mode Changes
3232
#) Fixed bug in calculating the :data:`Connection.thin` attribute.
3333
#) Fixed bug in processing metadata that spans multiple packets when using
3434
:ref:`asyncio <asyncio>`.
35+
#) Fixed bug when connecting to a database using listener redirects when using
36+
:ref:`asyncio <asyncio>`
37+
(`issue 285 <https://github.com/oracle/python-oracledb/issues/285>`__).
38+
3539

3640
Thick Mode Changes
3741
++++++++++++++++++

src/oracledb/impl/thin/protocol.pyx

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,20 @@ cdef class BaseProtocol:
8989
self._write_buf._transport = None
9090
transport.disconnect()
9191

92+
cdef int _post_connect(self, BaseThinConnImpl conn_impl,
93+
AuthMessage auth_message) except -1:
94+
""""
95+
Performs activities after the connection has completed. The protocol
96+
must be marked to indicate that the connect is no longer in progress,
97+
which allows the normal break/reset mechanism to fire. The session must
98+
also be marked as not needing to be closed since for listener redirects
99+
the packet may indicate EOF for the initial connection that is
100+
established.
101+
"""
102+
conn_impl.warning = auth_message.warning
103+
self._read_buf._session_needs_to_be_closed = False
104+
self._in_connect = False
105+
92106
cdef int _release_drcp_session(self, BaseThinConnImpl conn_impl,
93107
uint32_t release_mode) except -1:
94108
"""
@@ -297,14 +311,8 @@ cdef class Protocol(BaseProtocol):
297311
if auth_message.resend:
298312
self._process_message(auth_message)
299313

300-
# mark protocol to indicate that connect is no longer in progress; this
301-
# allows the normal break/reset mechanism to fire; also mark the
302-
# session as not needing to be closed since for listener redirects
303-
# the packet may indicate EOF for the initial connection that is
304-
# established
305-
conn_impl.warning = auth_message.warning
306-
self._read_buf._session_needs_to_be_closed = False
307-
self._in_connect = False
314+
# perform post connect activities
315+
self._post_connect(conn_impl, auth_message)
308316

309317
cdef int _connect_tcp(self, ConnectParamsImpl params,
310318
Description description, Address address, str host,
@@ -648,10 +656,9 @@ cdef class BaseAsyncProtocol(BaseProtocol):
648656
if auth_message.resend:
649657
await self._process_message(auth_message)
650658

651-
# mark protocol to indicate that connect is no longer in progress; this
652-
# allows the normal break/reset mechanism to fire
653-
conn_impl.warning = auth_message.warning
654-
self._in_connect = False
659+
# perform post connect activities
660+
self._post_connect(conn_impl, auth_message)
661+
655662

656663
async def _connect_tcp(self, ConnectParamsImpl params,
657664
Description description, Address address, str host,

0 commit comments

Comments
 (0)