Rename some things for consistency.

We usually use read/write rather than recv/send to describe the two
sides.

Change-Id: Ie3ac8c52c59ea9a5143f56b894f58cecd351dc7d
Reviewed-on: https://boringssl-review.googlesource.com/21304
Commit-Queue: David Benjamin <davidben@google.com>
CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
Reviewed-by: Steven Valdez <svaldez@google.com>
diff --git a/ssl/d1_pkt.cc b/ssl/d1_pkt.cc
index d9496d9..92a9663 100644
--- a/ssl/d1_pkt.cc
+++ b/ssl/d1_pkt.cc
@@ -130,7 +130,7 @@
 
 int dtls1_get_record(SSL *ssl) {
 again:
-  switch (ssl->s3->recv_shutdown) {
+  switch (ssl->s3->read_shutdown) {
     case ssl_shutdown_none:
       break;
     case ssl_shutdown_fatal_alert:
@@ -291,8 +291,8 @@
   // alerts also aren't delivered reliably, so we may even time out because the
   // peer never received our close_notify. Report to the caller that the channel
   // has fully shut down.
-  if (ssl->s3->recv_shutdown == ssl_shutdown_none) {
-    ssl->s3->recv_shutdown = ssl_shutdown_close_notify;
+  if (ssl->s3->read_shutdown == ssl_shutdown_none) {
+    ssl->s3->read_shutdown = ssl_shutdown_close_notify;
   }
 }
 
diff --git a/ssl/internal.h b/ssl/internal.h
index 36d3390..93864ac 100644
--- a/ssl/internal.h
+++ b/ssl/internal.h
@@ -1754,12 +1754,11 @@
   int wpend_ret;  // number of bytes submitted
   const uint8_t *wpend_buf;
 
-  // recv_shutdown is the shutdown state for the receive half of the
-  // connection.
-  enum ssl_shutdown_t recv_shutdown;
+  // read_shutdown is the shutdown state for the read half of the connection.
+  enum ssl_shutdown_t read_shutdown;
 
-  // recv_shutdown is the shutdown state for the send half of the connection.
-  enum ssl_shutdown_t send_shutdown;
+  // write_shutdown is the shutdown state for the write half of the connection.
+  enum ssl_shutdown_t write_shutdown;
 
   int alert_dispatch;
 
diff --git a/ssl/s3_pkt.cc b/ssl/s3_pkt.cc
index 48de23f..8911c98 100644
--- a/ssl/s3_pkt.cc
+++ b/ssl/s3_pkt.cc
@@ -131,7 +131,7 @@
 // more data is needed.
 static int ssl3_get_record(SSL *ssl) {
 again:
-  switch (ssl->s3->recv_shutdown) {
+  switch (ssl->s3->read_shutdown) {
     case ssl_shutdown_none:
       break;
     case ssl_shutdown_fatal_alert:
@@ -536,17 +536,17 @@
 
 int ssl3_send_alert(SSL *ssl, int level, int desc) {
   // It is illegal to send an alert when we've already sent a closing one.
-  if (ssl->s3->send_shutdown != ssl_shutdown_none) {
+  if (ssl->s3->write_shutdown != ssl_shutdown_none) {
     OPENSSL_PUT_ERROR(SSL, SSL_R_PROTOCOL_IS_SHUTDOWN);
     return -1;
   }
 
   if (level == SSL3_AL_WARNING && desc == SSL_AD_CLOSE_NOTIFY) {
-    ssl->s3->send_shutdown = ssl_shutdown_close_notify;
+    ssl->s3->write_shutdown = ssl_shutdown_close_notify;
   } else {
     assert(level == SSL3_AL_FATAL);
     assert(desc != SSL_AD_CLOSE_NOTIFY);
-    ssl->s3->send_shutdown = ssl_shutdown_fatal_alert;
+    ssl->s3->write_shutdown = ssl_shutdown_fatal_alert;
   }
 
   ssl->s3->alert_dispatch = 1;
diff --git a/ssl/ssl_lib.cc b/ssl/ssl_lib.cc
index 89eb6fe..528263d 100644
--- a/ssl/ssl_lib.cc
+++ b/ssl/ssl_lib.cc
@@ -978,7 +978,7 @@
     return -1;
   }
 
-  if (ssl->s3->send_shutdown != ssl_shutdown_none) {
+  if (ssl->s3->write_shutdown != ssl_shutdown_none) {
     OPENSSL_PUT_ERROR(SSL, SSL_R_PROTOCOL_IS_SHUTDOWN);
     return -1;
   }
@@ -1021,8 +1021,8 @@
 
   if (ssl->quiet_shutdown) {
     // Do nothing if configured not to send a close_notify.
-    ssl->s3->send_shutdown = ssl_shutdown_close_notify;
-    ssl->s3->recv_shutdown = ssl_shutdown_close_notify;
+    ssl->s3->write_shutdown = ssl_shutdown_close_notify;
+    ssl->s3->read_shutdown = ssl_shutdown_close_notify;
     return 1;
   }
 
@@ -1030,7 +1030,7 @@
   // waits for a close_notify to come in. Perform exactly one action and return
   // whether or not it succeeds.
 
-  if (ssl->s3->send_shutdown != ssl_shutdown_close_notify) {
+  if (ssl->s3->write_shutdown != ssl_shutdown_close_notify) {
     // Send a close_notify.
     if (ssl3_send_alert(ssl, SSL3_AL_WARNING, SSL_AD_CLOSE_NOTIFY) <= 0) {
       return -1;
@@ -1040,16 +1040,16 @@
     if (ssl->method->dispatch_alert(ssl) <= 0) {
       return -1;
     }
-  } else if (ssl->s3->recv_shutdown != ssl_shutdown_close_notify) {
+  } else if (ssl->s3->read_shutdown != ssl_shutdown_close_notify) {
     // Wait for the peer's close_notify.
     ssl->method->read_close_notify(ssl);
-    if (ssl->s3->recv_shutdown != ssl_shutdown_close_notify) {
+    if (ssl->s3->read_shutdown != ssl_shutdown_close_notify) {
       return -1;
     }
   }
 
   // Return 0 for unidirectional shutdown and 1 for bidirectional shutdown.
-  return ssl->s3->recv_shutdown == ssl_shutdown_close_notify;
+  return ssl->s3->read_shutdown == ssl_shutdown_close_notify;
 }
 
 int SSL_send_fatal_alert(SSL *ssl, uint8_t alert) {
@@ -1137,7 +1137,7 @@
   }
 
   if (ret_code == 0) {
-    if (ssl->s3->recv_shutdown == ssl_shutdown_close_notify) {
+    if (ssl->s3->read_shutdown == ssl_shutdown_close_notify) {
       return SSL_ERROR_ZERO_RETURN;
     }
     // An EOF was observed which violates the protocol, and the underlying
@@ -2091,24 +2091,24 @@
   assert((SSL_get_shutdown(ssl) & mode) == SSL_get_shutdown(ssl));
 
   if (mode & SSL_RECEIVED_SHUTDOWN &&
-      ssl->s3->recv_shutdown == ssl_shutdown_none) {
-    ssl->s3->recv_shutdown = ssl_shutdown_close_notify;
+      ssl->s3->read_shutdown == ssl_shutdown_none) {
+    ssl->s3->read_shutdown = ssl_shutdown_close_notify;
   }
 
   if (mode & SSL_SENT_SHUTDOWN &&
-      ssl->s3->send_shutdown == ssl_shutdown_none) {
-    ssl->s3->send_shutdown = ssl_shutdown_close_notify;
+      ssl->s3->write_shutdown == ssl_shutdown_none) {
+    ssl->s3->write_shutdown = ssl_shutdown_close_notify;
   }
 }
 
 int SSL_get_shutdown(const SSL *ssl) {
   int ret = 0;
-  if (ssl->s3->recv_shutdown != ssl_shutdown_none) {
+  if (ssl->s3->read_shutdown != ssl_shutdown_none) {
     // Historically, OpenSSL set |SSL_RECEIVED_SHUTDOWN| on both close_notify
     // and fatal alert.
     ret |= SSL_RECEIVED_SHUTDOWN;
   }
-  if (ssl->s3->send_shutdown == ssl_shutdown_close_notify) {
+  if (ssl->s3->write_shutdown == ssl_shutdown_close_notify) {
     // Historically, OpenSSL set |SSL_SENT_SHUTDOWN| on only close_notify.
     ret |= SSL_SENT_SHUTDOWN;
   }
diff --git a/ssl/tls_record.cc b/ssl/tls_record.cc
index b70e4f5..73a8869 100644
--- a/ssl/tls_record.cc
+++ b/ssl/tls_record.cc
@@ -535,7 +535,7 @@
 
   if (alert_level == SSL3_AL_WARNING) {
     if (alert_descr == SSL_AD_CLOSE_NOTIFY) {
-      ssl->s3->recv_shutdown = ssl_shutdown_close_notify;
+      ssl->s3->read_shutdown = ssl_shutdown_close_notify;
       return ssl_open_record_close_notify;
     }
 
@@ -557,7 +557,7 @@
   }
 
   if (alert_level == SSL3_AL_FATAL) {
-    ssl->s3->recv_shutdown = ssl_shutdown_fatal_alert;
+    ssl->s3->read_shutdown = ssl_shutdown_fatal_alert;
 
     char tmp[16];
     OPENSSL_PUT_ERROR(SSL, SSL_AD_REASON_OFFSET + alert_descr);