Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 340949
b: refs/heads/master
c: e690408
h: refs/heads/master
i:
  340947: 9ab5da2
v: v3
  • Loading branch information
Samuel Ortiz committed Oct 26, 2012
1 parent 64a7279 commit 0169ade
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 984d334f28c6a93231fe9de3ec42717469e90d4c
refs/heads/master: e6904081dd2ff22b861d976810a55322b5aece82
46 changes: 40 additions & 6 deletions trunk/net/nfc/llcp/llcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1071,20 +1071,54 @@ static void nfc_llcp_recv_snl(struct nfc_llcp_local *local,
service_name = (char *) &tlv[3];
service_name_len = length - 1;

pr_debug("Looking for %s\n", service_name);
pr_debug("Looking for %.16s\n", service_name);

if (service_name_len == strlen("urn:nfc:sn:sdp") &&
!strncmp(service_name, "urn:nfc:sn:sdp",
service_name_len)) {
sap = 1;
goto send_snl;
}

llcp_sock = nfc_llcp_sock_from_sn(local, service_name,
service_name_len);
if (!llcp_sock) {
sap = 0;
goto send_snl;
}

/*
* We found a socket but its ssap has not been reserved
* yet. We need to assign it for good and send a reply.
* The ssap will be freed when the socket is closed.
*/
if (llcp_sock->ssap == LLCP_SDP_UNBOUND) {
atomic_t *client_count;

sap = nfc_llcp_reserve_sdp_ssap(local);

pr_debug("Reserving %d\n", sap);

if (sap == LLCP_SAP_MAX) {
sap = 0;
goto send_snl;
}

client_count =
&local->local_sdp_cnt[sap -
LLCP_WKS_NUM_SAP];

atomic_inc(client_count);

llcp_sock->ssap = sap;
llcp_sock->reserved_ssap = sap;
} else {
llcp_sock =
nfc_llcp_sock_from_sn(local,
service_name,
service_name_len);
sap = llcp_sock ? llcp_sock->ssap : 0;
sap = llcp_sock->ssap;
}

pr_debug("%p %d\n", llcp_sock, sap);

send_snl:
nfc_llcp_send_snl(local, tid, sap);
break;

Expand Down

0 comments on commit 0169ade

Please sign in to comment.