-
Notifications
You must be signed in to change notification settings - Fork 175
ODBC Mars issues #690
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
ODBC Mars issues #690
Changes from 3 commits
e782a89
675c58e
138584b
3ba42b5
c309dfc
148c56b
533f6b4
149edc9
8f8e509
a18a448
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -872,7 +872,13 @@ odbc_lock_statement(TDS_STMT* stmt) | |
|
|
||
| /* try with MARS */ | ||
| if (!tds) | ||
| { | ||
| tds = tds_alloc_additional_socket(dbc_tds->conn); | ||
| if (tds) | ||
| { | ||
| tdsdump_log(TDS_DBG_INFO1, "MARS SID %d allocated new TDSSOCKET\n", tds->sid); | ||
| } | ||
| } | ||
| } | ||
| if (tds) { | ||
| tds->query_timeout = (stmt->attr.query_timeout != DEFAULT_QUERY_TIMEOUT) ? | ||
|
|
@@ -922,15 +928,8 @@ odbc_unlock_statement(TDS_STMT* stmt) | |
| tds_set_parent(tds, stmt->dbc); | ||
| stmt->tds = NULL; | ||
| } | ||
| #if ENABLE_ODBC_MARS | ||
| } else if (tds) { | ||
| if (tds->state == TDS_IDLE || tds->state == TDS_DEAD) { | ||
| assert(tds != stmt->dbc->tds_socket); | ||
| tds_free_socket(tds); | ||
| stmt->tds = NULL; | ||
| } | ||
| #endif | ||
| } | ||
| /* NOTE: MARS socket now released when statement freed. */ | ||
| tds_mutex_unlock(&stmt->dbc->mtx); | ||
| } | ||
|
|
||
|
|
@@ -4464,6 +4463,17 @@ odbc_SQLFreeStmt(SQLHSTMT hstmt, SQLUSMALLINT fOption, int force) | |
| tds_free_param_results(stmt->params); | ||
| odbc_errs_reset(&stmt->errs); | ||
| odbc_unlock_statement(stmt); | ||
| #if ENABLE_ODBC_MARS | ||
| if ( stmt->tds && stmt->tds != stmt->dbc->tds_socket ) | ||
| { | ||
| tds_free_socket(tds); | ||
| stmt->tds = NULL; | ||
| tdsdump_log(TDS_DBG_INFO1, "MARS SID %d socket freed\n", tds->sid); | ||
| if (!(tds->state == TDS_IDLE || tds->state == TDS_DEAD)) { | ||
| tdsdump_log(TDS_DBG_WARN, "MARS SID %d was not idle/dead\n", tds->sid); | ||
| } | ||
|
||
| } | ||
| #endif | ||
| tds_dstr_free(&stmt->cursor_name); | ||
| tds_dstr_free(&stmt->attr.qn_msgtext); | ||
| tds_dstr_free(&stmt->attr.qn_options); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -521,6 +521,7 @@ int | |
| tds_read_packet(TDSSOCKET * tds) | ||
| { | ||
| #if ENABLE_ODBC_MARS | ||
| TDS_UINT this_seq; | ||
| TDSCONNECTION *conn = tds->conn; | ||
|
|
||
| tds_mutex_lock(&conn->list_mtx); | ||
|
|
@@ -554,13 +555,21 @@ tds_read_packet(TDSSOCKET * tds) | |
| tds->in_pos = 8; | ||
| tds->in_flag = tds->in_buf[0]; | ||
|
|
||
| /* send acknowledge if needed */ | ||
| if ((int32_t) (tds->recv_seq + 2 - tds->recv_wnd) >= 0) | ||
| tds_update_recv_wnd(tds, tds->recv_seq + 4); | ||
| /* Look ahead by up to 4 packets */ | ||
| memcpy(&this_seq, ((char const *)packet->buf) + offsetof(TDS72_SMP_HEADER, seq), sizeof this_seq); | ||
|
||
| if (this_seq + 2 >= tds->recv_wnd) | ||
|
||
| tds_update_recv_wnd(tds, this_seq + 4); | ||
|
|
||
| return tds->in_len; | ||
| } | ||
|
|
||
| #if ENABLE_EXTRA_CHECKS | ||
| { | ||
| TDS_UINT np = 0; | ||
| for (p_packet = &conn->packets; *p_packet; p_packet = &(*p_packet)->next) ++np; | ||
| tdsdump_log(TDS_DBG_NETWORK, "MARS SID %d queued packets %u\n", tds->sid, np); | ||
| } | ||
| #endif | ||
| /* network ok ? process network */ | ||
| if (!conn->in_net_tds) { | ||
| tds_connection_network(conn, tds, 0); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe
MARS SID %d allocated for new TDSSOCKET\n?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well, both of them are allocated really (the SID and the TDSSOCKET); how about
withinstead offorThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It sounds good to me