~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/mysql_protocol/net_serv.cc

mergeĀ lp:~linuxjedi/drizzle/trunk-remove-drizzleadmin

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
19
 */
20
20
 
21
 
#include "config.h"
 
21
#include <config.h>
 
22
 
 
23
#include <drizzled/current_session.h>
 
24
#include <drizzled/error.h>
22
25
#include <drizzled/session.h>
23
 
#include <drizzled/error.h>
 
26
#include <drizzled/statistics_variables.h>
 
27
#include <drizzled/system_variables.h>
24
28
 
25
29
#include <assert.h>
26
30
#include <stdio.h>
95
99
{
96
100
  Vio *vio_tmp= new Vio(sock);
97
101
  if (vio_tmp == NULL)
 
102
  {
98
103
    return true;
 
104
  }
99
105
  else
100
106
    if (drizzleclient_net_init(net, vio_tmp, buffer_length))
101
107
    {
103
109
       * NET object.
104
110
       */
105
111
      if (vio_tmp && (net->vio != vio_tmp))
 
112
      {
106
113
        delete vio_tmp;
 
114
      }
107
115
      else
108
116
      {
109
117
        (void) shutdown(sock, SHUT_RDWR);
124
132
 
125
133
void drizzleclient_net_close(NET *net)
126
134
{
127
 
  if (net->vio != NULL)
128
 
  {
129
 
    delete net->vio;
130
 
    net->vio= 0;
131
 
  }
 
135
  drizzled::safe_delete(net->vio);
132
136
}
133
137
 
134
138
bool drizzleclient_net_peer_addr(NET *net, char *buf, uint16_t *port, size_t buflen)
726
730
{
727
731
  size_t len, complen;
728
732
 
729
 
  if (!net->compress)
 
733
  if (not net->compress)
730
734
  {
731
735
    len = my_real_read(net,&complen);
732
736
    if (len == MAX_PACKET_LENGTH)
734
738
      /* First packet of a multi-packet.  Concatenate the packets */
735
739
      uint32_t save_pos = net->where_b;
736
740
      size_t total_length= 0;
 
741
 
737
742
      do
738
743
      {
739
744
        net->where_b += len;
740
745
        total_length += len;
741
746
        len = my_real_read(net,&complen);
742
747
      } while (len == MAX_PACKET_LENGTH);
 
748
 
743
749
      if (len != packet_error)
 
750
      {
744
751
        len+= total_length;
 
752
      }
745
753
      net->where_b = save_pos;
746
754
    }
747
755
    net->read_pos = net->buff + net->where_b;
 
756
 
748
757
    if (len != packet_error)
749
758
      net->read_pos[len]=0;        /* Safeguard for drizzleclient_use_result */
 
759
 
750
760
    return len;
751
761
  }
752
762
  else
855
865
        }
856
866
      }
857
867
      else
 
868
      {
858
869
        complen= packet_len;
 
870
      }
859
871
 
860
872
    }
861
873
    buf_length+= complen;
869
881
    net->read_pos[len]=0;        /* Safeguard for drizzleclient_use_result */
870
882
  }
871
883
  return len;
872
 
  }
 
884
}
873
885
 
874
886
 
875
887
void drizzleclient_net_set_read_timeout(NET *net, uint32_t timeout)