diff --git a/src/dyn_dnode_peer.c b/src/dyn_dnode_peer.c index dfca9ea7a..f134bd924 100644 --- a/src/dyn_dnode_peer.c +++ b/src/dyn_dnode_peer.c @@ -302,7 +302,13 @@ static void dnode_peer_ack_err(struct context *ctx, struct conn *conn, // Create an appropriate response for the request so its propagated up; // This response gets dropped in rsp_make_error anyways. But since this is // an error path its ok with the overhead. - struct msg *rsp = msg_get(conn, false, __FUNCTION__); + struct msg *rsp = msg_get_error(conn, PEER_CONNECTION_REFUSE, conn->err); + if (rsp == NULL) { + // TODO: It's not clear how the peer should behave if we hit this error + // condition. Return an appropriate error instead. + log_warn("Could not allocate msg for notifying an error to peer"); + return; + } req->done = 1; rsp->peer = req; rsp->is_error = req->is_error = 1; diff --git a/src/dyn_server.c b/src/dyn_server.c index 8f17396da..c1e89e75f 100644 --- a/src/dyn_server.c +++ b/src/dyn_server.c @@ -182,9 +182,11 @@ static void server_ack_err(struct context *ctx, struct conn *conn, // Create an appropriate response for the request so its propagated up; // This response gets dropped in rsp_make_error anyways. But since this is // an error path its ok with the overhead. - struct msg *rsp = msg_get(conn, false, __FUNCTION__); + struct msg *rsp = msg_get_error(conn, STORAGE_CONNECTION_REFUSE, conn->err); if (rsp == NULL) { - log_warn("Could not allocate msg."); + // TODO: It's not clear how the client should behave if we hit this error + // condition. Return an appropriate error instead. + log_warn("Could not allocate msg for notifying an error to the client."); return; } req->done = 1;