netwerk/socket/nsUDPSocketProvider.cpp

Thu, 15 Jan 2015 15:55:04 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:55:04 +0100
branch
TOR_BUG_9701
changeset 9
a63d609f5ebe
permissions
-rw-r--r--

Back out 97036ab72558 which inappropriately compared turds to third parties.

     1 /* This Source Code Form is subject to the terms of the Mozilla Public
     2  * License, v. 2.0. If a copy of the MPL was not distributed with this
     3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     5 #include "nsUDPSocketProvider.h"
     7 #include "nspr.h"
     9 NS_IMPL_ISUPPORTS(nsUDPSocketProvider, nsISocketProvider)
    11 nsUDPSocketProvider::~nsUDPSocketProvider()
    12 {
    13 }
    15 NS_IMETHODIMP 
    16 nsUDPSocketProvider::NewSocket(int32_t aFamily,
    17                                const char *aHost, 
    18                                int32_t aPort, 
    19                                nsIProxyInfo *aProxy,
    20                                uint32_t aFlags,
    21                                PRFileDesc * *aFileDesc, 
    22                                nsISupports **aSecurityInfo)
    23 {
    24     NS_ENSURE_ARG_POINTER(aFileDesc);
    26     PRFileDesc* udpFD = PR_OpenUDPSocket(aFamily);
    27     if (!udpFD)
    28         return NS_ERROR_FAILURE;
    30     *aFileDesc = udpFD;
    31     return NS_OK;
    32 }
    34 NS_IMETHODIMP 
    35 nsUDPSocketProvider::AddToSocket(int32_t aFamily,
    36                                  const char *aHost,
    37                                  int32_t aPort,
    38                                  nsIProxyInfo *aProxy,
    39                                  uint32_t aFlags,
    40                                  struct PRFileDesc * aFileDesc,
    41                                  nsISupports **aSecurityInfo)
    42 {
    43     // does not make sense to strap a UDP socket onto an existing socket
    44     NS_NOTREACHED("Cannot layer UDP socket on an existing socket");
    45     return NS_ERROR_UNEXPECTED;
    46 }

mercurial