void OutputMessagePool::send(OutputMessage_ptr msg) { OTSYS_THREAD_LOCK(m_outputPoolLock, ""); OutputMessage::OutputMessageState state = msg->getState(); OTSYS_THREAD_UNLOCK(m_outputPoolLock, ""); if(state == OutputMessage::STATE_ALLOCATED_NO_AUTOSEND) { #ifdef __DEBUG_NET_DETAIL__ std::cout << "Sending message - SINGLE" << std::endl; #endif if(msg->getConnection()) { if(!msg->getConnection()->send(msg) && msg->getProtocol()) msg->getProtocol()->onSendMessage(msg); } #ifdef __DEBUG_NET__ else std::cout << "Error: [OutputMessagePool::send] NULL connection." << std::endl; #endif } #ifdef __DEBUG_NET__ else std::cout << "Warning: [OutputMessagePool::send] State != STATE_ALLOCATED_NO_AUTOSEND" << std::endl; #endif }
void OutputMessagePool::send(OutputMessage_ptr msg) { m_outputPoolLock.lock(); OutputMessage::OutputMessageState state = msg->getState(); m_outputPoolLock.unlock(); if(state == OutputMessage::STATE_ALLOCATED_NO_AUTOSEND) { #ifdef __DEBUG_NET_DETAIL__ std::cout << "Sending message - SINGLE" << std::endl; #endif if(msg->getConnection()) { if(!msg->getConnection()->send(msg)) { // Send only fails when connection is closing (or in error state) // This call will free the message msg->getProtocol()->onSendMessage(msg); } } else { #ifdef __DEBUG_NET__ std::cout << "Error: [OutputMessagePool::send] NULL connection." << std::endl; #endif } } else { #ifdef __DEBUG_NET__ std::cout << "Warning: [OutputMessagePool::send] State != STATE_ALLOCATED_NO_AUTOSEND" << std::endl; #endif } }
void OutputMessagePool::send(OutputMessage_ptr msg) { m_outputPoolLock.lock(); OutputMessage::OutputMessageState state = msg->getState(); m_outputPoolLock.unlock(); if (state == OutputMessage::STATE_ALLOCATED_NO_AUTOSEND) { Connection_ptr connection = msg->getConnection(); if (connection && !connection->send(msg)) { // Send only fails when connection is closing (or in error state) // This call will free the message msg->getProtocol()->onSendMessage(msg); } } }