summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorOlivier Guiter <olivier.guiter@linux.intel.com>2012-10-22 15:52:57 +0200
committerSamuel Ortiz <sameo@linux.intel.com>2012-10-24 17:55:04 +0200
commitb1d328304ee66fbd35d402d34aeeb3ee8ecdc07a (patch)
tree2700a1da7d9cbf0b945a322416f67e54ef9f6082 /plugins
parentaf2a2289506ff6869de5b52c4b46adea895170c2 (diff)
downloadneard-b1d328304ee66fbd35d402d34aeeb3ee8ecdc07a.tar.gz
neard-b1d328304ee66fbd35d402d34aeeb3ee8ecdc07a.tar.bz2
neard-b1d328304ee66fbd35d402d34aeeb3ee8ecdc07a.zip
handover: Fix to allow two handover requests
Test case 7 verifies that the remote handover server does not close the data link connection after the first handover request message.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/handover.c11
-rw-r--r--plugins/p2p.c6
2 files changed, 8 insertions, 9 deletions
diff --git a/plugins/handover.c b/plugins/handover.c
index 10f7be6..b4dd148 100644
--- a/plugins/handover.c
+++ b/plugins/handover.c
@@ -149,8 +149,6 @@ static int handover_ndef_parse(int client_fd, struct hr_ndef *ndef)
near_info("Send Hs frame");
err = send(client_fd, msg->data, msg->length, MSG_DONTWAIT);
- if (err >= 0)
- err = 0;
g_free(msg->data);
g_free(msg);
@@ -188,6 +186,7 @@ static near_bool_t handover_read_cfg_records(int client_fd,
struct hr_ndef *ndef;
int bytes_recv;
int ndef_size;
+ int err;
ndef = g_hash_table_lookup(hr_ndef_hash, GINT_TO_POINTER(client_fd));
if (ndef == NULL) {
@@ -248,7 +247,13 @@ static near_bool_t handover_read_cfg_records(int client_fd,
if (ndef->extra_ndef_count == 0) {
/* All the bytes are read so now, parse the frame */
- handover_ndef_parse(client_fd, ndef);
+ err = handover_ndef_parse(client_fd, ndef);
+ if (err > 0) {
+ /* clean memory */
+ handover_close(client_fd, 0);
+ return TRUE;
+ }
+
return FALSE;
}
diff --git a/plugins/p2p.c b/plugins/p2p.c
index a7236ea..fa1930f 100644
--- a/plugins/p2p.c
+++ b/plugins/p2p.c
@@ -91,12 +91,6 @@ static gboolean p2p_client_event(GIOChannel *channel, GIOCondition condition,
client_data->target_idx,
client_data->cb);
- if (more == FALSE) {
- if (client_data->driver->close != NULL)
- client_data->driver->close(client_data->fd, 0);
- close(client_data->fd);
- }
-
return more;
}