Skip to content

Commit

Permalink
Check if server supports OOB check at connect (#419).
Browse files Browse the repository at this point in the history
  • Loading branch information
anthony-tuininga committed Dec 6, 2024
1 parent cb110f9 commit 6f7fd0b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
6 changes: 6 additions & 0 deletions doc/src/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ Thin Mode Changes
:data:`oracledb.DB_TYPE_LONG` or :data:`oracledb.DB_TYPE_LONG_RAW` to
to a different compatible type
(`issue 424 <https://github.com/oracle/python-oracledb/issues/424>`__).
#) If the database states that an out-of-band break check should not take
place during connect (by setting the `DISABLE_OOB_AUTO
<https://www.oracle.com/pls/topic/lookup?ctx=dblatest&
id=GUID-490A0B3B-FEF3-425A-81B0-6FA29D4B8C0E>`__ parameter to TRUE),
python-oracledb no longer attempts to do so
(`issue 419 <https://github.com/oracle/python-oracledb/issues/419>`__).
#) All exceptions subclassed from ``OSError`` now cause connection retry
attempts, subject to the connection ``retry_count`` and ``retry_delay``
parameters
Expand Down
3 changes: 3 additions & 0 deletions src/oracledb/impl/thin/capabilities.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ cdef class Capabilities:
uint32_t max_string_size
bint supports_fast_auth
bint supports_oob
bint supports_oob_check
bint supports_end_of_response
bint supports_pipelining
uint32_t sdu
Expand All @@ -60,6 +61,8 @@ cdef class Capabilities:
self.supports_oob = protocol_options & TNS_GSO_CAN_RECV_ATTENTION
if flags & TNS_ACCEPT_FLAG_FAST_AUTH:
self.supports_fast_auth = True
if flags & TNS_ACCEPT_FLAG_CHECK_OOB:
self.supports_oob_check = True
if protocol_version >= TNS_VERSION_MIN_END_OF_RESPONSE:
if flags & TNS_ACCEPT_FLAG_HAS_END_OF_RESPONSE:
self.compile_caps[TNS_CCAP_TTC4] |= TNS_CCAP_END_OF_RESPONSE
Expand Down
1 change: 1 addition & 0 deletions src/oracledb/impl/thin/constants.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,7 @@ cdef enum:

# accept flags
cdef enum:
TNS_ACCEPT_FLAG_CHECK_OOB = 0x00000001
TNS_ACCEPT_FLAG_FAST_AUTH = 0x10000000
TNS_ACCEPT_FLAG_HAS_END_OF_RESPONSE = 0x02000000

Expand Down
3 changes: 1 addition & 2 deletions src/oracledb/impl/thin/protocol.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,7 @@ cdef class Protocol(BaseProtocol):

# if we can use OOB, send an urgent message now followed by a reset
# marker to see if the server understands it
if self._caps.supports_oob \
and self._caps.protocol_version >= TNS_VERSION_MIN_OOB_CHECK:
if self._caps.supports_oob and self._caps.supports_oob_check:
self._transport.send_oob_break()
self._send_marker(self._write_buf, TNS_MARKER_TYPE_RESET)

Expand Down

0 comments on commit 6f7fd0b

Please sign in to comment.