FACT++  1.0
static void ast_read_h ( int  conn_id,
int  status,
int  size 
)
static

Definition at line 70 of file webTcpip.c.

References DNA_CONNECTION::buffer, Dna_conns, dna_start_read(), DNA_CONNECTION::full_size, DNA_CONNECTION::read_ast, read_data(), size, STA_DISC, and TCP_RCV_BUF_SIZE.

Referenced by web_start_read().

71 {
72  register DNA_CONNECTION *dna_connp = &Dna_conns[conn_id];
73 
74  if(!dna_connp->buffer) /* The connection has already been closed */
75  {
76  return;
77  }
78  if(status == 1)
79  {
80 /*
81  next_size = dna_connp->curr_size;
82  buff = (char *) dna_connp->curr_buffer;
83  if(size < next_size)
84  {
85  max_io_data = Tcpip_max_io_data_read;
86  read_size = ((next_size - size) > max_io_data) ?
87  max_io_data : next_size - size;
88  dna_connp->curr_size -= size;
89  dna_connp->curr_buffer += size;
90  tcpip_code = tcpip_start_read(conn_id, buff + size,
91  read_size, ast_read_h);
92  if(tcpip_failure(tcpip_code))
93  {
94 #ifndef WIN32
95  if(errno == ENOTSOCK)
96  {
97  if(dna_connp->read_ast)
98  dna_connp->read_ast(conn_id, NULL, 0, STA_DISC);
99  }
100  else
101 #endif
102  {
103  dna_report_error(conn_id, tcpip_code,
104  "Reading from", DIM_ERROR, DIMTCPRDERR);
105  }
106  }
107  return;
108  }
109  switch(dna_connp->state)
110  {
111  case RD_HDR :
112  if(is_header(conn_id))
113  {
114  if( dna_connp->state == RD_DATA )
115  {
116  next_size = vtohl(dna_connp->buffer[1]);
117  dna_start_read(conn_id, next_size);
118  }
119  else
120  {
121  dna_connp->state = RD_HDR;
122  dna_start_read(conn_id, READ_HEADER_SIZE);
123  }
124  }
125  break;
126  case RD_DATA :
127  read_data(conn_id);
128  dna_connp->state = RD_HDR;
129  dna_start_read(conn_id, READ_HEADER_SIZE);
130  break;
131  default:
132  break;
133  }
134 */
135  dna_connp->full_size = size;
136  read_data(conn_id);
138  }
139  else
140  {
141  /*
142  printf("Connection lost. Signal upper layer\n");
143  */
144  if(dna_connp->read_ast)
145  dna_connp->read_ast(conn_id, NULL, 0, STA_DISC);
146  }
147 }
#define STA_DISC
Definition: dim.h:197
static void read_data(int conn_id)
Definition: webTcpip.c:59
#define TCP_RCV_BUF_SIZE
Definition: dim.h:165
int size
Definition: db_dim_server.c:17
DllExp DIM_NOSHARE DNA_CONNECTION * Dna_conns
Definition: conn_handler.c:31
int full_size
Definition: dim.h:388
int * buffer
Definition: dim.h:384
int dna_start_read(int conn_id, int size)
Definition: dna.c:234
void(* read_ast)()
Definition: dim.h:382

+ Here is the call graph for this function:

+ Here is the caller graph for this function: