1
/* $Id: ncbi_connection.c,v 6.45 2005/05/18 18:15:21 lavr Exp $
1
/* $Id: ncbi_connection.c,v 6.48 2006/02/23 17:43:01 lavr Exp $
2
2
* ===========================================================================
4
4
* PUBLIC DOMAIN NOTICE
53
53
: "Unknown", IO_StatusStr(status)))
55
55
#define CONN_LOG(level, descr) CONN_LOG_EX(level, descr, status)
57
# define CONN_TRACE(descr) CONN_LOG(eLOG_Trace, descr)
59
# define CONN_TRACE(descr) ((void) 0)
58
62
/* Standard macros to verify that the passed connection handle is not NULL
273
if (new_timeout && new_timeout != kDefaultTimeout) {
274
conn->oo_timeout = *new_timeout;
277
if (timeout && timeout != kDefaultTimeout) {
278
if (&conn->oo_timeout != timeout)
279
conn->oo_timeout = *timeout;
275
280
conn->o_timeout = &conn->oo_timeout;
277
conn->o_timeout = new_timeout;
282
conn->o_timeout = timeout;
281
if (new_timeout && new_timeout != kDefaultTimeout) {
282
conn->cc_timeout = *new_timeout;
286
if (timeout && timeout != kDefaultTimeout) {
287
if (&conn->cc_timeout != timeout)
288
conn->cc_timeout = *timeout;
283
289
conn->c_timeout = &conn->cc_timeout;
285
conn->c_timeout = new_timeout;
291
conn->c_timeout = timeout;
289
295
case eIO_ReadWrite:
290
if (new_timeout && new_timeout != kDefaultTimeout) {
291
conn->rr_timeout = *new_timeout;
296
if (timeout && timeout != kDefaultTimeout) {
297
if (&conn->rr_timeout != timeout)
298
conn->rr_timeout = *timeout;
292
299
conn->r_timeout = &conn->rr_timeout;
294
conn->r_timeout = new_timeout;
301
conn->r_timeout = timeout;
296
303
if (event != eIO_ReadWrite)
300
if (new_timeout && new_timeout != kDefaultTimeout) {
301
conn->ww_timeout = *new_timeout;
307
if (timeout && timeout != kDefaultTimeout) {
308
if (&conn->ww_timeout != timeout)
309
conn->ww_timeout = *timeout;
302
310
conn->w_timeout = &conn->ww_timeout;
304
conn->w_timeout = new_timeout;
312
conn->w_timeout = timeout;
406
414
/* call current connector's "WRITE" method */
407
415
status = conn->meta.write(conn->meta.c_write, buf, size, n_written,
408
416
conn->w_timeout == kDefaultTimeout ?
409
conn->meta.default_timeout :conn->w_timeout);
417
conn->meta.default_timeout : conn->w_timeout);
411
419
if (status != eIO_Success) {
412
420
if ( *n_written ) {
413
CONN_LOG(eLOG_Trace, "[CONN_Write] Write error");
421
CONN_TRACE("[CONN_Write] Write error");
414
422
status = eIO_Success;
415
423
} else if ( size )
416
424
CONN_LOG(eLOG_Error, "[CONN_Write] Cannot write data");
563
571
if (status != eIO_Success) {
565
CONN_LOG(eLOG_Trace, "[CONN_Read] Read error");
573
CONN_TRACE("[CONN_Read] Read error");
566
574
status = eIO_Success;
568
CONN_LOG(status == eIO_Closed ? eLOG_Trace :
569
status == eIO_Timeout ? eLOG_Warning : eLOG_Error,
575
} else if (size && status != eIO_Closed) {
576
CONN_LOG(status == eIO_Timeout ? eLOG_Warning : eLOG_Error,
570
577
"[CONN_Read] Cannot read data");
856
863
* --------------------------------------------------------------------------
857
864
* $Log: ncbi_connection.c,v $
865
* Revision 6.48 2006/02/23 17:43:01 lavr
866
* CONN_Read(): No CLOSED trace on EOF
868
* Revision 6.47 2006/02/14 15:49:42 lavr
869
* Introduce and use CORE_TRACE macros (NOP in Release mode)
871
* Revision 6.46 2006/01/18 03:38:17 lavr
872
* Prevent copying STimeout structs into themselves [where can occur]
858
874
* Revision 6.45 2005/05/18 18:15:21 lavr
859
875
* Formatting spot
923
939
* Checks for kDefaultTimeout and use of default_timeout of meta-connector
925
941
* Revision 6.23 2002/04/24 21:18:04 lavr
926
* Beautifying: pup open check before buffer check in CONN_Wait()
942
* Beautifying: move open check in front of buffer check in CONN_Wait()
928
944
* Revision 6.22 2002/04/22 19:30:01 lavr
929
945
* Do not put trace message on polling wait (tmo={0,0})
992
1008
* Revision 6.2 2000/12/29 17:52:59 lavr
993
1009
* Adapted to use new connector structure; modified to have
994
* Internal tri-state {Unusable | Open | Closed }.
1010
* an internal tri-state {Unusable | Open | Closed }.
996
1012
* Revision 6.1 2000/03/24 22:53:34 vakatov
997
1013
* Initial revision