static apt_bool_t mrcp_server_agent_channel_remove(mrcp_connection_agent_t *agent, mrcp_control_channel_t *channel) { mrcp_connection_t *connection = channel->connection; mrcp_connection_channel_remove(connection,channel); apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Remove Control Channel <%s> [%d]", channel->identifier.buf, apr_hash_count(connection->channel_table)); if(!connection->access_count) { if(connection == agent->null_connection) { if(apt_list_is_empty(agent->connection_list) == TRUE) { apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Destroy Pending Connection"); mrcp_connection_destroy(agent->null_connection); agent->null_connection = NULL; agent->connection_list = NULL; } } else if(!connection->sock) { mrcp_connection_remove(agent,connection); /* set connection to be destroyed on channel destroy */ apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Mark Connection for Late Destroy"); channel->connection = connection; channel->removed = TRUE; } } /* send response */ return mrcp_control_channel_remove_respond(agent->vtable,channel,TRUE); }
static apt_bool_t mrcp_server_agent_channel_remove(mrcp_connection_agent_t *agent, mrcp_control_channel_t *channel) { mrcp_connection_t *connection = channel->connection; if(connection) { mrcp_connection_channel_remove(connection,channel); apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Remove Control Channel <%s> [%d]", channel->identifier.buf, apr_hash_count(connection->channel_table)); if(!connection->access_count) { if(!connection->sock) { mrcp_connection_remove(agent,connection); /* set connection to be destroyed on channel destroy */ apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Mark Connection for Removal %s",connection->id); channel->connection = connection; channel->removed = TRUE; } } } else { apr_hash_set(agent->pending_channel_table,channel->identifier.buf,channel->identifier.length,NULL); apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Remove Pending Control Channel <%s> [%d]", channel->identifier.buf, apr_hash_count(agent->pending_channel_table)); } /* send response */ return mrcp_control_channel_remove_respond(agent->vtable,channel,TRUE); }
static apt_bool_t mrcp_server_agent_connection_close(mrcp_connection_agent_t *agent, mrcp_connection_t *connection) { apt_log(APT_LOG_MARK,APT_PRIO_INFO,"TCP/MRCPv2 Peer Disconnected %s",connection->id); apt_pollset_remove(agent->pollset,&connection->sock_pfd); apr_socket_close(connection->sock); connection->sock = NULL; if(!connection->access_count) { mrcp_connection_remove(agent,connection); apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy TCP/MRCPv2 Connection %s",connection->id); mrcp_connection_destroy(connection); } return TRUE; }