summaryrefslogtreecommitdiff
path: root/sql/net_serv.cc
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@mariadb.com>2016-04-09 17:03:48 +0200
committerVladislav Vaintroub <wlad@mariadb.com>2016-04-09 17:03:48 +0200
commitcd776fedba3e2902bc25ee206d6e6266e7eb9411 (patch)
tree95bf82d0e0522c6af708cd28639c82e004b5a264 /sql/net_serv.cc
parentf884d233e6a5f68bab846a7bdbd041fc4415ad77 (diff)
parentd516a2ae0cbd09d3b5b1667ec62b421330ab9902 (diff)
downloadmariadb-git-10.2-connector-c-integ.tar.gz
Merge branch '10.2' into 10.2-connector-c-integ10.2-connector-c-integ
Diffstat (limited to 'sql/net_serv.cc')
-rw-r--r--sql/net_serv.cc22
1 files changed, 17 insertions, 5 deletions
diff --git a/sql/net_serv.cc b/sql/net_serv.cc
index d81c89fe534..f0284462206 100644
--- a/sql/net_serv.cc
+++ b/sql/net_serv.cc
@@ -121,6 +121,8 @@ extern my_bool thd_net_is_killed();
static my_bool net_write_buff(NET *, const uchar *, ulong);
+my_bool net_allocate_new_packet(NET *net, void *thd, uint my_flags);
+
/** Init with packet info. */
my_bool my_net_init(NET *net, Vio *vio, void *thd, uint my_flags)
@@ -129,14 +131,12 @@ my_bool my_net_init(NET *net, Vio *vio, void *thd, uint my_flags)
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 | my_flags))))
+
+ if (net_allocate_new_packet(net, thd, my_flags))
DBUG_RETURN(1);
- net->buff_end=net->buff+net->max_packet;
+
net->error=0; net->return_status=0;
net->pkt_nr=net->compress_pkt_nr=0;
- net->write_pos=net->read_pos = net->buff;
net->last_error[0]=0;
net->compress=0; net->reading_or_writing=0;
net->where_b = net->remain_in_buf=0;
@@ -165,6 +165,18 @@ my_bool my_net_init(NET *net, Vio *vio, void *thd, uint my_flags)
DBUG_RETURN(0);
}
+my_bool net_allocate_new_packet(NET *net, void *thd, uint my_flags)
+{
+ DBUG_ENTER("net_allocate_new_packet");
+ if (!(net->buff=(uchar*) my_malloc((size_t) net->max_packet+
+ NET_HEADER_SIZE + COMP_HEADER_SIZE +1,
+ MYF(MY_WME | my_flags))))
+ DBUG_RETURN(1);
+ net->buff_end=net->buff+net->max_packet;
+ net->write_pos=net->read_pos = net->buff;
+ DBUG_RETURN(0);
+}
+
void net_end(NET *net)
{