Thread (15 messages) flat view 15 messages, 2 authors, 2012-01-31

Re: [PATCH obexd 03/13] client: fix not queuing requests properly

From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Date: 2012-01-31 16:39:56

Hi Mikel,

On Tue, Jan 31, 2012 at 5:28 AM, Mikel Astiz [off-list ref] wrote:
quoted
-struct pending_data {
-       session_callback_t cb;
+struct pending_request {
        struct obc_session *session;
        struct obc_transfer *transfer;
+       session_callback_t auth_complete;

I don't see the need to have a GError* as a parameter to the auth_complete
ballback. It looks like a type reuse, but I'd suggest replacing the callback
type with another specific one.
Yep, we can use GCallback or something similar, gonna fix that.
quoted
        /* Unregister any pending transfer */
-       while (l) {
-               struct obc_transfer *transfer = l->data;
-
-               l = l->next;
-
-               obc_session_remove_transfer(session, transfer);
-       }
+       while ((p = g_queue_pop_head(session->queue)))
+               pending_request_free(p);

Would it simpler to use g_queue_foreach just like in session_free?
Yep gonna fix this too.
quoted
-       pending->cb(pending->session, NULL, transfer);
-       g_free(pending);
+       p->auth_complete(p->session, NULL, transfer);

It seems like (auth_complete != NULL) should be checked here, or otherwise
the check in session_request_reply should be removed.
Yep

-- 
Luiz Augusto von Dentz
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help