~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to libdrizzle/net_serv.c

  • Committer: Brian Aker
  • Date: 2008-08-10 17:18:41 UTC
  • mfrom: (287.3.13 codestyle)
  • Revision ID: brian@tangent.org-20080810171841-pkvi2ky94wbd0nt5
Merge from Monty

Show diffs side-by-side

added added

removed removed

Lines of Context:
136
136
    -1   Don't know if data is ready or not
137
137
*/
138
138
 
139
 
static int net_data_is_ready(int sd)
 
139
static bool net_data_is_ready(int sd)
140
140
{
141
141
  struct pollfd ufds;
142
142
  int res;
170
170
 
171
171
void net_clear(NET *net, bool clear_buffer)
172
172
{
173
 
  size_t count;
174
 
  int32_t ready;
175
 
 
176
173
  if (clear_buffer)
177
174
  {
178
 
    while ((ready= net_data_is_ready(net->vio->sd)) > 0)
 
175
    while (net_data_is_ready(net->vio->sd) > 0)
179
176
    {
180
177
      /* The socket is ready */
181
 
      if ((long) (count= vio_read(net->vio, net->buff,
182
 
                                  (size_t) net->max_packet)) <= 0)
 
178
      if (vio_read(net->vio, net->buff,
 
179
                                  (size_t) net->max_packet) <= 0)
183
180
      {
184
181
        net->error= 2;
185
182
        break;
423
420
  {
424
421
    size_t complen;
425
422
    uchar *b;
426
 
    uint header_length=NET_HEADER_SIZE+COMP_HEADER_SIZE;
 
423
    const uint header_length=NET_HEADER_SIZE+COMP_HEADER_SIZE;
427
424
    if (!(b= (uchar*) my_malloc(len + NET_HEADER_SIZE +
428
425
                                COMP_HEADER_SIZE, MYF(MY_WME))))
429
426
    {
473
470
  {
474
471
    if ((long) (length= vio_write(net->vio,pos,(size_t) (end-pos))) <= 0)
475
472
    {
476
 
      bool interrupted= vio_should_retry(net->vio);
 
473
      const bool interrupted= vio_should_retry(net->vio);
477
474
      /* 
478
475
        If we read 0, or we were interrupted this means that 
479
476
        we need to switch to blocking mode and wait until the timeout 
585
582
      /* First read is done with non blocking mode */
586
583
      if ((long) (length= vio_read(net->vio, pos, remain)) <= 0L)
587
584
      {
588
 
        bool interrupted = vio_should_retry(net->vio);
 
585
        const bool interrupted = vio_should_retry(net->vio);
589
586
 
590
587
        if (interrupted)
591
588
        {                                       /* Probably in MIT threads */