diff options
author | Zandra Hird <[email protected]> | 2015-08-13 13:00:04 +0200 |
---|---|---|
committer | Zandra Hird <[email protected]> | 2015-08-13 13:00:04 +0200 |
commit | c972a98fe58569d661e9bfad5512bcdb498f6200 (patch) | |
tree | 35e91e20e6bc93756e255dbe07f5bc6c720a2b04 /lib/odbc/src/odbc.erl | |
parent | 998663642c63d753d2c9284f5fda9447b59930d9 (diff) | |
parent | 40a02d4e75e088b31df8e25973bd741ae0c39797 (diff) | |
download | otp-c972a98fe58569d661e9bfad5512bcdb498f6200.tar.gz otp-c972a98fe58569d661e9bfad5512bcdb498f6200.tar.bz2 otp-c972a98fe58569d661e9bfad5512bcdb498f6200.zip |
Merge branch 'sstrigler/fix-port-timeout' into maint
OTP-12935
* sstrigler/fix-port-timeout:
add test for odbc port_timeout
add doc for odbc port_timeout
introduce odbc port_timeout
Diffstat (limited to 'lib/odbc/src/odbc.erl')
-rw-r--r-- | lib/odbc/src/odbc.erl | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/odbc/src/odbc.erl b/lib/odbc/src/odbc.erl index 4901821e9c..12560bfb6e 100644 --- a/lib/odbc/src/odbc.erl +++ b/lib/odbc/src/odbc.erl @@ -26,6 +26,8 @@ -include("odbc_internal.hrl"). +-define(ODBC_PORT_TIMEOUT, 5000). + %% API -------------------------------------------------------------------- -export([start/0, start/1, stop/0, @@ -523,10 +525,10 @@ handle_msg({connect, ODBCCmd, AutoCommitMode, SrollableCursors}, NewState = State#state{auto_commit_mode = AutoCommitMode, scrollable_cursors = SrollableCursors}, - case gen_tcp:accept(ListenSocketSup, 5000) of + case gen_tcp:accept(ListenSocketSup, port_timeout()) of {ok, SupSocket} -> gen_tcp:close(ListenSocketSup), - case gen_tcp:accept(ListenSocketOdbc, 5000) of + case gen_tcp:accept(ListenSocketOdbc, port_timeout()) of {ok, OdbcSocket} -> gen_tcp:close(ListenSocketOdbc), odbc_send(OdbcSocket, ODBCCmd), @@ -983,3 +985,6 @@ string_terminate_value(Binary) when is_binary(Binary) -> <<Binary/binary,0:16>>; string_terminate_value(null) -> null. + +port_timeout() -> + application:get_env(?MODULE, port_timeout, ?ODBC_PORT_TIMEOUT). |