Navigation


Changeset 710:e60376cb15e8 in freeDiameter


Ignore:
Timestamp:
Feb 10, 2011, 4:00:53 PM (13 years ago)
Author:
Sebastien Decugis <sdecugis@nict.go.jp>
Branch:
default
Phase:
public
Message:

Minor changes

Files:
5 edited

Legend:

Unmodified
Added
Removed
  • libfdcore/cnxctx.c

    r709 r710  
    622622again:
    623623        ret = recv(conn->cc_socket, buffer, length, 0);
    624         /* Handle special case of timeout */
    625         if ((ret < 0) && (errno == EAGAIN)) {
     624        /* Handle special case of timeout / interrupts */
     625        if ((ret < 0) && ((errno == EAGAIN) || (errno == EINTR))) {
     626                pthread_testcancel();
    626627                if (! fd_cnx_teststate(conn, CC_STATUS_CLOSING ))
    627628                        goto again; /* don't care, just ignore */
     
    649650        ret = send(conn->cc_socket, buffer, length, 0);
    650651        /* Handle special case of timeout */
    651         if ((ret < 0) && (errno == EAGAIN)) {
     652        if ((ret < 0) && ((errno == EAGAIN) || (errno == EINTR))) {
     653                pthread_testcancel();
    652654                if (! fd_cnx_teststate(conn, CC_STATUS_CLOSING ))
    653655                        goto again; /* don't care, just ignore */
  • libfdcore/sctp.c

    r706 r710  
    10411041        ret = sendmsg(conn->cc_socket, &mhdr, 0);
    10421042        /* Handle special case of timeout */
    1043         if ((ret < 0) && (errno == EAGAIN)) {
     1043        if ((ret < 0) && ((errno == EAGAIN) || (errno == EINTR))) {
     1044                pthread_testcancel();
    10441045                if (! fd_cnx_teststate(conn, CC_STATUS_CLOSING ))
    10451046                        goto again; /* don't care, just ignore */
     
    10991100        pthread_cleanup_push(free, data);
    11001101        ret = recvmsg(conn->cc_socket, &mhdr, 0);
     1102        pthread_testcancel();
    11011103        pthread_cleanup_pop(0);
    11021104       
    11031105        /* First, handle timeouts (same as fd_cnx_s_recv) */
    1104         if ((ret < 0) && (errno == EAGAIN)) {
     1106        if ((ret < 0) && ((errno == EAGAIN) || (errno == EINTR))) {
    11051107                if (! fd_cnx_teststate(conn, CC_STATUS_CLOSING ))
    11061108                        goto again; /* don't care, just ignore */
  • libfdproto/fdproto-internal.h

    r706 r710  
    5252
    5353/* Special message dump function */
     54void fd_msg_dump_fstr_one ( struct msg * msg, FILE * fstr );
    5455void fd_msg_dump_fstr ( struct msg * msg, FILE * fstr );
    5556
  • libfdproto/messages.c

    r706 r710  
    808808        } while (ref);
    809809}
     810void fd_msg_dump_fstr_one ( struct msg * msg, FILE * fstr ) /* just the header */
     811{
     812        msg_dump_intern ( NONE, msg, 2, fstr );
     813}
    810814
    811815/* Dump a message content -- for debug mostly */
  • libfdproto/msg_log.c

    r689 r710  
    109109        FILE * fstr;
    110110       
     111        char buftime[256];
     112        size_t offset = 0;
     113        struct timespec ts;
     114        struct tm tm;
     115       
    111116        TRACE_ENTRY("%d %p %p", cause, msg, prefix_format);
    112117        CHECK_PARAMS_DO( (cause >= 0) && (cause <= FD_MSG_LOG_MAX),
     
    125130        CHECK_POSIX_DO( pthread_mutex_unlock(&ml_conf.lock), );
    126131       
     132        /* Get current time */
     133        CHECK_SYS_DO( clock_gettime(CLOCK_REALTIME, &ts), /* continue */);
     134        offset += strftime(buftime + offset, sizeof(buftime) - offset, "%D,%T", localtime_r( &ts.tv_sec , &tm ));
     135        offset += snprintf(buftime + offset, sizeof(buftime) - offset, ".%6.6ld", ts.tv_nsec / 1000);
     136       
     137
    127138        /* Okay, now we will create the file descriptor */
    128139        switch (meth) {
     
    142153       
    143154        /* For file methods, let's parse the message so it looks better */
    144         if ((meth != FD_MSG_LOGTO_DEBUGONLY) && ml_conf.dict) {
     155        if (((meth != FD_MSG_LOGTO_DEBUGONLY) || (fd_g_debug_lvl > FULL)) && ml_conf.dict) {
    145156                CHECK_FCT_DO( fd_msg_parse_dict( msg, ml_conf.dict, NULL ), );
    146157        }
     
    155166        pthread_cleanup_pop(0);
    156167        (void)pthread_mutex_unlock(&fd_log_lock);
    157         fd_log_debug_fstr(fstr, "\n\n");
     168       
     169        fd_log_debug_fstr(fstr, "\nLogged: %s\n\n", buftime);
    158170       
    159171        /* And now the message itself */
    160         fd_msg_dump_fstr(msg, fstr);
     172        if ((meth == FD_MSG_LOGTO_DEBUGONLY) && (fd_g_debug_lvl <= INFO)) {
     173                /* dump only the header */
     174                fd_msg_dump_fstr_one(msg, fstr);
     175        } else {
     176                /* dump the full content */
     177                fd_msg_dump_fstr(msg, fstr);
     178        }
    161179       
    162180        /* And finally close the stream if needed */
    163         TODO("close?");
     181        switch (meth) {
     182                case FD_MSG_LOGTO_DEBUGONLY:
     183                        break;
     184                       
     185                case FD_MSG_LOGTO_FILE:
     186                        TODO("close?");
     187                        break;
     188                case FD_MSG_LOGTO_DIR:
     189                        TODO("close?");
     190                        break;
     191        }
    164192}
    165193
Note: See TracChangeset for help on using the changeset viewer.