Is it really done when you call tevent_req_done?

Richard Sharpe realrichardsharpe at
Sat Jan 24 08:39:16 MST 2015

Hi folks,

In my seemingly never ending quest to understand tevent, I noticed the
following in some random smb2 request processing routine, like


        subreq = smbd_smb2_tree_connect_send(req,
        if (subreq == NULL) {
                return smbd_smb2_request_error(req, NT_STATUS_NO_MEMORY);
        tevent_req_set_callback(subreq, smbd_smb2_request_tcon_done, req);

        return smbd_smb2_request_pending_queue(req, subreq, 500);

So, we create a subrequest in smbd_smb2_tree_connect_send and if we
got one, we set a callback (smbd_smb2_request_tcon_done and then call
that routine that will queue it perhaps.

However, when we look at smbd_smb2_tree_connect_send we see:

        status = smbd_smb2_tree_connect(smb2req,
        if (tevent_req_nterror(req, status)) {
                return tevent_req_post(req, ev);

        return tevent_req_post(req, ev);

Huh, is it done or what? Done means finito, no more to do, etc. But
seemingly the request has a second life because tevent_req_post is
going to stick it in the tevent queue and then when we get back to our
caller it is going to be given a callback ...

I am confused and starting to feel like Alice:

'When I use a word,' Humpty Dumpty said, in rather a scornful tone,
'it means just what I choose it to mean — neither more nor less.'

Richard Sharpe

More information about the samba-technical mailing list