comparison freeDiameter/p_out.c @ 208:e1da03ba112f

Force ordering of messages by using only stream 0 for link-local messages -- avoids issue of DWR arriving before CEA.
author Sebastien Decugis <sdecugis@nict.go.jp>
date Mon, 15 Feb 2010 18:16:12 +0900
parents 4679ff581d6a
children 965f5971dc23
comparison
equal deleted inserted replaced
207:a68d24defda8 208:e1da03ba112f
37 37
38 /* Alloc a new hbh for requests, bufferize the message and send on the connection, save in sentreq if provided */ 38 /* Alloc a new hbh for requests, bufferize the message and send on the connection, save in sentreq if provided */
39 static int do_send(struct msg ** msg, struct cnxctx * cnx, uint32_t * hbh, struct sr_list * srl) 39 static int do_send(struct msg ** msg, struct cnxctx * cnx, uint32_t * hbh, struct sr_list * srl)
40 { 40 {
41 struct msg_hdr * hdr; 41 struct msg_hdr * hdr;
42 int msg_is_a_req; 42 int msg_is_a_req, msg_is_appl;
43 uint8_t * buf; 43 uint8_t * buf;
44 size_t sz; 44 size_t sz;
45 int ret; 45 int ret;
46 uint32_t bkp_hbh = 0; 46 uint32_t bkp_hbh = 0;
47 47
57 bkp_hbh = hdr->msg_hbhid; 57 bkp_hbh = hdr->msg_hbhid;
58 hdr->msg_hbhid = *hbh; 58 hdr->msg_hbhid = *hbh;
59 *hbh = hdr->msg_hbhid + 1; 59 *hbh = hdr->msg_hbhid + 1;
60 } 60 }
61 61
62 msg_is_appl = fd_msg_is_routable(*msg);
63
62 /* Log the message */ 64 /* Log the message */
63 if (TRACE_BOOL(FULL)) { 65 if (TRACE_BOOL(FULL)) {
64 CHECK_FCT_DO( fd_msg_update_length(*msg), /* continue */ ); 66 CHECK_FCT_DO( fd_msg_update_length(*msg), /* continue */ );
65 TRACE_DEBUG(FULL, "Sending the following message on connection '%s':", fd_cnx_getid(cnx)); 67 TRACE_DEBUG(FULL, "Sending the following message on connection '%s':", fd_cnx_getid(cnx));
66 fd_msg_dump_walk(FULL, *msg); 68 fd_msg_dump_walk(FULL, *msg);
74 if (msg_is_a_req) { 76 if (msg_is_a_req) {
75 CHECK_FCT_DO( ret = fd_p_sr_store(srl, msg, &hdr->msg_hbhid, bkp_hbh), { free(buf); return ret; } ); 77 CHECK_FCT_DO( ret = fd_p_sr_store(srl, msg, &hdr->msg_hbhid, bkp_hbh), { free(buf); return ret; } );
76 } 78 }
77 79
78 /* Send the message */ 80 /* Send the message */
79 CHECK_FCT_DO( ret = fd_cnx_send(cnx, buf, sz), { free(buf); return ret; } ); 81 CHECK_FCT_DO( ret = fd_cnx_send(cnx, buf, sz, !msg_is_appl), { free(buf); return ret; } );
80 pthread_cleanup_pop(1); 82 pthread_cleanup_pop(1);
81 83
82 /* Free remaining messages (i.e. answers) */ 84 /* Free remaining messages (i.e. answers) */
83 if (*msg) { 85 if (*msg) {
84 CHECK_FCT( fd_msg_free(*msg) ); 86 CHECK_FCT( fd_msg_free(*msg) );
"Welcome to our mercurial repository"