NFC: Keep connection less bound sockets alive when DEP link goes down
authorSamuel Ortiz <sameo@linux.intel.com>
Mon, 15 Oct 2012 13:09:52 +0000 (15:09 +0200)
committerSamuel Ortiz <sameo@linux.intel.com>
Fri, 26 Oct 2012 16:26:50 +0000 (18:26 +0200)
When DEP goes down, bound cl sockets can be kept alive as there is no
reason to kill a connection less server socket because the LLCP link
went down.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
net/nfc/llcp/llcp.c

index ee01be17e21f708e80d5904de74fcb910c6963a1..7f92a857b31965d6900a09d69098d02a8ba0ea10 100644 (file)
@@ -85,6 +85,16 @@ static void nfc_llcp_socket_release(struct nfc_llcp_local *local, bool listen)
                        }
                }
 
+               /*
+                * If we have a connection less socket bound, we keep it alive
+                * if the device is still present.
+                */
+               if (sk->sk_state == LLCP_BOUND && sk->sk_type == SOCK_DGRAM &&
+                   listen == true) {
+                       bh_unlock_sock(sk);
+                       continue;
+               }
+
                sk->sk_state = LLCP_CLOSED;
 
                bh_unlock_sock(sk);