static int redir_conn_finish(struct conn_t *conn, void *ctx) { redir_request *req = (redir_request *)ctx; if (req->conn.sock) { if (req->state & REDIR_CONN_FD) { net_select_rmfd(&sctx, req->conn.sock); } conn_close(&req->conn); } if (req->socket_fd) { #ifdef ENABLE_REDIRINJECT /** if (0 && *req->inject_url && req->html && !req->chunked) { char b[256]; char *inject = inject_fmt(req); int w = net_write(req->socket_fd, inject, strlen(inject)); log_dbg("injected %d bytes", w); } */ #endif if (req->state & REDIR_SOCKET_FD) { net_select_rmfd(&sctx, req->socket_fd); } close(req->socket_fd); req->socket_fd=0; } close_request(req); return 0; }
inline command::~command() { close_request(); if (lib::error(m_con)) return; int con(CCI_ER_CON_HANDLE); std::swap(m_con, con); lib::singleton().p_cci_disconnect(con, &m_err); }
inline void command::set_autocommit(bool autocommit) { close_request(); if (lib::singleton().p_cci_get_autocommit(m_con) == (autocommit? 1: 0)) return; if (autocommit) check(lib::singleton().p_cci_end_tran(m_con, CCI_TRAN_ROLLBACK, &m_err)); if (lib::error(lib::singleton().p_cci_set_autocommit(m_con, autocommit? CCI_AUTOCOMMIT_TRUE: CCI_AUTOCOMMIT_FALSE))) throw std::runtime_error("CUBRID error"); }
void ShutdownService::_sendShutdownRequestToService(const char * serviceName) { MessageQueueService* _mqs = static_cast<MessageQueueService*>(_controller); Array<Uint32> _services; Uint32 _queueId; _mqs->find_services(String(serviceName), 0, 0, &_services); if (_services.size() == 0 ) { // service not found, just return return; } _queueId = _services[0]; // send a Stop (this is a legacy message that in some of the MQS does termination // of its internal stuff. Then follow it with a Stop (to open up its incoming queue), // and then with a AsyncIoctl::IO_CLOSE which closes the incoming queue. // All of these messages MUST be sequential. Do not use SendForget or SendAsync as those // are asynchronous and their receival is guaranteed to be undeterministic and possibly // out of sequence (which is something we do not want). CimServiceStop stop_message (_mqs->get_next_xid(), NULL, _queueId, _controller->getQueueId(), true); AutoPtr <AsyncReply> StopAsyncReply (_controller->ClientSendWait ( *_client_handle, _queueId, &stop_message)); CimServiceStart start_message (_mqs->get_next_xid(), NULL, _queueId, _controller->getQueueId(), true); AutoPtr <AsyncReply> StartAsyncReply (_controller->ClientSendWait ( *_client_handle, _queueId, &start_message)); AsyncIoctl close_request (_mqs->get_next_xid(), NULL, _queueId, _controller->getQueueId(), false, AsyncIoctl::IO_CLOSE, 0, 0); AutoPtr <AsyncReply> CloseAsyncReply (_controller->ClientSendWait ( *_client_handle, _queueId, &close_request)); return; }
bool ViewFrame4_Base::eventFilter(QObject* obj, QEvent* event) { if(obj == get_image_view()) { if(event->type() == QEvent::KeyPress) { QKeyEvent* keyevent = (QKeyEvent*)event; if(keyevent->key() == Qt::Key_Escape) { emit close_request(); return 1; } else if(keyevent->key() == Qt::Key_Left) { emit prev_image_request(); return 1; } else if(keyevent->key() == Qt::Key_Right) { emit next_image_request(); return 1; } } else if(event->type() == QEvent::MouseButtonPress) { if(((QMouseEvent*)event)->button() == Qt::MiddleButton) { emit close_request(); return 1; } } else if(event->type() == QEvent::Wheel) { int delta = ((QWheelEvent*)event)->delta(); if(delta > 0) emit prev_image_request(); else emit next_image_request(); return 1; } } return 0; }
inline void command::exec_batch(const std::string& sql) { exec(sql); while (true) { const int res(lib::singleton().p_cci_next_result(m_req, &m_err)); if (CAS_ER_NO_MORE_RESULT_SET == res) break; check(res); } close_request(); }
inline void command::exec(const std::string& sql, const std::vector<column_def>& params) { close_request(); int req(lib::singleton().p_cci_prepare(m_con, (char*)sql.c_str(), 0, &m_err)); check(req); std::swap(m_req, req); for (size_t i(0); i < params.size(); ++i) if (lib::error(bind(m_req, i, params[i]))) throw std::runtime_error("CUBRID error"); check(lib::singleton().p_cci_execute(m_req, CCI_EXEC_QUERY_ALL, 0, &m_err)); }
void ShutdownService::_sendShutdownRequestToService(const char* serviceName) { MessageQueueService* _mqs = static_cast<MessageQueueService*>(_controller); MessageQueue *queue = MessageQueue::lookup(serviceName); Uint32 _queueId; if (queue) { _queueId = queue->getQueueId(); } else { // service not found, just return return; } // send a Stop (this is a legacy message that in some of the MQS does // termination of its internal stuff. Then follow it with a Stop (to // open up its incoming queue), and then with a AsyncIoClose // which closes the incoming queue. // All of these messages MUST be sequential. Do not use SendForget or // SendAsync as those are asynchronous and their receipt is guaranteed // to be undeterministic and possibly out of sequence (which is something // we do not want). CimServiceStop stop_message( NULL, _queueId, _controller->getQueueId(), true); AutoPtr<AsyncReply> StopAsyncReply( _controller->ClientSendWait(_queueId, &stop_message)); CimServiceStart start_message( NULL, _queueId, _controller->getQueueId(), true); AutoPtr <AsyncReply> StartAsyncReply( _controller->ClientSendWait(_queueId, &start_message)); AsyncIoClose close_request( NULL, _queueId, _controller->getQueueId(), false); AutoPtr <AsyncReply> CloseAsyncReply( _controller->ClientSendWait(_queueId, &close_request)); }
void canvas_window::shutdown_close() { lock(); if (status == canvas_window::running) { close_request(); unlock(); gsl_shell_state* gs = this->m_gsl_shell; pthread_mutex_unlock (&gs->shutdown_mutex); pthread_join(m_thread, NULL); pthread_mutex_lock (&gs->shutdown_mutex); } else { unlock(); } }
void Request::after_fork_child(STATE) { close_request(); }
void Request::stop_thread(STATE) { MachineThread::stop_thread(state); close_request(); }
inline void command::commit() { close_request(); if (lib::singleton().p_cci_get_autocommit(m_con)) return; check(lib::singleton().p_cci_end_tran(m_con, CCI_TRAN_COMMIT, &m_err)); } // command::