qpid::messaging::Receiver SessionImpl::nextReceiver(qpid::messaging::Duration timeout) { qpid::messaging::Receiver receiver; if (!nextReceiver(receiver, timeout)) throw NoMessageAvailable(); if (!receiver) throw SessionError("Bad receiver returned!"); return receiver; }
SessionImpl& SessionImpl::convert(qpid::messaging::Session& s) { boost::intrusive_ptr<SessionImpl> impl = getImplPtr<qpid::messaging::Session, SessionImpl>(s); if (!impl) { throw SessionError(QPID_MSG("Configuration error; require qpid::client::amqp0_10::SessionImpl")); } return *impl; }
void SessionImpl::rethrow(const qpid::SessionException& e) { switch (e.code) { case framing::execution::ERROR_CODE_NOT_ALLOWED: case framing::execution::ERROR_CODE_UNAUTHORIZED_ACCESS: throw messaging::UnauthorizedAccess(e.what()); case framing::execution::ERROR_CODE_NOT_FOUND: case framing::execution::ERROR_CODE_RESOURCE_DELETED: throw messaging::NotFound(e.what()); default: throw SessionError(e.what()); } }
BOOL CSerialServer::SessionSender() { WORKSESSION *pSession; SIODATASTREAM *pStream; BOOL bForever = TRUE; for(;bForever && !m_bExitPending;) { sem_wait(&m_sendSem); if (m_bPassiveMode) { USLEEP(1000000); continue; } if (m_bExitPending) return FALSE; while(bForever && !m_bExitPending) { pStream = GetStream(); if (pStream == NULL) break; pSession = (WORKSESSION *)pStream->pSession; if (pSession != NULL) { OnPrevSendSession(pSession, pStream->pszBuffer, pStream->nLength); if (SendStreamToSession(pSession->sSocket, pStream->pszBuffer, pStream->nLength) == -1) { SessionError(pSession, 0); bForever = FALSE; } else OnSendSession(pSession, pStream->pszBuffer, pStream->nLength); } if (pStream->pszBuffer) { FREE(pStream->pszBuffer); pStream->pszBuffer = NULL; } FREE(pStream); } } return TRUE; }