Mercurial > hg > freeDiameter
comparison libfdcore/p_out.c @ 706:4ffbc9f1e922
Large UNTESTED commit with the following changes:
* Improved DiameterIdentity handling (esp. interationalization issues),
and improve efficiency of some string operations in peers, sessions,
and dictionary modules (closes #7)
* Cleanup in the session module to free only unreferenced sessions (#16)
* Removed fd_cpu_flush_cache(), replaced by more robust alternatives.
* Improved peer state machine algorithm to counter SCTP multistream race
condition.
author | Sebastien Decugis <sdecugis@nict.go.jp> |
---|---|
date | Wed, 09 Feb 2011 15:26:58 +0900 |
parents | 78b665400097 |
children | 4a9f08d6b6ba |
comparison
equal
deleted
inserted
replaced
705:f0cb8f465763 | 706:4ffbc9f1e922 |
---|---|
106 ASSERT( CHECK_PEER(peer) ); | 106 ASSERT( CHECK_PEER(peer) ); |
107 | 107 |
108 /* Set the thread name */ | 108 /* Set the thread name */ |
109 { | 109 { |
110 char buf[48]; | 110 char buf[48]; |
111 sprintf(buf, "OUT/%.*s", (int)sizeof(buf) - 5, peer->p_hdr.info.pi_diamid); | 111 snprintf(buf, sizeof(buf), "OUT/%s", peer->p_hdr.info.pi_diamid); |
112 fd_log_threadname ( buf ); | 112 fd_log_threadname ( buf ); |
113 } | 113 } |
114 | 114 |
115 /* Loop until cancelation */ | 115 /* Loop until cancelation */ |
116 while (1) { | 116 while (1) { |
146 int fd_out_send(struct msg ** msg, struct cnxctx * cnx, struct fd_peer * peer, uint32_t flags) | 146 int fd_out_send(struct msg ** msg, struct cnxctx * cnx, struct fd_peer * peer, uint32_t flags) |
147 { | 147 { |
148 TRACE_ENTRY("%p %p %p %x", msg, cnx, peer, flags); | 148 TRACE_ENTRY("%p %p %p %x", msg, cnx, peer, flags); |
149 CHECK_PARAMS( msg && *msg && (cnx || (peer && peer->p_cnxctx))); | 149 CHECK_PARAMS( msg && *msg && (cnx || (peer && peer->p_cnxctx))); |
150 | 150 |
151 fd_cpu_flush_cache(); | 151 if (fd_peer_getstate(peer) == STATE_OPEN) { |
152 if (peer && (peer->p_hdr.info.runtime.pir_state == STATE_OPEN)) { | |
153 /* Normal case: just queue for the out thread to pick it up */ | 152 /* Normal case: just queue for the out thread to pick it up */ |
154 CHECK_FCT( fd_fifo_post(peer->p_tosend, msg) ); | 153 CHECK_FCT( fd_fifo_post(peer->p_tosend, msg) ); |
155 | 154 |
156 } else { | 155 } else { |
157 int ret; | 156 int ret; |