return 0;
}
-static int ctdbd_msg_call_back(struct ctdbd_connection *conn,
+static int ctdbd_msg_call_back(struct tevent_context *ev,
+ struct ctdbd_connection *conn,
struct ctdb_req_message_old *msg)
{
uint32_t msg_len;
if ((cb->srvid == msg->srvid) && (cb->cb != NULL)) {
int ret;
- ret = cb->cb(NULL,
+ ret = cb->cb(ev,
msg->hdr.srcnode, msg->hdr.destnode,
msg->srvid, msg->data, msg->datalen,
cb->private_data);
if (hdr->operation == CTDB_REQ_MESSAGE) {
struct ctdb_req_message_old *msg = (struct ctdb_req_message_old *)hdr;
- ret = ctdbd_msg_call_back(conn, msg);
+ ret = ctdbd_msg_call_back(NULL, conn, msg);
if (ret != 0) {
TALLOC_FREE(hdr);
return ret;
/*
* Packet handler to receive and handle a ctdb message
*/
-static int ctdb_handle_message(struct ctdbd_connection *conn,
+static int ctdb_handle_message(struct tevent_context *ev,
+ struct ctdbd_connection *conn,
struct ctdb_req_header *hdr)
{
struct ctdb_req_message_old *msg;
msg = (struct ctdb_req_message_old *)hdr;
- ctdbd_msg_call_back(conn, msg);
+ ctdbd_msg_call_back(ev, conn, msg);
return 0;
}
-void ctdbd_socket_readable(struct ctdbd_connection *conn)
+void ctdbd_socket_readable(struct tevent_context *ev,
+ struct ctdbd_connection *conn)
{
struct ctdb_req_header *hdr = NULL;
int ret;
cluster_fatal("ctdbd died\n");
}
- ret = ctdb_handle_message(conn, hdr);
+ ret = ctdb_handle_message(ev, conn, hdr);
TALLOC_FREE(hdr);
/*
* see if a remote process exists
*/
-bool ctdbd_process_exists(struct ctdbd_connection *conn, uint32_t vnn, pid_t pid)
+bool ctdbd_process_exists(struct ctdbd_connection *conn, uint32_t vnn,
+ pid_t pid, uint64_t unique_id)
{
+ uint8_t buf[sizeof(pid)+sizeof(unique_id)];
int32_t cstatus = 0;
int ret;
- ret = ctdbd_control(conn, vnn, CTDB_CONTROL_PROCESS_EXISTS, 0, 0,
- (TDB_DATA) { .dptr = (uint8_t *)&pid,
- .dsize = sizeof(pid) },
+ if (unique_id == SERVERID_UNIQUE_ID_NOT_TO_VERIFY) {
+ ret = ctdbd_control(conn, vnn, CTDB_CONTROL_PROCESS_EXISTS,
+ 0, 0,
+ (TDB_DATA) { .dptr = (uint8_t *)&pid,
+ .dsize = sizeof(pid) },
+ NULL, NULL, &cstatus);
+ if (ret != 0) {
+ return false;
+ }
+ return (cstatus == 0);
+ }
+
+ memcpy(buf, &pid, sizeof(pid));
+ memcpy(buf+sizeof(pid), &unique_id, sizeof(unique_id));
+
+ ret = ctdbd_control(conn, vnn, CTDB_CONTROL_CHECK_PID_SRVID, 0, 0,
+ (TDB_DATA) { .dptr = buf, .dsize = sizeof(buf) },
NULL, NULL, &cstatus);
if (ret != 0) {
return false;
}
/*
- * Attempt a direct write. If this returns short, shedule the
+ * Attempt a direct write. If this returns short, schedule the
* remaining data as an async write, otherwise we're already done.
*/