comparison libfdcore/p_out.c @ 691:78b665400097

Cleanup all pthread_cleanup_push / pop pairs so that pop is always called after push, or ASSERT(0) is some grave errors
author Sebastien Decugis <sdecugis@nict.go.jp>
date Thu, 20 Jan 2011 19:44:27 +0900
parents 8c3dc8584dab
children 4ffbc9f1e922
comparison
equal deleted inserted replaced
690:a29e4201d511 691:78b665400097
66 /* Log the message */ 66 /* Log the message */
67 fd_msg_log( FD_MSG_LOG_SENT, *msg, "Sent to '%s'", fd_cnx_getid(cnx)); 67 fd_msg_log( FD_MSG_LOG_SENT, *msg, "Sent to '%s'", fd_cnx_getid(cnx));
68 68
69 /* Save a request before sending so that there is no race condition with the answer */ 69 /* Save a request before sending so that there is no race condition with the answer */
70 if (msg_is_a_req) { 70 if (msg_is_a_req) {
71 CHECK_FCT_DO( ret = fd_p_sr_store(srl, msg, &hdr->msg_hbhid, bkp_hbh), { free(buf); return ret; } ); 71 CHECK_FCT_DO( ret = fd_p_sr_store(srl, msg, &hdr->msg_hbhid, bkp_hbh), goto out );
72 } 72 }
73 73
74 /* Send the message */ 74 /* Send the message */
75 CHECK_FCT_DO( ret = fd_cnx_send(cnx, buf, sz, flags), { free(buf); return ret; } ); 75 CHECK_FCT_DO( ret = fd_cnx_send(cnx, buf, sz, flags), );
76 out:
77 ;
76 pthread_cleanup_pop(1); 78 pthread_cleanup_pop(1);
79
80 if (ret)
81 return ret;
77 82
78 /* Free remaining messages (i.e. answers) */ 83 /* Free remaining messages (i.e. answers) */
79 if (*msg) { 84 if (*msg) {
80 CHECK_FCT( fd_msg_free(*msg) ); 85 CHECK_FCT( fd_msg_free(*msg) );
81 *msg = NULL; 86 *msg = NULL;
"Welcome to our mercurial repository"