summaryrefslogtreecommitdiff
path: root/sql/net_serv.cc
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2013-01-31 09:48:19 +0100
committerSergei Golubchik <sergii@pisem.net>2013-01-31 09:48:19 +0100
commitab83952f293ea46c00e421c81b81a394c9cae2b4 (patch)
tree6a3e995bd1330828a0e988d896bca218863fc74c /sql/net_serv.cc
parent055b62f404ee0a0463ee8ff98a0e24c083b95f1d (diff)
parent5267af5e9e5e601d4f4b1ef40730da1e36d38d9d (diff)
downloadmariadb-git-ab83952f293ea46c00e421c81b81a394c9cae2b4.tar.gz
10.0-base merge
Diffstat (limited to 'sql/net_serv.cc')
-rw-r--r--sql/net_serv.cc15
1 files changed, 11 insertions, 4 deletions
diff --git a/sql/net_serv.cc b/sql/net_serv.cc
index 7e9425f51f2..b6890ab9fda 100644
--- a/sql/net_serv.cc
+++ b/sql/net_serv.cc
@@ -124,14 +124,15 @@ static my_bool net_write_buff(NET *, const uchar *, ulong);
/** Init with packet info. */
-my_bool my_net_init(NET *net, Vio* vio)
+my_bool my_net_init(NET *net, Vio* vio, uint my_flags)
{
DBUG_ENTER("my_net_init");
+ DBUG_PRINT("enter", ("my_flags: %u", my_flags));
net->vio = vio;
my_net_local_init(net); /* Set some limits */
if (!(net->buff=(uchar*) my_malloc((size_t) net->max_packet+
NET_HEADER_SIZE + COMP_HEADER_SIZE +1,
- MYF(MY_WME))))
+ MYF(MY_WME | my_flags))))
DBUG_RETURN(1);
net->buff_end=net->buff+net->max_packet;
net->error=0; net->return_status=0;
@@ -143,6 +144,7 @@ my_bool my_net_init(NET *net, Vio* vio)
net->net_skip_rest_factor= 0;
net->last_errno=0;
net->unused= 0;
+ net->thread_specific_malloc= test(my_flags & MY_THREAD_SPECIFIC);
#ifdef MYSQL_SERVER
net->extension= NULL;
#endif
@@ -201,7 +203,9 @@ my_bool net_realloc(NET *net, size_t length)
*/
if (!(buff= (uchar*) my_realloc((char*) net->buff, pkt_length +
NET_HEADER_SIZE + COMP_HEADER_SIZE + 1,
- MYF(MY_WME))))
+ MYF(MY_WME |
+ (net->thread_specific_malloc ?
+ MY_THREAD_SPECIFIC : 0)))))
{
/* @todo: 1 and 2 codes are identical. */
net->error= 1;
@@ -613,7 +617,10 @@ net_real_write(NET *net,const uchar *packet, size_t len)
uchar *b;
uint header_length=NET_HEADER_SIZE+COMP_HEADER_SIZE;
if (!(b= (uchar*) my_malloc(len + NET_HEADER_SIZE +
- COMP_HEADER_SIZE + 1, MYF(MY_WME))))
+ COMP_HEADER_SIZE + 1,
+ MYF(MY_WME |
+ (net->thread_specific_malloc ?
+ MY_THREAD_SPECIFIC : 0)))))
{
net->error= 2;
net->last_errno= ER_OUT_OF_RESOURCES;