libcli/nbt: convert nbt_name_refresh_wins_send/recv to tevent_req
[abartlet/samba.git/.git] / source4 / nbt_server / wins / winsclient.c
index f6f6ff48ec3447a496bfe674a160460f0307a4e8..0c513d1ae0306dd87c7666a838bd7c3158c295d3 100644 (file)
@@ -74,15 +74,16 @@ struct nbtd_wins_refresh_state {
 /*
   called when a wins name refresh has completed
 */
-static void nbtd_wins_refresh_handler(struct composite_context *subreq)
+static void nbtd_wins_refresh_handler(struct tevent_req *subreq)
 {
        NTSTATUS status;
        struct nbtd_wins_refresh_state *state =
-               talloc_get_type_abort(subreq->async.private_data,
+               tevent_req_callback_data(subreq,
                struct nbtd_wins_refresh_state);
        struct nbtd_iface_name *iname = state->iname;
 
        status = nbt_name_refresh_wins_recv(subreq, state, &state->io);
+       TALLOC_FREE(subreq);
        if (NT_STATUS_EQUAL(status, NT_STATUS_IO_TIMEOUT)) {
                /* our WINS server is dead - start registration over
                   from scratch */
@@ -139,7 +140,7 @@ static void nbtd_wins_refresh(struct tevent_context *ev, struct tevent_timer *te
        struct nbtd_iface_name *iname = talloc_get_type(private_data, struct nbtd_iface_name);
        struct nbtd_interface *iface = iname->iface;
        struct nbt_name_socket *nbtsock = wins_socket(iface);
-       struct composite_context *subreq;
+       struct tevent_req *subreq;
        struct nbtd_wins_refresh_state *state;
 
        state = talloc_zero(iname, struct nbtd_wins_refresh_state);
@@ -162,14 +163,13 @@ static void nbtd_wins_refresh(struct tevent_context *ev, struct tevent_timer *te
                return;
        }
 
-       subreq = nbt_name_refresh_wins_send(nbtsock, &state->io);
+       subreq = nbt_name_refresh_wins_send(state, ev, nbtsock, &state->io);
        if (subreq == NULL) {
                talloc_free(state);
                return;
        }
 
-       subreq->async.fn = nbtd_wins_refresh_handler;
-       subreq->async.private_data = state;
+       tevent_req_set_callback(subreq, nbtd_wins_refresh_handler, state);
 }