@@ -100,6 +100,11 @@ static void transfer_complete(struct transfer *transfer, GError *err)
g_obex_debug(G_OBEX_DEBUG_TRANSFER, "transfer %u", id);
+ if (err) {
+ /* No further tx must be performed */
+ g_obex_drop_tx_queue(transfer->obex);
+ }
+
transfer->complete_func(transfer->obex, err, transfer->user_data);
/* Check if the complete_func removed the transfer */
if (find_transfer(id) == NULL)
@@ -521,6 +521,16 @@ static void enable_tx(GObex *obex)
obex->write_source = g_io_add_watch(obex->io, cond, write_data, obex);
}
+void g_obex_drop_tx_queue(GObex *obex)
+{
+ struct pending_pkt *p;
+
+ g_obex_debug(G_OBEX_DEBUG_COMMAND, "");
+
+ while ((p = g_queue_pop_head(obex->tx_queue)))
+ pending_pkt_free(p);
+}
+
static gboolean g_obex_send_internal(GObex *obex, struct pending_pkt *p,
GError **err)
{
@@ -63,6 +63,7 @@ gboolean g_obex_remove_request_function(GObex *obex, guint id);
void g_obex_suspend(GObex *obex);
void g_obex_resume(GObex *obex);
gboolean g_obex_srm_active(GObex *obex);
+void g_obex_drop_tx_queue(GObex *obex);
GObex *g_obex_new(GIOChannel *io, GObexTransportType transport_type,
gssize rx_mtu, gssize tx_mtu);