Skip to content

Commit

Permalink
Reorder args in constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
coleaeason committed Sep 1, 2018
1 parent c0642d7 commit e0db12e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
26 changes: 13 additions & 13 deletions libstuff/SHTTPSManager.cpp
Expand Up @@ -83,21 +83,21 @@ void SHTTPSManager::postPoll(fd_map& fdm, uint64_t& nextActivity, list<SHTTPSMan
STCPManager::postPoll(fdm);

// Update each of the active requests
uint64_t now = STimeNow();
uint64_t timeout = timeoutMS * 1000;
list<Transaction*>::iterator nextIt = _activeTransactionList.begin();
while (nextIt != _activeTransactionList.end()) {
// Did we get any responses?
list<Transaction*>::iterator activeIt = nextIt++;
Transaction* active = *activeIt;
// if (active->isDelayedSend && !active->sentTime) {
// // This transaction was created, queued, and then meant to be sent later.
// // As such we'll use STimeNow() as it's "created" time for time.
// SINFO("Transaction is marked for delayed sending, setting sentTime for timeout.");
// active->sentTime = STimeNow();
// }
//uint64_t timeoutFromTime = active->sentTime ? active->sentTime : active->created;
uint64_t elapsed = now - active->created;
if (active->isDelayedSend && !active->sentTime) {
// This transaction was created, queued, and then meant to be sent later.
// As such we'll use STimeNow() as it's "created" time for time.
SINFO("Transaction is marked for delayed sending, setting sentTime for timeout.");
active->sentTime = STimeNow();
}
uint64_t timeoutFromTime = active->sentTime ? active->sentTime : active->created;
uint64_t now = STimeNow();
uint64_t elapsed = now - timeoutFromTime;
int size = active->fullResponse.deserialize(active->s->recvBuffer);
if (size) {
// Consume how much we read.
Expand Down Expand Up @@ -127,7 +127,7 @@ void SHTTPSManager::postPoll(fd_map& fdm, uint64_t& nextActivity, list<SHTTPSMan
}
} else {
// Haven't timed out yet, let the caller know how long until we do.
nextActivity = min(nextActivity, active->created + timeout);
nextActivity = min(nextActivity, timeoutFromTime + timeout);
}

// If we're done, remove from the active and add to completed
Expand All @@ -146,10 +146,10 @@ SHTTPSManager::Transaction::Transaction(SHTTPSManager& owner_) :
s(nullptr),
created(STimeNow()),
finished(0),
//sentTime(0),
response(0),
owner(owner_)
//isDelayedSend(false)
owner(owner_),
isDelayedSend(0),
sentTime(0)
{ }

SHTTPSManager::Transaction::~Transaction() {
Expand Down
4 changes: 2 additions & 2 deletions libstuff/SHTTPSManager.h
Expand Up @@ -11,13 +11,13 @@ class SHTTPSManager : public STCPManager {
STCPManager::Socket* s;
uint64_t created;
uint64_t finished;
//uint64_t sentTime;
SData fullRequest;
SData fullResponse;
int response;
STable values;
SHTTPSManager& owner;
//bool isDelayedSend;
bool isDelayedSend;
uint64_t sentTime;
};

// Constructor/Destructor
Expand Down

0 comments on commit e0db12e

Please sign in to comment.