Changeset 894:43fb27a9037f in freeDiameter for libfdcore/cnxctx.c
- Timestamp:
- Nov 30, 2012, 6:51:49 AM (11 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libfdcore/cnxctx.c
r816 r894 641 641 } 642 642 643 CHECK_SYS_DO( clock_gettime(CLOCK_REALTIME, &conn->cc_tls_para.recvon), /* continue */ ); 644 643 645 return ret; 644 646 } … … 696 698 ssize_t ret = 0; 697 699 size_t received = 0; 700 struct timespec recv_on; 698 701 699 702 do { … … 718 721 719 722 /* Ok, now we can really receive the data */ 720 CHECK_MALLOC_DO( newmsg = malloc( length ), goto fatal );723 CHECK_MALLOC_DO( newmsg = malloc( length + sizeof(struct timespec) ), goto fatal ); 721 724 memcpy(newmsg, header, sizeof(header)); 722 725 … … 732 735 received += ret; 733 736 } 737 738 /* Piggy-tail the timestamp of reception */ 739 CHECK_SYS_DO( clock_gettime(CLOCK_REALTIME, &recv_on), /* continue */ ); 740 memcpy(newmsg + length, &recv_on, sizeof(struct timespec)); 734 741 735 742 /* We have received a complete message, pass it to the daemon */ … … 782 789 continue; 783 790 } 784 791 /* Note: the real size of buf is bufsz + struct timespec */ 785 792 CHECK_FCT_DO( fd_event_send( fd_cnx_target_queue(conn), event, bufsz, buf), goto fatal ); 786 793 … … 920 927 int fd_tls_rcvthr_core(struct cnxctx * conn, gnutls_session_t session) 921 928 { 929 struct timespec * rcv_on; 930 931 void * ptr = gnutls_transport_get_ptr(session); 932 if (ptr == conn) { 933 rcv_on = &conn->cc_tls_para.recvon; 934 } else { 935 struct sctps_ctx * ctx = (struct sctps_ctx *) ptr; 936 rcv_on = &ctx->recvon; 937 } 938 939 922 940 /* No guarantee that GnuTLS preserves the message boundaries, so we re-build it as in TCP */ 923 941 do { … … 927 945 ssize_t ret = 0; 928 946 size_t received = 0; 947 struct timespec recv_on; 929 948 930 949 do { … … 949 968 950 969 /* Ok, now we can really receive the data */ 951 CHECK_MALLOC( newmsg = malloc( length ) );970 CHECK_MALLOC( newmsg = malloc( length + sizeof(struct timespec)) ); 952 971 memcpy(newmsg, header, sizeof(header)); 953 972 … … 963 982 received += ret; 964 983 } 984 985 /* The timestamp of the last TLS chunk received for this rebuilt message lives close to the session pointer, we piggyback it */ 986 memcpy(newmsg + length, rcv_on, sizeof(struct timespec)); 965 987 966 988 /* We have received a complete message, pass it to the daemon */
Note: See TracChangeset
for help on using the changeset viewer.