Changeset 895:fbf77629cb7b in freeDiameter for libfdcore/p_out.c
- Timestamp:
- Nov 30, 2012, 8:44:10 AM (11 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libfdcore/p_out.c
r740 r895 45 45 int ret; 46 46 uint32_t bkp_hbh = 0; 47 struct timespec senton; 48 struct msg * cpy_for_logs_only; 47 49 48 50 TRACE_ENTRY("%p %x %p %p %p", msg, flags, cnx, hbh, srl); … … 64 66 pthread_cleanup_push( free, buf ); 65 67 66 /* Log the message */ 67 fd_msg_log( FD_MSG_LOG_SENT, *msg, "Sent to '%s'", fd_cnx_getid(cnx)); 68 cpy_for_logs_only = *msg; 68 69 69 70 /* Save a request before sending so that there is no race condition with the answer */ 70 71 if (msg_is_a_req) { 71 72 CHECK_FCT_DO( ret = fd_p_sr_store(srl, msg, &hdr->msg_hbhid, bkp_hbh), goto out ); 73 } 74 75 CHECK_SYS_DO( clock_gettime(CLOCK_REALTIME, &senton), /* ... */ ); 76 CHECK_FCT_DO( fd_msg_ts_set_sent(cpy_for_logs_only, &senton), /* ... */ ); 77 78 /* Log the message */ 79 fd_msg_log( FD_MSG_LOG_SENT, cpy_for_logs_only, "Sent to '%s'", fd_cnx_getid(cnx)); 80 81 { 82 struct timespec rcvon, delay; 83 84 (void) fd_msg_ts_get_recv(cpy_for_logs_only, &rcvon); 85 if (rcvon.tv_sec != 0 || rcvon.tv_nsec != 0) { 86 TS_DIFFERENCE( &delay, &rcvon, &senton); 87 fd_msg_log( FD_MSG_LOG_TIMING, cpy_for_logs_only, "Forwarded in %d.%06.6d sec", delay.tv_sec, delay.tv_nsec/1000); 88 } else { /* We log the answer time only for answers generated locally */ 89 if (!msg_is_a_req) { 90 /* get the matching request */ 91 struct msg * req; 92 struct timespec reqrcvon; 93 (void) fd_msg_answ_getq(cpy_for_logs_only, &req); 94 (void) fd_msg_ts_get_recv(req, &reqrcvon); 95 TS_DIFFERENCE( &delay, &reqrcvon, &senton); 96 fd_msg_log( FD_MSG_LOG_TIMING, cpy_for_logs_only, "Answered in %d.%06.6d sec", delay.tv_sec, delay.tv_nsec/1000); 97 } 98 } 72 99 } 73 100
Note: See TracChangeset
for help on using the changeset viewer.