Commit 39859062 authored by Erik Jansson's avatar Erik Jansson
Browse files

Revert parameter to connection opened callback.

It's not needed se lets break as little as possible in the API.
parent ba4c6045
......@@ -175,7 +175,7 @@ typedef bool (* firefly_connection_error_f)(struct firefly_connection *conn,
* @param conn The newly opened connection.
* @param context A user specified context.
*/
typedef void (* firefly_connection_opened_f)(struct firefly_connection *conn, void *context);
typedef void (* firefly_connection_opened_f)(struct firefly_connection *conn);
/**
* @brief Holds the callback functions that are called when there is any
......
......@@ -19,7 +19,7 @@ static int firefly_connection_open_event(void *arg)
if (conn->transport != NULL && conn->transport->open != NULL)
conn->transport->open(conn);
if (conn->actions != NULL && conn->actions->connection_opened != NULL)
conn->actions->connection_opened(conn, conn->context);
conn->actions->connection_opened(conn);
return 0;
}
......@@ -93,6 +93,7 @@ struct firefly_connection *firefly_connection_new(
conn->transport_encoder = transport_encoder;
conn->transport_decoder = transport_decoder;
conn->lc_memory = lc_mem;
conn->context = NULL;
// TODO: Fix this once Labcomm re-gets error handling
/* labcomm_register_error_handler_encoder(conn->transport_encoder,*/
......
......@@ -107,9 +107,8 @@ static void ping_channel_error(struct firefly_channel *chan,
fprintf(stderr, "ERROR: Channel was rejected.\n%s\n", msg);
}
void ping_connection_opened(struct firefly_connection *conn, void *context)
void ping_connection_opened(struct firefly_connection *conn)
{
UNUSED_VAR(context);
ping_pass_test(CONNECTION_OPEN);
firefly_channel_open(conn);
}
......
......@@ -107,9 +107,8 @@ static void ping_channel_error(struct firefly_channel *chan,
fprintf(stderr, "ERROR: Channel was rejected.\n%s\n", msg);
}
void ping_connection_opened(struct firefly_connection *conn, void *ctx)
void ping_connection_opened(struct firefly_connection *conn)
{
UNUSED_VAR(ctx);
/*ping_pass_test(CONNECTION_OPEN);*/
printf("Connection open\n");
firefly_channel_open(conn);
......
......@@ -63,9 +63,8 @@ static pthread_mutex_t ping_done_lock = PTHREAD_MUTEX_INITIALIZER;
static pthread_cond_t ping_done_signal = PTHREAD_COND_INITIALIZER;
static bool ping_done;
void ping_connection_opened(struct firefly_connection *conn, void *ctx)
void ping_connection_opened(struct firefly_connection *conn)
{
UNUSED_VAR(ctx);
printf("PING: conn opened\n");
ping_pass_test(CONNECTION_OPEN);
firefly_channel_open(conn);
......
......@@ -63,9 +63,8 @@ static pthread_mutex_t ping_done_lock = PTHREAD_MUTEX_INITIALIZER;
static pthread_cond_t ping_done_signal = PTHREAD_COND_INITIALIZER;
static bool ping_done;
void ping_connection_opened(struct firefly_connection *conn, void *ctx)
void ping_connection_opened(struct firefly_connection *conn)
{
UNUSED_VAR(ctx);
ping_pass_test(CONNECTION_OPEN);
firefly_channel_open(conn);
}
......
......@@ -69,7 +69,7 @@ void *send_data_and_close(void *args);
bool pong_chan_on_restrict_request(struct firefly_channel *chan);
void pong_chan_on_restrict_change(struct firefly_channel *chan,
enum restriction_transition rinfo);
void pong_connection_opened(struct firefly_connection *conn, void *ctx);
void pong_connection_opened(struct firefly_connection *conn);
bool pong_connection_error(struct firefly_connection *conn,
enum firefly_error reason, const char *message);
......@@ -99,10 +99,9 @@ bool pong_chan_on_restrict_request(struct firefly_channel *chan)
return true;
}
void pong_connection_opened(struct firefly_connection *conn, void *ctx)
void pong_connection_opened(struct firefly_connection *conn)
{
UNUSED_VAR(conn);
UNUSED_VAR(ctx);
pong_pass_test(CONNECTION_OPEN);
}
......
......@@ -61,7 +61,7 @@ void pong_chan_opened(struct firefly_channel *chan);
void pong_udp_chan_closed(struct firefly_channel *chan);
bool pong_chan_received(struct firefly_channel *chan);
void pong_handle_pingpong_data(pingpong_data *data, void *ctx);
void pong_pudp_connection_opened(struct firefly_connection *conn, void *ctx);
void pong_pudp_connection_opened(struct firefly_connection *conn);
void *send_data_and_close(void *args);
struct firefly_connection_actions pong_udp_conn_actions = {
......@@ -74,10 +74,9 @@ struct firefly_connection_actions pong_udp_conn_actions = {
.connection_opened = pong_pudp_connection_opened
};
void pong_pudp_connection_opened(struct firefly_connection *conn, void *ctx)
void pong_pudp_connection_opened(struct firefly_connection *conn)
{
UNUSED_VAR(conn);
UNUSED_VAR(ctx);
/*pong_pass_test(CONNECTION_OPEN);*/
}
......@@ -188,10 +187,9 @@ void pong_eth_chan_closed(struct firefly_channel *chan)
pthread_mutex_unlock(&pong_done_lock);
}
void pong_eth_connection_opened(struct firefly_connection *conn, void *ctx)
void pong_eth_connection_opened(struct firefly_connection *conn)
{
UNUSED_VAR(conn);
UNUSED_VAR(ctx);
/*pong_pass_test(CONNECTION_OPEN);*/
}
......
......@@ -64,7 +64,7 @@ void pong_chan_opened(struct firefly_channel *chan);
void pong_chan_closed(struct firefly_channel *chan);
bool pong_chan_received(struct firefly_channel *chan);
void pong_handle_pingpong_data(pingpong_data *data, void *ctx);
void pong_connection_opened(struct firefly_connection *conn, void *ctx);
void pong_connection_opened(struct firefly_connection *conn);
void *send_data_and_close(void *args);
/* Restr. state change. */
......@@ -108,11 +108,10 @@ struct firefly_connection_actions pong_actions = {
.connection_opened = pong_connection_opened
};
void pong_connection_opened(struct firefly_connection *conn, void *ctx)
void pong_connection_opened(struct firefly_connection *conn)
{
printf("PONG: conn opened\n");
UNUSED_VAR(conn);
UNUSED_VAR(ctx);
pong_pass_test(CONNECTION_OPEN);
}
......
......@@ -64,7 +64,7 @@ void pong_chan_opened(struct firefly_channel *chan);
void pong_chan_closed(struct firefly_channel *chan);
bool pong_chan_received(struct firefly_channel *chan);
void pong_handle_pingpong_data(pingpong_data *data, void *ctx);
void pong_connection_opened(struct firefly_connection *conn, void *ctx);
void pong_connection_opened(struct firefly_connection *conn);
void *send_data_and_close(void *args);
/* Restr. state change. */
......@@ -107,10 +107,9 @@ struct firefly_connection_actions pong_actions = {
.connection_opened = pong_connection_opened
};
void pong_connection_opened(struct firefly_connection *conn, void *ctx)
void pong_connection_opened(struct firefly_connection *conn)
{
UNUSED_VAR(conn);
UNUSED_VAR(ctx);
pong_pass_test(CONNECTION_OPEN);
}
......
......@@ -738,9 +738,8 @@ bool firefly_channel_received(struct firefly_channel *chan)
return false;
}
static void connection_opened(struct firefly_connection *conn, void *ctx)
static void connection_opened(struct firefly_connection *conn)
{
UNUSED_VAR(ctx);
firefly_channel_open(conn);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment