summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2011-07-05 18:57:23 +0300
committerJohan Hedberg <johan.hedberg@intel.com>2011-07-16 17:50:48 +0300
commit3d6aa3bf2fd173e66ac20831a4f625c5a9f60d95 (patch)
treecd73ea0eaacf960c0308d8ba093d3430b62856c4 /tools
parent04d77000ac3635ef5ced921676a399a0f206aae7 (diff)
downloadobexd-3d6aa3bf2fd173e66ac20831a4f625c5a9f60d95.tar.gz
gobex: Track last received request internally and remove g_obex_response
Diffstat (limited to 'tools')
-rw-r--r--tools/test-server.c14
1 files changed, 8 insertions, 6 deletions
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)