return (msg);
}
-
/*
* Incoming messages have a ptl_msg_t object associated with them
* by the library. This object encapsulates the state of the
rc = lib_send (nal, private, msg, &reply, PTL_MSG_REPLY,
hdr->src_nid, hdr->src_pid, md, offset, mlength);
- if (rc != 0) {
+ if (rc != PTL_OK) {
CERROR(LPU64": Dropping GET from "LPU64": send REPLY failed\n",
ni->nid, hdr->src_nid);
+ /* Hmm, this will create a GET event and make believe
+ * the reply completed, which it kind of did, only the
+ * source won't get her reply */
+ lib_finalize (nal, private, msg);
state_lock (nal, &flags);
goto drop;
}
lib_msg_t *msg = NULL;
ptl_process_id_t *id = &args->target_in;
unsigned long flags;
-
+ int rc;
+
if (!list_empty (&nal->ni.ni_test_peers) && /* normally we don't */
fail_peer (nal, id->nid, 1)) /* shall we now? */
{
state_unlock(nal, &flags);
- lib_send (nal, private, msg, &hdr, PTL_MSG_PUT,
- id->nid, id->pid, md, 0, md->length);
-
+ rc = lib_send (nal, private, msg, &hdr, PTL_MSG_PUT,
+ id->nid, id->pid, md, 0, md->length);
+ if (rc != PTL_OK) {
+ /* get_new_msg() committed us to sending by decrementing
+ * md->threshold, so we have to act like we did send, but
+ * the network dropped it. */
+ lib_finalize (nal, private, msg);
+ }
+
return ret->rc = PTL_OK;
}
ptl_process_id_t *id = &args->target_in;
lib_md_t *md;
unsigned long flags;
-
+ int rc;
+
if (!list_empty (&nal->ni.ni_test_peers) && /* normally we don't */
fail_peer (nal, id->nid, 1)) /* shall we now? */
{
state_unlock(nal, &flags);
- lib_send (nal, private, msg, &hdr, PTL_MSG_GET,
- id->nid, id->pid, NULL, 0, 0);
-
+ rc = lib_send (nal, private, msg, &hdr, PTL_MSG_GET,
+ id->nid, id->pid, NULL, 0, 0);
+ if (rc != PTL_OK) {
+ /* get_new_msg() committed us to sending by decrementing
+ * md->threshold, so we have to act like we did send, but
+ * the network dropped it. */
+ lib_finalize (nal, private, msg);
+ }
+
return ret->rc = PTL_OK;
}