FACT++  1.0
int dna_start_read ( int  conn_id,
int  size 
)

Definition at line 234 of file dna.c.

References DNA_CONNECTION::buffer, DNA_CONNECTION::buffer_size, DNA_CONNECTION::busy, DNA_CONNECTION::curr_buffer, DNA_CONNECTION::curr_size, DIM_ERROR, DIMTCPRDERR, Dna_conns, dna_report_error(), DNA_CONNECTION::full_size, size, tcpip_failure(), Tcpip_max_io_data_read, and tcpip_start_read().

Referenced by ast_conn_h(), ast_read_h(), and dna_open_client().

235 {
236  register DNA_CONNECTION *dna_connp = &Dna_conns[conn_id];
237  register int tcpip_code, read_size;
238  int max_io_data;
239 
240  if(!dna_connp->busy)
241  {
242  return(0);
243  }
244 
245  dna_connp->curr_size = size;
246  dna_connp->full_size = size;
247  if(size > dna_connp->buffer_size)
248  {
249  dna_connp->buffer =
250  (int *) realloc(dna_connp->buffer, (size_t)size);
251  dna_connp->buffer_size = size;
252  }
253  dna_connp->curr_buffer = (char *) dna_connp->buffer;
254  max_io_data = Tcpip_max_io_data_read;
255  read_size = (size > max_io_data) ? max_io_data : size ;
256 
257  tcpip_code = tcpip_start_read(conn_id, dna_connp->curr_buffer,
258  read_size, ast_read_h);
259  if(tcpip_failure(tcpip_code)) {
260  dna_report_error(conn_id, tcpip_code,
261  "Reading from", DIM_ERROR, DIMTCPRDERR);
262 
263  return(0);
264  }
265 
266  return(1);
267 }
static void ast_read_h(int conn_id, int status, int size)
Definition: dna.c:134
int Tcpip_max_io_data_read
Definition: tcpip.c:111
int busy
Definition: dim.h:381
#define DIMTCPRDERR
Definition: dim_common.h:293
int curr_size
Definition: dim.h:387
int tcpip_start_read(int conn_id, char *buffer, int size, void(*ast_routine)())
Definition: tcpip.c:949
void dna_report_error(int conn_id, int code, char *routine_name, int severity, int errcode)
Definition: dna.c:903
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 buffer_size
Definition: dim.h:385
int tcpip_failure(int code)
Definition: tcpip.c:1540
char * curr_buffer
Definition: dim.h:386

+ Here is the call graph for this function:

+ Here is the caller graph for this function: