Skip to content

Commit

Permalink
General Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
phi2039 committed Feb 5, 2012
1 parent 056dc6d commit 7121b73
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion libxafp.xcodeproj/project.pbxproj
Expand Up @@ -140,12 +140,12 @@
83D4CE8D140AAD0B00C157C2 /* src */ = {
isa = PBXGroup;
children = (
83FDFD0714DD881100863CA3 /* Manager */,
83A861A1142652FB000B8F90 /* Interface */,
83D4D47A1415594300C157C2 /* Common */,
83D4CEC1140AAFFB00C157C2 /* AFP */,
83D4CEC0140AAFF500C157C2 /* DSI */,
83D4CEBF140AAFED00C157C2 /* TCP */,
83FDFD0714DD881100863CA3 /* Manager */,
83A861AE142654E0000B8F90 /* Threading */,
);
name = src;
Expand Down
2 changes: 1 addition & 1 deletion src/DSIClient.cpp
Expand Up @@ -298,6 +298,7 @@ CDSISession::~CDSISession()
}

////TEMP
// TODO: FIXME!
void init_request(DSIRequest& req, CDSIBuffer* pBuf)
{
req.pEvent = new CThreadSyncEvent();
Expand Down Expand Up @@ -606,7 +607,6 @@ void CDSISession::OnReceive(CTCPPacketReader& reader)
}
}

// TODO: Global var == NoNo...
void CDSISession::OnAttention(uint16_t attData)
{
XAFP_LOG_0(XAFP_LOG_FLAG_INFO, "DSI Protocol: ATTENTION!!");
Expand Down
10 changes: 5 additions & 5 deletions src/SessionManager.cpp
Expand Up @@ -65,23 +65,23 @@ _client_context* CSessionManager::GetContext(const char* pHost, unsigned int por
std::pair<context_map::iterator,context_map::iterator> range = m_Contexts.equal_range(lookupId);
for (context_map::iterator it = range.first; it != range.second; ++it)
{
XAFP_LOG(XAFP_LOG_FLAG_SESS_MGR, "Session Manager: Reusing context [%s]", lookupId.c_str());
// If this one is idle, use it...
if (it->second.isIdle)
{
XAFP_LOG(XAFP_LOG_FLAG_SESS_MGR, "Session Manager: Reusing context [%s, 0x%08x]", lookupId.c_str(), it->second.ctx);
it->second.isIdle = false; // No longer idle...
// TODO: Do we need to verify that the connection is good...?
return it->second.ctx; // We are done.
}
}

// No open and/or idle contexts were found. Create a new one.
XAFP_LOG(XAFP_LOG_FLAG_INFO, "Session Manager: Creating new context [%s]", lookupId.c_str());
_client_context* ctx = xafp_create_context(pHost, port, pUser, pPass);

// Add the new context to the map
context_record rec = {ctx, false, 0, time(NULL)};
m_Contexts.insert(std::pair<context_id,context_record>(lookupId, rec));
XAFP_LOG(XAFP_LOG_FLAG_INFO, "Session Manager: Created new context [%s, 0x%08x] - count: %d", lookupId.c_str(), ctx, m_Contexts.size());

return ctx;
}
Expand All @@ -96,7 +96,7 @@ void CSessionManager::FreeContext(_client_context* pCtx)
// Once we find it, free it up
if (it->second.ctx == pCtx)
{
XAFP_LOG(XAFP_LOG_FLAG_SESS_MGR, "Session Manager: Freeing context [%s]", it->first.c_str());
XAFP_LOG(XAFP_LOG_FLAG_SESS_MGR, "Session Manager: Freeing context [%s, 0x%08x]", it->first.c_str(), pCtx);
it->second.isIdle = true;
}
}
Expand All @@ -110,7 +110,7 @@ int CSessionManager::MonitorThreadProc()

while (true)
{
// TODO: Use wait with timeout instead of sleep, so that we can trigger a speedy exit...
// TODO: Use wait with timeout instead of sleep, so that we can trigger a speedier exit...
sleep(1);

if (m_MonitorThreadQuitFlag)
Expand Down Expand Up @@ -138,7 +138,7 @@ int CSessionManager::MonitorThreadProc()
if (rec.idleTime >= m_SessionTimeout)
{
// Remove the record from the map, and stage the context for deletion
XAFP_LOG(XAFP_LOG_FLAG_INFO, "Session Manager: Removing expired context [%s]", it->first.c_str());
XAFP_LOG(XAFP_LOG_FLAG_INFO, "Session Manager: Removing expired context [%s, 0x%08x] - count %d", it->first.c_str(), rec.ctx, m_Contexts.size());
staleContexts.push_back(rec.ctx);
m_Contexts.erase(it);
}
Expand Down

0 comments on commit 7121b73

Please sign in to comment.