Пример #1
0
int main(int argc, char **argv)
{
	struct connection_pool *cp;
	struct sockaddr_in l_addr;
	struct listening *l;
	struct connecting *ci;

	cp = connection_pool_new(2048);
	if (cp == NULL)
		return -1;

	memset(&l_addr, 0, sizeof(struct sockaddr_in));
	l_addr.sin_family = AF_INET;
	l_addr.sin_port = htons(8888);
	l_addr.sin_addr.s_addr = inet_addr("127.0.0.1");

	ci = create_connecting(cp, &l_addr, sizeof(struct sockaddr_in));
	if (ci == NULL)
		return -1;

	connecting_peer(cp, ci);

	while (1)
	{
		connection_pool_dispatch(cp, -1);
	}

	connection_pool_free(cp);

	return 0;
}
Пример #2
0
void mds_conn_init()
{
    DBG();
    event_init();
    rpc_client_setup("client", 0, MACHINE_CLIENT);

    //struct machine *mds = cluster_get_machine_of_type(MACHINE_MDS);

    conn_pool = connection_pool_new();
    pool_holder = evrpc_pool_holder_new();
    /*pthread_t thread1;*/
    /*int ret = pthread_create( &thread1, NULL, ev_loop_func, NULL);*/



}