MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / readSession

Method readSession

src/jrd/trace/TraceService.cpp:281–317  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

279}
280
281void TraceSvcJrd::readSession(TraceSession& session)
282{
283 if (session.ses_logfile.empty())
284 {
285 m_svc.printf(false, "Can't open trace data log file");
286 return;
287 }
288
289 MemoryPool& pool = *getDefaultMemoryPool();
290 AutoPtr<TraceLog> log(FB_NEW_POOL(pool) TraceLog(pool, session.ses_logfile, true));
291
292 UCHAR buff[1024];
293 int flags = session.ses_flags;
294 while (!m_svc.finished() && checkAliveAndFlags(session.ses_id, flags))
295 {
296 const FB_SIZE_T len = log->read(buff, sizeof(buff));
297 if (!len)
298 {
299 if (!checkAliveAndFlags(session.ses_id, flags))
300 break;
301
302 if (m_svc.svc_detach_sem.tryEnter(0, 250))
303 break;
304 }
305 else
306 {
307 m_svc.putBytes(buff, len);
308
309 const bool logFull = (flags & trs_log_full);
310 if (logFull && !log->isFull())
311 {
312 // resume session
313 changeFlags(session.ses_id, 0, trs_log_full);
314 }
315 }
316 }
317}
318
319bool TraceSvcJrd::checkAliveAndFlags(ULONG sesId, int& flags)
320{

Callers

nothing calls this directly

Calls 9

getDefaultMemoryPoolFunction · 0.85
TraceLogClass · 0.85
isFullMethod · 0.80
emptyMethod · 0.45
printfMethod · 0.45
finishedMethod · 0.45
readMethod · 0.45
tryEnterMethod · 0.45
putBytesMethod · 0.45

Tested by

no test coverage detected