diff options
author | unknown <monty@mashka.mysql.fi> | 2003-01-02 14:29:26 +0200 |
---|---|---|
committer | unknown <monty@mashka.mysql.fi> | 2003-01-02 14:29:26 +0200 |
commit | 0b34c533729ef20d73a3a9954933e8a867ac7923 (patch) | |
tree | 5898794c3b8cb0afbde2326fd413892eb8347a65 /sql/net_serv.cc | |
parent | f1696d4f5f001d59204f19b2ef3fa921c9336a0f (diff) | |
download | mariadb-git-0b34c533729ef20d73a3a9954933e8a867ac7923.tar.gz |
Small optimization of sending big blocks.
Updated Italian error messages
sql/net_serv.cc:
Small optimization of sending big blocks.
Some small formating changes
sql/share/italian/errmsg.txt:
Updated error messages (by Cristian Giussani)
Diffstat (limited to 'sql/net_serv.cc')
-rw-r--r-- | sql/net_serv.cc | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/sql/net_serv.cc b/sql/net_serv.cc index ac73a4ca15a..0d4cf9b9444 100644 --- a/sql/net_serv.cc +++ b/sql/net_serv.cc @@ -285,6 +285,7 @@ net_write_command(NET *net,uchar command,const char *packet,ulong len) /* Caching the data in a local buffer before sending it. One can force the buffer to be flushed with 'net_flush'. + */ static int @@ -292,15 +293,24 @@ net_write_buff(NET *net,const char *packet,ulong len) { ulong left_length=(ulong) (net->buff_end - net->write_pos); - while (len > left_length) + if (len > left_length) { memcpy((char*) net->write_pos,packet,left_length); if (net_real_write(net,(char*) net->buff,net->max_packet)) return 1; net->write_pos=net->buff; packet+=left_length; - len-=left_length; - left_length=net->max_packet; + len-= left_length; + left_length= net->max_packet; + + /* Send out rest of the blocks as full sized blocks */ + while (len > left_length) + { + if (net_real_write(net, packet, left_length)) + return 1; + packet+= left_length; + len-= left_length; + } } memcpy((char*) net->write_pos,packet,len); net->write_pos+=len; @@ -633,7 +643,10 @@ my_real_read(NET *net, ulong *complen) #ifdef HAVE_COMPRESS if (net->compress) { - /* complen is > 0 if package is really compressed */ + /* + If the packet is compressed then complen > 0 and contains the + number of bytes in the uncompressed packet + */ *complen=uint3korr(&(net->buff[net->where_b + NET_HEADER_SIZE])); } #endif @@ -704,7 +717,7 @@ my_net_read(NET *net) { net->where_b += len; total_length += len; - len = my_real_read (net,&complen); + len = my_real_read(net,&complen); } while (len == MAX_THREE_BYTES); if (len != packet_error) len+= total_length; @@ -732,7 +745,7 @@ my_net_read(NET *net) } else { - /* reuse buffer, as there is noting in it that we need */ + /* reuse buffer, as there is nothing in it that we need */ buf_length=start_of_packet=first_packet_offset=0; } for (;;) |