void ClientConn::Close()
{
	if (m_handle != NETLIB_INVALID_HANDLE) {
		netlib_close(m_handle);
	}
	ReleaseRef();
}
Exemple #2
0
void CRouteConn::Close()
{
	if (m_handle != NETLIB_INVALID_HANDLE) {
		netlib_close(m_handle);
		g_route_conn_map.erase(m_handle);
	}

	// remove all user info from this MessageServer
	UserStatMap_t::iterator it_old;
	for (UserStatMap_t::iterator it = g_rs_user_map.begin(); it != g_rs_user_map.end(); ) {
		it_old = it;
		it++;
        
		RouteConnMap_t::iterator conn_it = it_old->second.conns.find(this);
		if (conn_it != it_old->second.conns.end()) {
			it_old->second.conns.erase(conn_it);
            
			if (it_old->second.conns.empty()) {
				g_rs_user_map.erase(it_old);
			}
		}
	}

	ReleaseRef();
}
Exemple #3
0
void ClientConn::Close()
{
	log("clientconn close from handle = %d\n", m_handle);
	if (m_handle != NETLIB_INVALID_HANDLE) {
		netlib_close(m_handle);
		g_client_conn_map.erase(m_handle);
	}
	ReleaseRef();
}
Exemple #4
0
void CHttpConn::Close()
{
    m_state = CONN_STATE_CLOSED;

    g_http_conn_map.erase(m_conn_handle);
    netlib_close(m_sock_handle);

    ReleaseRef();
}
Exemple #5
0
/*
**++
**  ROUTINE:	netlib___get_nameservers
**
**  FUNCTIONAL DESCRIPTION:
**
**  	Obtains the list of DNS servers configured for this TCP/IP package.
**
**  RETURNS:	int
**
**  PROTOTYPE:
**
**  	NETLIB___GET_NAMESERVERS nsq
**
**  IMPLICIT INPUTS:	None.
**
**  IMPLICIT OUTPUTS:	None.
**
**  COMPLETION CODES:
**
**
**  SIDE EFFECTS:   	None.
**
**--
*/
int netlib___get_nameservers (QUEUE *nsq) {

    struct NAMESERVER *ns;
    struct INADDRDEF a;
    struct CTX *tmpctx;
    struct dsc$descriptor dsc, lognamdsc;
    ITMLST lnmlst[2];
    char name[256], lognam[256], *cp, *anchor;
    unsigned int status, size, maxidx;
    unsigned short namlen;
    int index, i, remain;
    int v5, count;
    static unsigned int one = 1;

    tmpctx = 0;
    count = 0;

    ITMLST_INIT(lnmlst[0], LNM$_STRING, sizeof(name), name, &namlen);
    ITMLST_INIT(lnmlst[1], 0, 0, 0, 0);

    INIT_SDESC(lognamdsc, 0, lognam);

    for (v5 = 1; (count == 0) && (v5 >= 0); v5--) {
    	for (index = 0; index <= 16; index++) {
    	    lognamdsc.dsc$w_length = sprintf(lognam, (v5 == 0 ? "UCX$BIND_SERVER%03d" : "TCPIP$BIND_SERVER%03d"), index);
    	    status = sys$trnlnm(0, &nameserver_tabnam, &lognamdsc, 0, lnmlst);
    	    if (!OK(status) || namlen == 0) continue;
    	    for (anchor = name, remain = namlen; remain > 0;
    	    	    	    	    	remain -= i+1, anchor = cp+1) {
    	    	cp = memchr(anchor, ',', remain);
    	    	if (cp == 0) i = remain;
    	    	else i = cp - anchor;
    	    	INIT_SDESC(dsc, i, anchor);
    	    	if (!OK(netlib_strtoaddr(&dsc, &a))) {
    	    	    if (tmpctx == 0) {
    	    	    	if (!OK(netlib_socket(&tmpctx, 0, 0))) continue;
    	    	    }
    	    	    if (!OK(netlib_name_to_address(&tmpctx, 0, &dsc, &a, &one, 0,
    	    	    	    	0, 0, 0))) continue;
    	    	}
    	    	size = sizeof(struct NAMESERVER);
    	    	status = lib$get_vm(&size, &ns);
    	    	if (!OK(status)) break;
    	    	ns->addr = a;
    	    	queue_insert(ns, nsq->tail);
    	    	count += 1;
    	    }
    	}
    }

    if (tmpctx != 0) netlib_close(&tmpctx);
    return count;

} /* netlib___get_nameservers */
Exemple #6
0
void CDBServConn::Close()
{
	// reset server information for the next connect
	serv_reset<CDBServConn>(g_db_server_list, g_db_server_count, m_serv_idx);

	if (m_handle != NETLIB_INVALID_HANDLE) {
		netlib_close(m_handle);
		g_db_server_conn_map.erase(m_handle);
	}

	ReleaseRef();
}
Exemple #7
0
void CHttpConn::Close()
{
    if (m_state != CONN_STATE_CLOSED) {
        m_state = CONN_STATE_CLOSED;

        g_httpConnMap.erase(m_sockHandle);
        g_uuidConnMap.erase(m_uuid);
        netlib_close(m_sockHandle);

        ReleaseRef();
    }
}
Exemple #8
0
void CRouteServConn::Close()
{
	serv_reset<CRouteServConn>(g_route_server_list, g_route_server_count, m_serv_idx);

	m_bOpen = false;
	if (m_handle != NETLIB_INVALID_HANDLE) {
		netlib_close(m_handle);
		g_route_server_conn_map.erase(m_handle);
	}

	ReleaseRef();

	if (g_master_rs_conn == this) {
		update_master_route_serv_conn();
	}
}
Exemple #9
0
void CImConn::Close()
{
	netlib_close(m_handle);
	ReleaseRef();
	LOG__(NET,  _T("close, socket=%d"), m_handle);
}