Beispiel #1
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;
}
Beispiel #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;
}
Beispiel #3
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_REJECT_EVENT:
	case XIO_SESSION_CONNECTION_DISCONNECTED_EVENT:
		xio_disconnect(event_data->conn);
		break;
	case XIO_SESSION_TEARDOWN_EVENT:
		session_data->tdata->teared_nr++;
		//fprintf(stderr, "session #%d established:\n", sessions_counter);

		xio_session_close(session);

		if(session_data->tdata->teared_nr == session_data->tdata->num_sessions) {
			//fprintf(stderr, "All sessions( %d )are established, stopping event loop\n", sessions_counter);
			xio_ev_loop_stop(session_data->tdata->loop);
			session_data->tdata->teared_nr = 0;
		}
		break;
	default:
		break;
	};

	return 0;
}