stream: Eliminate pstream_set_dscp().
[cascardo/ovs.git] / lib / stream-ssl.c
index dd40010..c2ace71 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014 Nicira, Inc.
+ * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Nicira, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -45,7 +45,7 @@
 #include "stream-provider.h"
 #include "stream.h"
 #include "timeval.h"
-#include "vlog.h"
+#include "openvswitch/vlog.h"
 
 #ifdef _WIN32
 /* Ref: https://www.openssl.org/support/faq.html#PROG2
@@ -218,26 +218,10 @@ want_to_poll_events(int want)
     }
 }
 
-static int
-setsockopt_tcp_nodelay(int fd)
-{
-    int on = 1;
-    int retval;
-
-    retval = setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &on, sizeof on);
-    if (retval) {
-        retval = sock_errno();
-        VLOG_ERR("setsockopt(TCP_NODELAY): %s", sock_strerror(retval));
-    }
-    return retval;
-}
-
 static int
 new_ssl_stream(const char *name, int fd, enum session_type type,
                enum ssl_state state, struct stream **streamp)
 {
-    struct sockaddr_storage local;
-    socklen_t local_len = sizeof local;
     struct ssl_stream *sslv;
     SSL *ssl = NULL;
     int retval;
@@ -265,20 +249,11 @@ new_ssl_stream(const char *name, int fd, enum session_type type,
         goto error;
     }
 
-    /* Get the local IP and port information */
-    retval = getsockname(fd, (struct sockaddr *) &local, &local_len);
-    if (retval) {
-        memset(&local, 0, sizeof local);
-    }
-
     /* Disable Nagle.
      * On windows platforms, this can only be called upon TCP connected.
      */
     if (state == STATE_SSL_CONNECTING) {
-        retval = setsockopt_tcp_nodelay(fd);
-        if (retval) {
-            goto error;
-        }
+        setsockopt_tcp_nodelay(fd);
     }
 
     /* Create and configure OpenSSL stream. */
@@ -462,10 +437,7 @@ ssl_connect(struct stream *stream)
             return retval;
         }
         sslv->state = STATE_SSL_CONNECTING;
-        retval = setsockopt_tcp_nodelay(sslv->fd);
-        if (retval) {
-            return retval;
-        }
+        setsockopt_tcp_nodelay(sslv->fd);
         /* Fall through. */
 
     case STATE_SSL_CONNECTING:
@@ -899,13 +871,6 @@ pssl_wait(struct pstream *pstream)
     poll_fd_wait(pssl->fd, POLLIN);
 }
 
-static int
-pssl_set_dscp(struct pstream *pstream, uint8_t dscp)
-{
-    struct pssl_pstream *pssl = pssl_pstream_cast(pstream);
-    return set_dscp(pssl->fd, dscp);
-}
-
 const struct pstream_class pssl_pstream_class = {
     "pssl",
     true,
@@ -913,7 +878,6 @@ const struct pstream_class pssl_pstream_class = {
     pssl_close,
     pssl_accept,
     pssl_wait,
-    pssl_set_dscp,
 };
 \f
 /*