From 3d6aa3bf2fd173e66ac20831a4f625c5a9f60d95 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Tue, 5 Jul 2011 18:57:23 +0300 Subject: gobex: Track last received request internally and remove g_obex_response --- tools/test-server.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'tools') diff --git a/tools/test-server.c b/tools/test-server.c index 9f4e9c6..37c95a5 100644 --- a/tools/test-server.c +++ b/tools/test-server.c @@ -64,26 +64,28 @@ static void disconn_func(GObex *obex, GError *err, gpointer user_data) static void req_func(GObex *obex, GObexPacket *req, gpointer user_data) { gboolean final; - guint8 rsp, op = g_obex_packet_get_operation(req, &final); + guint8 rspcode, op = g_obex_packet_get_operation(req, &final); + GObexPacket *rsp; g_print("Request 0x%02x%s\n", op, final ? " (final)" : ""); switch (op) { case G_OBEX_OP_CONNECT: - rsp = G_OBEX_RSP_SUCCESS; + rspcode = G_OBEX_RSP_SUCCESS; break; case G_OBEX_OP_PUT: if (g_obex_packet_find_header(req, G_OBEX_HDR_ID_BODY)) - rsp = G_OBEX_RSP_CONTINUE; + rspcode = G_OBEX_RSP_CONTINUE; else - rsp = G_OBEX_RSP_SUCCESS; + rspcode = G_OBEX_RSP_SUCCESS; break; default: - rsp = G_OBEX_RSP_NOT_IMPLEMENTED; + rspcode = G_OBEX_RSP_NOT_IMPLEMENTED; break; } - g_obex_response(obex, op, rsp, NULL, NULL); + rsp = g_obex_packet_new(rspcode, TRUE, NULL); + g_obex_send(obex, rsp, NULL); } static gboolean unix_accept(GIOChannel *chan, GIOCondition cond, gpointer data) -- cgit v1.2.1