Пример #1
0
/*---------------------------------------------------------------------------*/
static int on_session_event(struct xio_session *session,
			    struct xio_session_event_data *event_data,
			    void *cb_prv_data)
{
	printf("session event: %s. session:%p, connection:%p, reason: %s\n",
	       xio_session_event_str(event_data->event),
	       session, event_data->conn,
	       xio_strerror(event_data->reason));

	switch (event_data->event) {
	case XIO_SESSION_CONNECTION_TEARDOWN_EVENT:
		xio_connection_destroy(event_data->conn);
		break;
	case XIO_SESSION_TEARDOWN_EVENT:
		process_request(NULL);
		xio_session_destroy(session);
		if (test_config.finite_run)
			xio_context_stop_loop(ctx); /* exit */
		break;
	default:
		break;
	};

	return 0;
}
Пример #2
0
/*---------------------------------------------------------------------------*/
static int on_session_event(struct xio_session *session,
		struct xio_session_event_data *event_data,
		void *cb_user_context)
{
	printf("session event: %s. reason: %s\n",
	       xio_session_event_str(event_data->event),
	       xio_strerror(event_data->reason));

	switch (event_data->event) {
	case XIO_SESSION_REJECT_EVENT:
	case XIO_SESSION_CONNECTION_DISCONNECTED_EVENT:
		xio_disconnect(event_data->conn);
		break;
	case XIO_SESSION_TEARDOWN_EVENT:
		xio_ev_loop_stop(loop);  /* exit */
		break;
	default:
		break;
	};

	if (pool) {
		msg_pool_free(pool);
		pool = NULL;
	}

	return 0;
}
Пример #3
0
/*---------------------------------------------------------------------------*/
static int on_session_event(struct xio_session *session,
		struct xio_session_event_data *event_data,
		void *cb_user_context)
{
	struct hw_session_data *session_data = cb_user_context;

	printk("session event: %s. reason: %s\n",
	       xio_session_event_str(event_data->event),
	       xio_strerror(event_data->reason));

	switch (event_data->event) {
	case XIO_SESSION_REJECT_EVENT:
	case XIO_SESSION_CONNECTION_DISCONNECTED_EVENT:
		xio_disconnect(event_data->conn);
		break;
	case XIO_SESSION_TEARDOWN_EVENT:
		xio_session_close(session);
		/* exit */
		xio_ev_loop_stop(session_data->ctx);
		break;
	default:
		break;
	};

	return 0;
}
/*---------------------------------------------------------------------------*/
static int on_session_event(struct xio_session *session,
		struct xio_session_event_data *event_data,
		void *cb_user_context)
{
	struct session_data *session_data = cb_user_context;
	int		    i;


	switch (event_data->event) {
	case XIO_SESSION_CONNECTION_ERROR_EVENT:
	case XIO_SESSION_REJECT_EVENT:
	case XIO_SESSION_CONNECTION_DISCONNECTED_EVENT:
		fprintf(stderr, "%s. reason: %s\n",
			xio_session_event_str(event_data->event),
			xio_strerror(event_data->reason));

		for (i = 0; i < threads_iter; i++) {
			session_data->tdata[i].disconnect = 1;
			session_data->abort = 1;
		}
		break;
	case XIO_SESSION_CONNECTION_TEARDOWN_EVENT:
		xio_connection_destroy(event_data->conn);
		break;
	case XIO_SESSION_TEARDOWN_EVENT:
		for (i = 0; i < threads_iter; i++)
			xio_context_stop_loop(session_data->tdata[i].ctx, 0);
		break;
	default:
		break;
	};

	return 0;
}
Пример #5
0
/*---------------------------------------------------------------------------*/
static int on_session_event(struct xio_session *session,
			    struct xio_session_event_data *event_data,
			    void *cb_user_context)
{
	struct session_data *session_data = (struct session_data *)
						cb_user_context;

	logit(LOG_INFO, "session event: %s. reason: %s\n",
	      xio_session_event_str(event_data->event),
	      xio_strerror(event_data->reason));

	switch (event_data->event) {
	case XIO_SESSION_CONNECTION_DISCONNECTED_EVENT:
	case XIO_SESSION_CONNECTION_REFUSED_EVENT:
		reconnect_flag = 1;
		break;
	case XIO_SESSION_CONNECTION_ESTABLISHED_EVENT:
		on_connection_established(event_data->conn, session_data);
		break;
	case XIO_SESSION_CONNECTION_TEARDOWN_EVENT:
		xio_connection_destroy(event_data->conn);
		session_data->conn = NULL;
		break;
	case XIO_SESSION_TEARDOWN_EVENT:
		xio_session_destroy(session);
		xio_context_stop_loop(session_data->ctx);  /* exit */
		break;
	default:
		break;
	};

	return 0;
}
Пример #6
0
/*---------------------------------------------------------------------------*/
static int on_session_event(struct xio_session *session,
			    struct xio_session_event_data *event_data,
			    void *cb_user_context)
{
	pr_info("session event: %s. reason: %s\n",
		xio_session_event_str(event_data->event),
		xio_strerror(event_data->reason));

	switch (event_data->event) {
	case XIO_SESSION_CONNECTION_ESTABLISHED_EVENT:
		on_connection_established(event_data->conn);
		break;
	case XIO_SESSION_CONNECTION_TEARDOWN_EVENT:
		xio_connection_destroy(event_data->conn);
		break;
	case XIO_SESSION_REJECT_EVENT:
	case XIO_SESSION_TEARDOWN_EVENT:
		g_session = NULL;
		xio_session_destroy(session);
		xio_context_stop_loop(ctx);  /* exit */
		if (pool) {
			msg_pool_free(pool);
			pool = NULL;
		}
		break;
	default:
		break;
	};

	return 0;
}
Пример #7
0
/*---------------------------------------------------------------------------*/
static int on_session_event(struct xio_session *session,
			    struct xio_session_event_data *event_data,
			    void *cb_user_context)
{
	struct server_data *server_data =
		(struct server_data *)cb_user_context;

	printf("session event: %s. session:%p, connection:%p, reason: %s\n",
	       xio_session_event_str(event_data->event),
	       session, event_data->conn,
	       xio_strerror(event_data->reason));

	switch (event_data->event) {
	case XIO_SESSION_NEW_CONNECTION_EVENT:
		server_data->connection = event_data->conn;
		break;
	case XIO_SESSION_CONNECTION_TEARDOWN_EVENT:
		xio_connection_destroy(event_data->conn);
		server_data->connection = NULL;
		break;
	case XIO_SESSION_TEARDOWN_EVENT:
		xio_session_destroy(session);
		xio_context_stop_loop(server_data->ctx);  /* exit */
		break;
	default:
		break;
	};

	return 0;
}
Пример #8
0
/*---------------------------------------------------------------------------*/
static int on_session_event(struct xio_session *session,
			    struct xio_session_event_data *event_data,
			    void *cb_user_context)
{
	struct test_params *test_params = (struct test_params *)cb_user_context;

	printf("session event: %s. reason: %s\n",
	       xio_session_event_str(event_data->event),
	       xio_strerror(event_data->reason));

	switch (event_data->event) {
	case XIO_SESSION_CONNECTION_TEARDOWN_EVENT:
		printf("nsent:%lu, nrecv:%lu, " \
		       "delta:%lu\n",
		       test_params->nsent, test_params->nrecv,
		       test_params->nsent-test_params->nrecv);

		xio_connection_destroy(event_data->conn);
		break;
	case XIO_SESSION_REJECT_EVENT:
	case XIO_SESSION_TEARDOWN_EVENT:
		xio_context_stop_loop(test_params->ctx);  /* exit */
		break;
	default:
		break;
	};

	return 0;
}
Пример #9
0
/*---------------------------------------------------------------------------*/
static int on_session_event(struct xio_session *session,
			    struct xio_session_event_data *event_data,
			    void *cb_user_context)
{
	struct server_data *server_data = cb_user_context;

	pr_info("session event: %s. reason: %s\n",
		xio_session_event_str(event_data->event),
		xio_strerror(event_data->reason));

	switch (event_data->event) {
	case XIO_SESSION_NEW_CONNECTION_EVENT:
		server_data->connection = event_data->conn;
		break;
	case XIO_SESSION_CONNECTION_TEARDOWN_EVENT:
		xio_connection_destroy(event_data->conn);
		server_data->connection = NULL;
		break;
	case XIO_SESSION_TEARDOWN_EVENT:
		server_data->session = NULL;
		xio_session_destroy(session);
		if (atomic_read(&module_state) & 0x80)
			xio_context_stop_loop(server_data->ctx); /* exit */
		break;
	default:
		break;
	};

	return 0;
}
Пример #10
0
/*---------------------------------------------------------------------------*/
static int on_session_event(struct xio_session *session,
                            struct xio_session_event_data *event_data,
                            void *cb_user_context)
{
    struct ow_test_params *ow_params = cb_user_context;

    printf("session event: %s. session:%p, connection:%p, reason: %s\n",
           xio_session_event_str(event_data->event),
           session, event_data->conn,
           xio_strerror(event_data->reason));

    switch (event_data->event) {
    case XIO_SESSION_CONNECTION_TEARDOWN_EVENT:
        xio_connection_destroy(event_data->conn);
        ow_params->connection = NULL;
        break;
    case XIO_SESSION_TEARDOWN_EVENT:
        process_request(NULL);
        xio_session_destroy(session);
        xio_context_stop_loop(ow_params->ctx, 0);
        break;
    default:
        break;
    };

    return 0;
}
Пример #11
0
/*---------------------------------------------------------------------------*/
static int on_session_event(struct xio_session *session,
		struct xio_session_event_data *event_data,
		void *cb_user_context)
{
	struct server_data *server_data = cb_user_context;
	int		   i;

	printf("session event: %s. session:%p, connection:%p, reason: %s\n",
	       xio_session_event_str(event_data->event),
	       session, event_data->conn,
	       xio_strerror(event_data->reason));

	switch (event_data->event) {
	case XIO_SESSION_CONNECTION_TEARDOWN_EVENT:
		xio_connection_destroy(event_data->conn);
		break;
	case XIO_SESSION_TEARDOWN_EVENT:
		xio_session_destroy(session);
		for (i = 0; i < MAX_THREADS; i++)
			xio_context_stop_loop(server_data->tdata[i].ctx, 0);
		xio_context_stop_loop(server_data->ctx, 0);
		break;
	default:
		break;
	};

	return 0;
}
Пример #12
0
/*---------------------------------------------------------------------------*/
static int on_session_event(struct xio_session *session,
			    struct xio_session_event_data *event_data,
			    void *cb_user_context)
{
	/*struct xio_connection_attr	conn_attr;*/

	pr_info("session event: %s. session:%p, connection:%p, reason: %s\n",
		xio_session_event_str(event_data->event),
		session, event_data->conn,
		xio_strerror(event_data->reason));

	switch (event_data->event) {
	case XIO_SESSION_NEW_CONNECTION_EVENT:
		if (!test_params.connection)
			test_params.connection = event_data->conn;
		break;
	case XIO_SESSION_CONNECTION_TEARDOWN_EVENT:
		if (event_data->reason != XIO_E_SESSION_REJECTED)
			test_params.connection = NULL;
		xio_connection_destroy(event_data->conn);
		break;
	case XIO_SESSION_TEARDOWN_EVENT:
		xio_session_destroy(session);
		if (event_data->reason != XIO_E_SESSION_REJECTED)
			xio_context_stop_loop(test_params.ctx);
		break;
	default:
		break;
	};

	return 0;
}
Пример #13
0
/*---------------------------------------------------------------------------*/
static int on_session_event(struct xio_session *session,
		struct xio_session_event_data *event_data,
		void *cb_prv_data)
{
	printf("session event: %s. reason: %s\n",
	       xio_session_event_str(event_data->event),
	       xio_strerror(event_data->reason));


	process_request(NULL);
	xio_session_close(session);

	return 0;
}
Пример #14
0
/*---------------------------------------------------------------------------*/
static int on_session_event(struct xio_session *session,
			    struct xio_session_event_data *event_data,
			    void *cb_user_context)
{
	struct xio_connection_attr	conn_attr;
	struct test_params		*test_params = cb_user_context;

	pr_info("session event: %s. session:%p, connection:%p, reason: %s\n",
		xio_session_event_str(event_data->event),
		session, event_data->conn,
		xio_strerror(event_data->reason));

	switch (event_data->event) {
	case XIO_SESSION_NEW_CONNECTION_EVENT:
		/* assign connection private data */
		conn_attr.user_context = cb_user_context;
		xio_modify_connection(event_data->conn, &conn_attr,
				      XIO_CONNECTION_ATTR_USER_CTX);
		if (!test_params->connection)
			test_params->connection = event_data->conn;
		break;
	case XIO_SESSION_CONNECTION_TEARDOWN_EVENT:
		if (event_data->reason != XIO_E_SESSION_REJECTED) {
			pr_info("last recv:%llu\n",
				test_params->nrecv);
			test_params->connection = NULL;
		}
		xio_connection_destroy(event_data->conn);
		test_params->connection = NULL;
		break;
	case XIO_SESSION_TEARDOWN_EVENT:
		test_params->session = NULL;
		xio_session_destroy(session);
		if (event_data->reason != XIO_E_SESSION_REJECTED) {
			if (atomic_read(&module_state) & 0x80)
				xio_context_stop_loop(
						test_params->ctx); /* exit */
		}
		break;
	default:
		break;
	};

	return 0;
}
Пример #15
0
/*---------------------------------------------------------------------------*/
static int on_session_event(struct xio_session *session,
		struct xio_session_event_data *event_data,
		void *cb_user_context)
{
	printf("%s. reason: %s\n",
	       xio_session_event_str(event_data->event),
	       xio_strerror(event_data->reason));

	switch (event_data->event) {
	case XIO_SESSION_TEARDOWN_EVENT:
		xio_session_close(session);
		break;
	default:
		break;
	};

	return 0;
}
Пример #16
0
static int server_on_session_event(struct xio_session *session,
				   struct xio_session_event_data *event_data,
				   void *cb_user_context)
{
	struct client_info *ci;
	struct xio_connection_attr attr;
	struct server_data *server_data = (struct server_data *)cb_user_context;

	sd_debug("session event: %s. session:%p, connection:%p, reason: %s",
		 xio_session_event_str(event_data->event),
		 session, event_data->conn,
		 xio_strerror(event_data->reason));

	switch (event_data->event) {
	case XIO_SESSION_NEW_CONNECTION_EVENT:
		server_data->nr_conn++;
		memset(&attr, 0, sizeof(attr));

		ci = xio_create_client(session, event_data->conn);
		list_add_tail(&ci->conn.list, &server_data->conn_list);
		attr.user_context = ci;
		xio_modify_connection(event_data->conn, &attr,
				      XIO_CONNECTION_ATTR_USER_CTX);
		xio_context_stop_loop(xio_get_main_ctx());
		break;
	case XIO_SESSION_CONNECTION_TEARDOWN_EVENT:
		server_data->nr_conn--;
		sd_assert(0 <= server_data->nr_conn);

		xio_connection_destroy(event_data->conn);
		xio_context_stop_loop(xio_get_main_ctx());
		break;
	case XIO_SESSION_TEARDOWN_EVENT:
		xio_session_destroy(session);
		xio_context_stop_loop(xio_get_main_ctx());
		break;
	default:
		break;
	};

	return 0;
}
Пример #17
0
/*---------------------------------------------------------------------------*/
static int on_session_event(struct xio_session *session,
                            struct xio_session_event_data *event_data,
                            void *cb_user_context)
{
    struct server_data *sdata;
    struct thread_data *tdata;
    int		   i;

    sdata = (struct server_data *)cb_user_context;
    tdata = (event_data->conn_user_context == sdata) ? NULL :
            (struct thread_data *)event_data->conn_user_context;

    printf("session event: %s. session:%p, connection:%p, reason: %s\n",
           xio_session_event_str(event_data->event),
           session, event_data->conn,
           xio_strerror(event_data->reason));

    switch (event_data->event) {
    case XIO_SESSION_NEW_CONNECTION_EVENT:
        if (tdata)
            tdata->connection = event_data->conn;
        break;
    case XIO_SESSION_CONNECTION_TEARDOWN_EVENT:
        xio_connection_destroy(event_data->conn);
        if (tdata)
            tdata->connection = NULL;
        break;
    case XIO_SESSION_TEARDOWN_EVENT:
        xio_session_destroy(session);
        for (i = 0; i < sdata->tdata_nr; i++) {
            process_request(&sdata->tdata[i], NULL);
            xio_context_stop_loop(sdata->tdata[i].ctx);
        }
        xio_context_stop_loop((struct xio_context *)sdata->ctx);
        break;
    default:
        break;
    };

    return 0;
}
Пример #18
0
/*---------------------------------------------------------------------------*/
static int on_session_event(struct xio_session *session,
		struct xio_session_event_data *event_data,
		void *cb_user_context)
{
	struct xio_connection_params cparams;
	struct test_params *test_params = cb_user_context;

	printf("session event: %s. session:%p, connection:%p, reason: %s\n",
	       xio_session_event_str(event_data->event),
	       session, event_data->conn,
	       xio_strerror(event_data->reason));

	switch (event_data->event) {
	case XIO_SESSION_NEW_CONNECTION_EVENT:
		/* assign connection private data */
		cparams.user_context = cb_user_context;
		xio_set_connection_params(event_data->conn, &cparams);
		break;
	case XIO_SESSION_REJECT_EVENT:
		xio_disconnect(event_data->conn);
		break;
	case XIO_SESSION_CONNECTION_TEARDOWN_EVENT:
		printf("last sent:%"PRIu64", last comp:%"PRIu64", " \
		       "delta:%"PRIu64"\n",
		       test_params->nsent,  test_params->ncomp,
		       test_params->nsent-test_params->ncomp);
		xio_connection_destroy(event_data->conn);
		break;
	case XIO_SESSION_TEARDOWN_EVENT:
		xio_session_destroy(session);
		xio_context_stop_loop(test_params->ctx, 0);
		break;
	default:
		break;
	};

	return 0;
}
Пример #19
0
/*---------------------------------------------------------------------------*/
static int on_session_event(struct xio_session *session,
			    struct xio_session_event_data *event_data,
			    void *cb_user_context)
{
	struct ow_test_params *ow_params =
				(struct ow_test_params *)cb_user_context;

	printf("session event: %s. reason: %s\n",
	       xio_session_event_str(event_data->event),
	       xio_strerror(event_data->reason));

	switch (event_data->event) {
	case XIO_SESSION_CONNECTION_TEARDOWN_EVENT:
		xio_connection_destroy(event_data->conn);
		break;
	case XIO_SESSION_TEARDOWN_EVENT:
		xio_context_stop_loop(ow_params->ctx);  /* exit */
		break;
	default:
		break;
	};

	return 0;
}
Пример #20
0
/*---------------------------------------------------------------------------*/
static int on_session_event(struct xio_session *session,
			    struct xio_session_event_data *event_data,
			    void *cb_user_context)
{
	struct session_data *session_data = cb_user_context;

	printf("session event: %s. reason: %s\n",
	       xio_session_event_str(event_data->event),
	       xio_strerror(event_data->reason));

	switch (event_data->event) {
	case XIO_SESSION_CONNECTION_TEARDOWN_EVENT:
		xio_connection_destroy(event_data->conn);
		break;
	case XIO_SESSION_TEARDOWN_EVENT:
		xio_session_destroy(session);
		event_base_loopbreak(session_data->evbase);
		break;
	default:
		break;
	};

	return 0;
}