+ got_address (session, host);
      } else {

Again, no extra space between function name and argument list.

When there is one call after the if(): you don't need to put { }, by the way.

But actually you might want to get a status returned from handle_result_address(), or then even if it has sent back a 400 or 409 http code, do_request() will still return a successful code and that's not what you want in such case: do_request() should return 0 then.

There is finally a bigger issue here: in case handle_result_address() (aka you got_address() function) is called at this place,
it should not call call_result_func() at all.

You might handle this case via an extra parameter to handle_result_address() like bool from_resolv (or a more relevant name if you have one)

Thus mixing both a returned status code and this you could do:

if (ret != 0 || !session->addr) {
                call_result_func(session, 400);
                return;
        }


would become:

if (ret != 0 || !session->addr) {
                ret = 400;
                goto error;
}

(...)

error:
        if (from_resolv)
            call_result_func(session, ret);

        return ret;



Something like that.


Tomasz
_______________________________________________
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman

Reply via email to