Bug 1173334: Open nfcd connections with socket type SOCK_SEQPACKET, allstars.chh
authorThomas Zimmermann <tdz@users.sourceforge.net>
Thu, 25 Jun 2015 08:29:04 -0700
changeset 280959 45edcf7858b3e7c3459ca0ce048888453b89b2d7
parent 280958 8c8f3820dec3ada05b47c7c738e52f5a91b5abfc
child 280960 32439523d6c9f59171aa53f0b1808fa805658c4b
push id4932
push userjlund@mozilla.com
push dateMon, 10 Aug 2015 18:23:06 +0000
treeherdermozilla-beta@6dd5a4f5f745 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1173334
milestone41.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1173334: Open nfcd connections with socket type SOCK_SEQPACKET, allstars.chh NFC requires sequential transfer of individual messages. Using the socket type SOCK_SEQPACKET guarantees these properties.
dom/nfc/gonk/NfcService.cpp
ipc/nfc/NfcConnector.cpp
--- a/dom/nfc/gonk/NfcService.cpp
+++ b/dom/nfc/gonk/NfcService.cpp
@@ -448,17 +448,17 @@ NfcService::ReceiveSocketData(
 
 void
 NfcService::OnConnectSuccess(int aIndex)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   switch (aIndex) {
     case LISTEN_SOCKET: {
-        nsCString value("nfcd:-a ");
+        nsCString value("nfcd:-S -a ");
         value.Append(mListenSocketName);
         if (NS_WARN_IF(property_set("ctl.start", value.get()) < 0)) {
           OnConnectError(STREAM_SOCKET);
         }
       }
       break;
     case STREAM_SOCKET:
       /* nothing to do */
--- a/ipc/nfc/NfcConnector.cpp
+++ b/ipc/nfc/NfcConnector.cpp
@@ -18,17 +18,17 @@ NfcConnector::NfcConnector(const nsACStr
 { }
 
 NfcConnector::~NfcConnector()
 { }
 
 nsresult
 NfcConnector::CreateSocket(int& aFd) const
 {
-  aFd = socket(AF_LOCAL, SOCK_STREAM, 0);
+  aFd = socket(AF_LOCAL, SOCK_SEQPACKET, 0);
   if (aFd < 0) {
     NS_WARNING("Could not open NFC socket!");
     return NS_ERROR_FAILURE;
   }
 
   return NS_OK;
 }