You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2015/07/16 17:57:28 UTC
[2/2] trafficserver git commit: clang-format ... Also,
why was there no Jira with these changes?
clang-format ... Also, why was there no Jira with these changes?
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/a7a95706
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/a7a95706
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/a7a95706
Branch: refs/heads/master
Commit: a7a95706f7ac242d09bd14396c6f02ee83b85d2e
Parents: abfe8cd
Author: Leif Hedstrom <zw...@apache.org>
Authored: Thu Jul 16 09:57:19 2015 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Thu Jul 16 09:57:19 2015 -0600
----------------------------------------------------------------------
iocore/hostdb/HostDB.cc | 54 ++++++++++++++++++----------------
iocore/hostdb/I_HostDBProcessor.h | 2 +-
iocore/hostdb/P_HostDBProcessor.h | 3 +-
3 files changed, 31 insertions(+), 28 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a7a95706/iocore/hostdb/HostDB.cc
----------------------------------------------------------------------
diff --git a/iocore/hostdb/HostDB.cc b/iocore/hostdb/HostDB.cc
index df302d7..f0319aa 100644
--- a/iocore/hostdb/HostDB.cc
+++ b/iocore/hostdb/HostDB.cc
@@ -1838,30 +1838,32 @@ HostDBContinuation::iterateEvent(int event, Event *e)
// let's iterate through another record and then reschedule ourself.
if (current_iterate_pos < hostDB.buckets) {
- // do 100 at a time
- int end = min(current_iterate_pos + 100, hostDB.buckets);
- for (; current_iterate_pos < end; ++current_iterate_pos) {
- ProxyMutex *bucket_mutex = hostDB.lock_for_bucket(current_iterate_pos);
- MUTEX_TRY_LOCK_FOR(lock_bucket, bucket_mutex, t, this);
- if (!lock_bucket.is_locked()) {
- // we couldn't get the bucket lock, let's just reschedule and try later.
- Debug("hostdb", "iterateEvent event=%d eventp=%p: reschedule due to not getting bucket mutex", event, e);
- mutex->thread_holding->schedule_in(this, HOST_DB_RETRY_PERIOD);
- return EVENT_CONT;
- }
-
- for (unsigned int l = 0; l < hostDB.levels; ++l) {
- HostDBInfo *r = reinterpret_cast<HostDBInfo*>(hostDB.data + hostDB.level_offset[l] + hostDB.bucketsize[l] * current_iterate_pos);
- if (!r->deleted && !r->failed()) {
- action.continuation->handleEvent(EVENT_INTERVAL, static_cast<void*>(r));
- }
- }
- }
-
- // And reschedule ourselves to pickup the next bucket after HOST_DB_RETRY_PERIOD.
- Debug("hostdb", "iterateEvent event=%d eventp=%p: completed current iteration %d of %d", event, e, current_iterate_pos, hostDB.buckets);
- mutex->thread_holding->schedule_in(this, HOST_DB_ITERATE_PERIOD);
- return EVENT_CONT;
+ // do 100 at a time
+ int end = min(current_iterate_pos + 100, hostDB.buckets);
+ for (; current_iterate_pos < end; ++current_iterate_pos) {
+ ProxyMutex *bucket_mutex = hostDB.lock_for_bucket(current_iterate_pos);
+ MUTEX_TRY_LOCK_FOR(lock_bucket, bucket_mutex, t, this);
+ if (!lock_bucket.is_locked()) {
+ // we couldn't get the bucket lock, let's just reschedule and try later.
+ Debug("hostdb", "iterateEvent event=%d eventp=%p: reschedule due to not getting bucket mutex", event, e);
+ mutex->thread_holding->schedule_in(this, HOST_DB_RETRY_PERIOD);
+ return EVENT_CONT;
+ }
+
+ for (unsigned int l = 0; l < hostDB.levels; ++l) {
+ HostDBInfo *r =
+ reinterpret_cast<HostDBInfo *>(hostDB.data + hostDB.level_offset[l] + hostDB.bucketsize[l] * current_iterate_pos);
+ if (!r->deleted && !r->failed()) {
+ action.continuation->handleEvent(EVENT_INTERVAL, static_cast<void *>(r));
+ }
+ }
+ }
+
+ // And reschedule ourselves to pickup the next bucket after HOST_DB_RETRY_PERIOD.
+ Debug("hostdb", "iterateEvent event=%d eventp=%p: completed current iteration %d of %d", event, e, current_iterate_pos,
+ hostDB.buckets);
+ mutex->thread_holding->schedule_in(this, HOST_DB_ITERATE_PERIOD);
+ return EVENT_CONT;
} else {
Debug("hostdb", "iterateEvent event=%d eventp=%p: completed FINAL iteration %d", event, e, current_iterate_pos);
// if there are no more buckets, then we're done.
@@ -2413,7 +2415,7 @@ struct ShowHostDB : public ShowCont {
}
int
- showAll(int event , Event *e)
+ showAll(int event, Event *e)
{
CHECK_SHOW(begin("HostDB All Records"));
CHECK_SHOW(show("<hr>"));
@@ -2427,7 +2429,7 @@ struct ShowHostDB : public ShowCont {
{
if (event == EVENT_INTERVAL) {
HostDBInfo *r = reinterpret_cast<HostDBInfo *>(e);
- return showOne(r,false,event,e);
+ return showOne(r, false, event, e);
} else if (event == EVENT_DONE) {
return complete(event, e);
} else {
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a7a95706/iocore/hostdb/I_HostDBProcessor.h
----------------------------------------------------------------------
diff --git a/iocore/hostdb/I_HostDBProcessor.h b/iocore/hostdb/I_HostDBProcessor.h
index f5acf1f..ffebfe4 100644
--- a/iocore/hostdb/I_HostDBProcessor.h
+++ b/iocore/hostdb/I_HostDBProcessor.h
@@ -418,7 +418,7 @@ struct HostDBCache;
typedef void (Continuation::*process_hostdb_info_pfn)(HostDBInfo *r);
typedef void (Continuation::*process_srv_info_pfn)(HostDBInfo *r);
- Action *iterate(Continuation *cont);
+Action *iterate(Continuation *cont);
/** The Host Databse access interface. */
struct HostDBProcessor : public Processor {
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a7a95706/iocore/hostdb/P_HostDBProcessor.h
----------------------------------------------------------------------
diff --git a/iocore/hostdb/P_HostDBProcessor.h b/iocore/hostdb/P_HostDBProcessor.h
index 54c938a..5cfa025 100644
--- a/iocore/hostdb/P_HostDBProcessor.h
+++ b/iocore/hostdb/P_HostDBProcessor.h
@@ -538,7 +538,8 @@ struct HostDBContinuation : public Continuation {
HostDBContinuation()
: Continuation(NULL), ttl(0), host_res_style(DEFAULT_OPTIONS.host_res_style), dns_lookup_timeout(DEFAULT_OPTIONS.timeout),
- timeout(0), from(0), from_cont(0), probe_depth(0), current_iterate_pos(0), missing(false), force_dns(DEFAULT_OPTIONS.force_dns), round_robin(false)
+ timeout(0), from(0), from_cont(0), probe_depth(0), current_iterate_pos(0), missing(false),
+ force_dns(DEFAULT_OPTIONS.force_dns), round_robin(false)
{
ink_zero(md5_host_name_store);
ink_zero(md5.hash);