You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by jp...@apache.org on 2014/01/02 18:00:30 UTC
[1/3] git commit: TS-2271: Change the OpenSSL init + callbacks to use
raw pthread functions
Updated Branches:
refs/heads/master 74af2183c -> 551bac5cd
TS-2271: Change the OpenSSL init + callbacks to use raw pthread functions
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/698db8bf
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/698db8bf
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/698db8bf
Branch: refs/heads/master
Commit: 698db8bfbb26b0004651df79f1fc51618604bb11
Parents: 74af218
Author: Heikki Hannikainen <he...@hes.iki.fi>
Authored: Mon Dec 30 12:29:52 2013 +0200
Committer: James Peach <jp...@apache.org>
Committed: Thu Jan 2 08:39:00 2014 -0800
----------------------------------------------------------------------
iocore/net/SSLUtils.cc | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/698db8bf/iocore/net/SSLUtils.cc
----------------------------------------------------------------------
diff --git a/iocore/net/SSLUtils.cc b/iocore/net/SSLUtils.cc
index 5ddbc52..45682ef 100644
--- a/iocore/net/SSLUtils.cc
+++ b/iocore/net/SSLUtils.cc
@@ -81,7 +81,7 @@ struct ssl_ticket_key_t
};
static int ssl_session_ticket_index = 0;
-static ProxyMutex ** sslMutexArray;
+static pthread_mutex_t *mutex_buf = NULL;
static bool open_ssl_initialized = false;
struct ats_file_bio
@@ -106,11 +106,15 @@ private:
ats_file_bio& operator=(const ats_file_bio&);
};
+/* Using pthread thread ID and mutex functions directly, instead of
+ * ATS this_ethread / ProxyMutex, so that other linked libraries
+ * may use pthreads and openssl without confusing us here. (TS-2271).
+ */
+
static unsigned long
SSL_pthreads_thread_id()
{
- EThread *eth = this_ethread();
- return (unsigned long) (eth->id);
+ return (unsigned long)pthread_self();
}
static void
@@ -119,9 +123,9 @@ SSL_locking_callback(int mode, int type, const char * /* file ATS_UNUSED */, int
ink_assert(type < CRYPTO_num_locks());
if (mode & CRYPTO_LOCK) {
- MUTEX_TAKE_LOCK(sslMutexArray[type], this_ethread());
+ pthread_mutex_lock(&mutex_buf[type]);
} else if (mode & CRYPTO_UNLOCK) {
- MUTEX_UNTAKE_LOCK(sslMutexArray[type], this_ethread());
+ pthread_mutex_unlock(&mutex_buf[type]);
} else {
Debug("ssl", "invalid SSL locking mode 0x%x", mode);
ink_assert(0);
@@ -298,10 +302,10 @@ SSLInitializeLibrary()
SSL_load_error_strings();
SSL_library_init();
- sslMutexArray = (ProxyMutex **) OPENSSL_malloc(CRYPTO_num_locks() * sizeof(ProxyMutex *));
+ mutex_buf = (pthread_mutex_t *) OPENSSL_malloc(CRYPTO_num_locks() * sizeof(pthread_mutex_t));
for (int i = 0; i < CRYPTO_num_locks(); i++) {
- sslMutexArray[i] = new_ProxyMutex();
+ pthread_mutex_init(&mutex_buf[i], NULL);
}
CRYPTO_set_locking_callback(SSL_locking_callback);
[3/3] git commit: TS-2271: update CHANGES
Posted by jp...@apache.org.
TS-2271: update CHANGES
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/551bac5c
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/551bac5c
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/551bac5c
Branch: refs/heads/master
Commit: 551bac5cdb2737ed176fd18777027d80a127fb99
Parents: d706b7d
Author: James Peach <jp...@apache.org>
Authored: Thu Jan 2 08:42:29 2014 -0800
Committer: James Peach <jp...@apache.org>
Committed: Thu Jan 2 08:42:29 2014 -0800
----------------------------------------------------------------------
CHANGES | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/551bac5c/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 8599e7d..9d68599 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,9 @@
-*- coding: utf-8 -*-
Changes with Apache Traffic Server 4.2.0
+ *) [TS-2271] Threaded plugin support with 3rd party libraries.
+ Author: Heikki Hannikainen <he...@hes.iki.fi>
+
*) [TS-2464] Remove useless and buggy connection header handling
*) [TS-2457] Protocol.c: change usage of atoi to strtol.
[2/3] git commit: TS-2271: Let TSHttpTxnReenable work gracefully when
it's called from an unexpected thread (this_ethread() returns NULL).
Posted by jp...@apache.org.
TS-2271: Let TSHttpTxnReenable work gracefully when it's called from an unexpected thread (this_ethread() returns NULL).
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/d706b7d6
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/d706b7d6
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/d706b7d6
Branch: refs/heads/master
Commit: d706b7d6478ff8b5a37b1422b3ad45739c10a5e9
Parents: 698db8b
Author: Heikki Hannikainen <he...@hes.iki.fi>
Authored: Mon Dec 30 17:42:23 2013 +0200
Committer: James Peach <jp...@apache.org>
Committed: Thu Jan 2 08:39:01 2014 -0800
----------------------------------------------------------------------
proxy/InkAPI.cc | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d706b7d6/proxy/InkAPI.cc
----------------------------------------------------------------------
diff --git a/proxy/InkAPI.cc b/proxy/InkAPI.cc
index 1e8ecdf..cb31e6d 100644
--- a/proxy/InkAPI.cc
+++ b/proxy/InkAPI.cc
@@ -5516,10 +5516,14 @@ TSHttpTxnReenable(TSHttpTxn txnp, TSEvent event)
HttpSM *sm = (HttpSM *) txnp;
EThread *eth = this_ethread();
+ // TS-2271: If this function is being executed on a thread which was not
+ // created using the ATS EThread API, eth will be NULL, and the
+ // continuation needs to be called back on a REGULAR thread.
+ //
// If this function is being executed on a thread created by the API
// which is DEDICATED, the continuation needs to be called back on a
// REGULAR thread.
- if (eth->tt != REGULAR) {
+ if (eth == NULL || eth->tt != REGULAR) {
eventProcessor.schedule_imm(NEW(new TSHttpSMCallback(sm, event)), ET_NET);
} else {
MUTEX_TRY_LOCK(trylock, sm->mutex, eth);