~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to libdrizzle/net_serv.c

  • Committer: Brian Aker
  • Date: 2008-12-15 17:17:31 UTC
  • Revision ID: brian@tangent.org-20081215171731-ljw3ti0nzdbo5uq0
Style cleanup, additional assert on net write()

Show diffs side-by-side

added added

removed removed

Lines of Context:
55
55
  net->vio = vio;
56
56
  my_net_local_init(net);            /* Set some limits */
57
57
  if (!(net->buff=(unsigned char*) malloc((size_t) net->max_packet+
58
 
                                  NET_HEADER_SIZE + COMP_HEADER_SIZE)))
 
58
                                          NET_HEADER_SIZE + COMP_HEADER_SIZE)))
59
59
    return(1);
60
60
  net->buff_end=net->buff+net->max_packet;
61
61
  net->error=0; net->return_status=0;
103
103
{
104
104
  if (net->buff != NULL)
105
105
    free(net->buff);
106
 
  net->buff=0;
 
106
  net->buff= NULL;
107
107
  return;
108
108
}
109
109
 
454
454
  in the server, yield to another process and come back later.
455
455
*/
456
456
int
457
 
net_real_write(NET *net,const unsigned char *packet, size_t len)
 
457
net_real_write(NET *net, const unsigned char *packet, size_t len)
458
458
{
459
459
  size_t length;
460
 
  const unsigned char *pos,*end;
 
460
  const unsigned char *pos, *end;
461
461
  uint32_t retry_count= 0;
462
462
 
463
463
  /* Backup of the original SO_RCVTIMEO timeout */
548
548
  /* Loop until we have read everything */
549
549
  while (pos != end)
550
550
  {
551
 
    if ((long) (length= vio_write(net->vio,pos,(size_t) (end-pos))) <= 0)
 
551
    assert(pos);
 
552
    if ((long) (length= vio_write(net->vio, pos, (size_t) (end-pos))) <= 0)
552
553
    {
553
554
      const bool interrupted= vio_should_retry(net->vio);
554
555
      /*