[asterisk-commits] bebuild: tag certified-1.8.15-cert7 r416104 - in /certified/tags/1.8.15-cert7...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jun 13 00:28:54 CDT 2014


Author: bebuild
Date: Fri Jun 13 00:28:50 2014
New Revision: 416104

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=416104
Log:
Merge fix for regression caused by fix for AST-2014-007

Modified:
    certified/tags/1.8.15-cert7/   (props changed)
    certified/tags/1.8.15-cert7/channels/chan_sip.c
    certified/tags/1.8.15-cert7/include/asterisk/tcptls.h
    certified/tags/1.8.15-cert7/main/http.c
    certified/tags/1.8.15-cert7/main/manager.c
    certified/tags/1.8.15-cert7/main/tcptls.c

Propchange: certified/tags/1.8.15-cert7/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Jun 13 00:28:50 2014
@@ -1,3 +1,3 @@
 /branches/1.8:371919
 /certified/branches/1.8.11:376302
-/certified/branches/1.8.15:397754,397761,403858,403914,410358,410427,415972
+/certified/branches/1.8.15:397754,397761,403858,403914,410358,410427,415972,416087

Modified: certified/tags/1.8.15-cert7/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/certified/tags/1.8.15-cert7/channels/chan_sip.c?view=diff&rev=416104&r1=416103&r2=416104
==============================================================================
--- certified/tags/1.8.15-cert7/channels/chan_sip.c (original)
+++ certified/tags/1.8.15-cert7/channels/chan_sip.c Fri Jun 13 00:28:50 2014
@@ -2614,6 +2614,12 @@
 		goto cleanup;
 	}
 
+	/*
+	 * We cannot let the stream exclusively wait for data to arrive.
+	 * We have to wake up the task to send outgoing messages.
+	 */
+	ast_tcptls_stream_set_exclusive_input(tcptls_session->stream_cookie, 0);
+
 	ast_tcptls_stream_set_timeout_sequence(tcptls_session->stream_cookie, ast_tvnow(),
 		tcptls_session->client ? -1 : (authtimeout * 1000));
 

Modified: certified/tags/1.8.15-cert7/include/asterisk/tcptls.h
URL: http://svnview.digium.com/svn/asterisk/certified/tags/1.8.15-cert7/include/asterisk/tcptls.h?view=diff&rev=416104&r1=416103&r2=416104
==============================================================================
--- certified/tags/1.8.15-cert7/include/asterisk/tcptls.h (original)
+++ certified/tags/1.8.15-cert7/include/asterisk/tcptls.h Fri Jun 13 00:28:50 2014
@@ -181,6 +181,20 @@
  */
 void ast_tcptls_stream_set_timeout_sequence(struct ast_tcptls_stream *stream, struct timeval start, int timeout);
 
+/*!
+ * \brief Set the TCP/TLS stream I/O if it can exclusively depend upon the set timeouts.
+ *
+ * \param stream TCP/TLS stream control data.
+ * \param exclusive_input TRUE if stream can exclusively wait for fd input.
+ * Otherwise, the stream will not wait for fd input.  It will wait while
+ * trying to send data.
+ *
+ * \note The stream timeouts still need to be set.
+ *
+ * \return Nothing
+ */
+void ast_tcptls_stream_set_exclusive_input(struct ast_tcptls_stream *stream, int exclusive_input);
+
 /*
  * describes a server instance
  */

Modified: certified/tags/1.8.15-cert7/main/http.c
URL: http://svnview.digium.com/svn/asterisk/certified/tags/1.8.15-cert7/main/http.c?view=diff&rev=416104&r1=416103&r2=416104
==============================================================================
--- certified/tags/1.8.15-cert7/main/http.c (original)
+++ certified/tags/1.8.15-cert7/main/http.c Fri Jun 13 00:28:50 2014
@@ -894,6 +894,9 @@
 	flags = fcntl(ser->fd, F_GETFL);
 	flags |= O_NONBLOCK;
 	fcntl(ser->fd, F_SETFL, flags);
+
+	/* We can let the stream wait for data to arrive. */
+	ast_tcptls_stream_set_exclusive_input(ser->stream_cookie, 1);
 
 	ast_tcptls_stream_set_timeout_inactivity(ser->stream_cookie, session_inactivity);
 

Modified: certified/tags/1.8.15-cert7/main/manager.c
URL: http://svnview.digium.com/svn/asterisk/certified/tags/1.8.15-cert7/main/manager.c?view=diff&rev=416104&r1=416103&r2=416104
==============================================================================
--- certified/tags/1.8.15-cert7/main/manager.c (original)
+++ certified/tags/1.8.15-cert7/main/manager.c Fri Jun 13 00:28:50 2014
@@ -5029,6 +5029,12 @@
 	}
 	ao2_unlock(session);
 
+	/*
+	 * We cannot let the stream exclusively wait for data to arrive.
+	 * We have to wake up the task to send async events.
+	 */
+	ast_tcptls_stream_set_exclusive_input(ser->stream_cookie, 0);
+
 	ast_tcptls_stream_set_timeout_sequence(ser->stream_cookie,
 		ast_tvnow(), authtimeout * 1000);
 

Modified: certified/tags/1.8.15-cert7/main/tcptls.c
URL: http://svnview.digium.com/svn/asterisk/certified/tags/1.8.15-cert7/main/tcptls.c?view=diff&rev=416104&r1=416103&r2=416104
==============================================================================
--- certified/tags/1.8.15-cert7/main/tcptls.c (original)
+++ certified/tags/1.8.15-cert7/main/tcptls.c Fri Jun 13 00:28:50 2014
@@ -77,6 +77,8 @@
 	 * feature to work correctly.
 	 */
 	int timeout;
+	/*! TRUE if stream can exclusively wait for fd input. */
+	int exclusive_input;
 };
 
 void ast_tcptls_stream_set_timeout_disable(struct ast_tcptls_stream *stream)
@@ -100,6 +102,13 @@
 
 	stream->start = start;
 	stream->timeout = timeout;
+}
+
+void ast_tcptls_stream_set_exclusive_input(struct ast_tcptls_stream *stream, int exclusive_input)
+{
+	ast_assert(stream != NULL);
+
+	stream->exclusive_input = exclusive_input;
 }
 
 /*!
@@ -151,6 +160,11 @@
 				ast_debug(1, "TLS clean shutdown alert reading data\n");
 				return 0;
 			case SSL_ERROR_WANT_READ:
+				if (!stream->exclusive_input) {
+					/* We cannot wait for data now. */
+					errno = EAGAIN;
+					return -1;
+				}
 				while ((ms = ast_remaining_ms(start, stream->timeout))) {
 					res = ast_wait_for_input(stream->fd, ms);
 					if (0 < res) {
@@ -202,7 +216,8 @@
 
 	for (;;) {
 		res = read(stream->fd, buf, size);
-		if (0 <= res) {
+		if (0 <= res || !stream->exclusive_input) {
+			/* Got data or we cannot wait for it. */
 			return res;
 		}
 		if (errno != EINTR && errno != EAGAIN) {




More information about the asterisk-commits mailing list