@@ -2543,7 +2543,7 @@ static int newsql_connect(cdb2_hndl_tp *hndl, int node_indx)
2543
2543
return rc ;
2544
2544
}
2545
2545
2546
- static void newsql_disconnect (cdb2_hndl_tp * hndl , SBUF2 * sb , int line )
2546
+ static void newsql_disconnect_int (cdb2_hndl_tp * hndl , SBUF2 * sb , int line , int dontdonate )
2547
2547
{
2548
2548
if (sb == NULL )
2549
2549
return ;
@@ -2553,13 +2553,10 @@ static void newsql_disconnect(cdb2_hndl_tp *hndl, SBUF2 *sb, int line)
2553
2553
int fd = sbuf2fileno (sb );
2554
2554
2555
2555
int timeoutms = 10 * 1000 ;
2556
- if (hndl -> is_admin ||
2556
+ if (hndl -> is_admin || dontdonate ||
2557
2557
(hndl -> firstresponse &&
2558
- (!hndl -> lastresponse ||
2559
- (hndl -> lastresponse -> response_type != RESPONSE_TYPE__LAST_ROW ))) ||
2560
- (!hndl -> firstresponse ) ||
2561
- (hndl -> in_trans ) ||
2562
- ((hndl -> flags & CDB2_TYPE_IS_FD ) != 0 )) {
2558
+ (!hndl -> lastresponse || (hndl -> lastresponse -> response_type != RESPONSE_TYPE__LAST_ROW ))) ||
2559
+ (!hndl -> firstresponse ) || (hndl -> in_trans ) || ((hndl -> flags & CDB2_TYPE_IS_FD ) != 0 )) {
2563
2560
sbuf2close (sb );
2564
2561
} else if (sbuf2free (sb ) == 0 ) {
2565
2562
cdb2_socket_pool_donate_ext (hndl -> newsql_typestr , fd , timeoutms / 1000 ,
@@ -2570,9 +2567,13 @@ static void newsql_disconnect(cdb2_hndl_tp *hndl, SBUF2 *sb, int line)
2570
2567
return ;
2571
2568
}
2572
2569
2570
+ static void newsql_disconnect (cdb2_hndl_tp * hndl , SBUF2 * sb , int line )
2571
+ {
2572
+ return newsql_disconnect_int (hndl , sb , line , 0 );
2573
+ }
2574
+
2573
2575
/* returns port number, or -1 for error*/
2574
- static int cdb2portmux_get (cdb2_hndl_tp * hndl , const char * type ,
2575
- const char * remote_host , const char * app ,
2576
+ static int cdb2portmux_get (cdb2_hndl_tp * hndl , const char * type , const char * remote_host , const char * app ,
2576
2577
const char * service , const char * instance )
2577
2578
{
2578
2579
char name [128 ]; /* app/service/dbname */
@@ -4457,7 +4458,7 @@ static inline void consume_previous_query(cdb2_hndl_tp *hndl)
4457
4458
while (cdb2_next_record_int (hndl , 0 ) == CDB2_OK ) {
4458
4459
hardbound ++ ;
4459
4460
if (hardbound > hndl -> max_auto_consume_rows ) {
4460
- newsql_disconnect (hndl , hndl -> sb , __LINE__ );
4461
+ newsql_disconnect_int (hndl , hndl -> sb , __LINE__ , 1 );
4461
4462
break ;
4462
4463
}
4463
4464
}
0 commit comments