gssize ret;
ret = transfer->data_producer(buf, len, transfer->user_data);
- if (ret >= 0)
+ if (ret > 0)
+ return ret;
+
+ if (ret == 0) {
+ transfer_complete(transfer, NULL);
return ret;
+ }
req = g_obex_packet_new(G_OBEX_RSP_INTERNAL_SERVER_ERROR, TRUE, NULL);
g_obex_send(transfer->obex, req, NULL);
GObexPacket *rsp;
rsp = g_obex_packet_new(G_OBEX_RSP_CONTINUE, TRUE, NULL);
- g_obex_packet_add_body(req, get_get_data, transfer);
+ g_obex_packet_add_body(rsp, get_get_data, transfer);
if (!g_obex_send(obex, rsp, &err)) {
transfer_complete(transfer, err);
transfer = transfer_new(obex, G_OBEX_OP_GET, complete_func, user_data);
transfer->data_producer = data_func;
- transfer_put_req(obex, req, transfer);
+ transfer_get_req(obex, req, transfer);
if (!g_slist_find(transfers, transfer))
return 0;