Commit 1fb90240 authored by Erik Jansson's avatar Erik Jansson
Browse files

Add context parameter to firefly_connection_open().

The connection_opened() callback also has a context parameter now.
Unfortunately, this breaks backwards compatibility but is necessary.
parent e6fcb59f
......@@ -173,8 +173,9 @@ typedef bool (* firefly_connection_error_f)(struct firefly_connection *conn,
* opened.
*
* @param conn The newly opened connection.
* @param context A user specified context.
*/
typedef void (* firefly_connection_opened_f)(struct firefly_connection *conn);
typedef void (* firefly_connection_opened_f)(struct firefly_connection *conn, void *context);
/**
* @brief Holds the callback functions that are called when there is any
......@@ -211,6 +212,7 @@ struct firefly_connection_actions {
* offered to.
* @param tc A struct containing the transport layer specific
* functions and data.
* @param context An initial value of the connection context.
*
* @return int Indicating error if any.
* @retval 0 if no error, negative error number otherwise.
......@@ -219,7 +221,8 @@ int firefly_connection_open(
struct firefly_connection_actions *actions,
struct firefly_memory_funcs *memory_replacements,
struct firefly_event_queue *event_queue,
struct firefly_transport_connection *tc);
struct firefly_transport_connection *tc,
void *context);
/**
* @brief Spawns an event that will close the connection specified by
......
......@@ -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->actions->connection_opened(conn, conn->context);
return 0;
}
......@@ -114,12 +114,13 @@ int firefly_connection_open(
struct firefly_connection_actions *actions,
struct firefly_memory_funcs *memory_replacements,
struct firefly_event_queue *event_queue,
struct firefly_transport_connection *tc)
struct firefly_transport_connection *tc,
void *context)
{
struct firefly_connection *conn;
conn = firefly_connection_new(actions, memory_replacements, event_queue, tc);
firefly_connection_set_context(conn, context);
return conn != NULL ? conn->event_queue->offer_event_cb(conn->event_queue,
FIREFLY_PRIORITY_HIGH, firefly_connection_open_event,
conn, 0, NULL) : -1;
......
......@@ -248,7 +248,7 @@ int main(int argc, char **argv)
firefly_connection_open(&conn_actions,
firefly_transport_eth_xeno_memfuncs(), event_queue,
firefly_transport_connection_eth_xeno_new(
llp, mac_addr, iface));
llp, mac_addr, iface), NULL);
res = rt_mutex_create(&rtarg.lock, "reader_mutex");
if (res) {
......
......@@ -107,8 +107,9 @@ 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 ping_connection_opened(struct firefly_connection *conn, void *context)
{
UNUSED_VAR(context);
ping_pass_test(CONNECTION_OPEN);
firefly_channel_open(conn);
}
......@@ -197,7 +198,7 @@ int main(int argc, char **argv)
res = firefly_connection_open(&conn_actions, NULL, event_queue,
firefly_transport_connection_eth_posix_new(
llp, mac_addr, iface));
llp, mac_addr, iface), NULL);
if (res < 0) fprintf(stderr, "PING ERROR: Open connection: %d.\n", res);
firefly_transport_eth_posix_run(llp);
......
......@@ -107,8 +107,9 @@ 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 ping_connection_opened(struct firefly_connection *conn, void *ctx)
{
UNUSED_VAR(ctx);
/*ping_pass_test(CONNECTION_OPEN);*/
printf("Connection open\n");
firefly_channel_open(conn);
......@@ -222,7 +223,7 @@ void *ping_main_thread(void *arg)
firefly_connection_open(&ping_eth_conn_actions, NULL, event_queue,
firefly_transport_connection_eth_posix_new(
eth_llp, PONG_MAC_ADDR, PING_IFACE));
eth_llp, PONG_MAC_ADDR, PING_IFACE), NULL);
pthread_create(&reader_thread, NULL, eth_reader_thread_main, eth_llp);
......@@ -245,7 +246,7 @@ void *ping_main_thread(void *arg)
firefly_connection_open(&ping_udp_conn_actions, NULL, event_queue,
firefly_transport_connection_udp_posix_new(
llp, PONG_ADDR, PONG_PORT,
FIREFLY_TRANSPORT_UDP_POSIX_DEFAULT_TIMEOUT));
FIREFLY_TRANSPORT_UDP_POSIX_DEFAULT_TIMEOUT), NULL);
pthread_create(&reader_thread, NULL, udp_reader_thread_main, llp);
......
......@@ -63,8 +63,9 @@ 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 ping_connection_opened(struct firefly_connection *conn, void *ctx)
{
UNUSED_VAR(ctx);
printf("PING: conn opened\n");
ping_pass_test(CONNECTION_OPEN);
firefly_channel_open(conn);
......@@ -182,7 +183,7 @@ void *ping_main_thread(void *arg)
res = firefly_connection_open(&ping_actions, NULL, event_queue,
firefly_transport_connection_tcp_posix_new(
llp, -1, PONG_ADDR, PONG_PORT));
llp, -1, PONG_ADDR, PONG_PORT), NULL);
if (res < 0) fprintf(stderr, "PING ERROR: Open connection: %d.\n", res);
res = firefly_transport_tcp_posix_run(llp);
......
......@@ -63,8 +63,9 @@ 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 ping_connection_opened(struct firefly_connection *conn, void *ctx)
{
UNUSED_VAR(ctx);
ping_pass_test(CONNECTION_OPEN);
firefly_channel_open(conn);
}
......@@ -178,7 +179,7 @@ void *ping_main_thread(void *arg)
res = firefly_connection_open(&ping_actions, NULL, event_queue,
firefly_transport_connection_udp_posix_new(
llp, PONG_ADDR, PONG_PORT,
FIREFLY_TRANSPORT_UDP_POSIX_DEFAULT_TIMEOUT));
FIREFLY_TRANSPORT_UDP_POSIX_DEFAULT_TIMEOUT), NULL);
if (res < 0) fprintf(stderr, "PING ERROR: Open connection: %d.\n", res);
res = firefly_transport_udp_posix_run(llp);
......
......@@ -132,7 +132,7 @@ int64_t pong_connection_received(
return firefly_connection_open(&conn_actions,
firefly_transport_eth_xeno_memfuncs(), event_queue,
firefly_transport_connection_eth_xeno_new(
llp, mac_addr, pong_iface));
llp, mac_addr, pong_iface), NULL);
} else {
fprintf(stderr, "ERROR: Received unknown connection: %s\n",
mac_addr);
......
......@@ -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 pong_connection_opened(struct firefly_connection *conn, void *ctx);
bool pong_connection_error(struct firefly_connection *conn,
enum firefly_error reason, const char *message);
......@@ -99,9 +99,10 @@ bool pong_chan_on_restrict_request(struct firefly_channel *chan)
return true;
}
void pong_connection_opened(struct firefly_connection *conn)
void pong_connection_opened(struct firefly_connection *conn, void *ctx)
{
UNUSED_VAR(conn);
UNUSED_VAR(ctx);
pong_pass_test(CONNECTION_OPEN);
}
......@@ -112,7 +113,7 @@ int64_t pong_connection_received(struct firefly_transport_llp *llp,
if (strncmp(mac_addr, ping_mac_addr, strlen(ping_mac_addr)) == 0) {
return firefly_connection_open(&conn_actions, NULL, event_queue,
firefly_transport_connection_eth_posix_new(
llp, mac_addr, pong_iface));
llp, mac_addr, pong_iface), NULL);
} else {
fprintf(stderr, "ERROR: Received unknown connection: %s\n",
mac_addr);
......
......@@ -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 pong_pudp_connection_opened(struct firefly_connection *conn, void *ctx);
void *send_data_and_close(void *args);
struct firefly_connection_actions pong_udp_conn_actions = {
......@@ -74,9 +74,10 @@ struct firefly_connection_actions pong_udp_conn_actions = {
.connection_opened = pong_pudp_connection_opened
};
void pong_pudp_connection_opened(struct firefly_connection *conn)
void pong_pudp_connection_opened(struct firefly_connection *conn, void *ctx)
{
UNUSED_VAR(conn);
UNUSED_VAR(ctx);
/*pong_pass_test(CONNECTION_OPEN);*/
}
......@@ -92,7 +93,7 @@ int64_t pong_udp_connection_received(
return firefly_connection_open(&pong_udp_conn_actions, NULL, event_queue,
firefly_transport_connection_udp_posix_new(
llp, ip_addr, port,
FIREFLY_TRANSPORT_UDP_POSIX_DEFAULT_TIMEOUT));
FIREFLY_TRANSPORT_UDP_POSIX_DEFAULT_TIMEOUT), NULL);
} else {
fprintf(stderr, "ERROR: Received unknown connection: %s:%hu\n",
ip_addr, port);
......@@ -187,9 +188,10 @@ 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 pong_eth_connection_opened(struct firefly_connection *conn, void *ctx)
{
UNUSED_VAR(conn);
UNUSED_VAR(ctx);
/*pong_pass_test(CONNECTION_OPEN);*/
}
......@@ -211,7 +213,7 @@ int64_t pong_eth_connection_received(struct firefly_transport_llp *llp,
printf("Recieved connection on %s!\n", PONG_IFACE);
return firefly_connection_open(&pong_eth_conn_actions, NULL, event_queue,
firefly_transport_connection_eth_posix_new(
llp, mac_addr, PONG_IFACE));
llp, mac_addr, PONG_IFACE), NULL);
} else {
fprintf(stderr, "ERROR: Received unknown connection: %s\n", mac_addr);
return 0;
......
......@@ -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 pong_connection_opened(struct firefly_connection *conn, void *ctx);
void *send_data_and_close(void *args);
/* Restr. state change. */
......@@ -108,10 +108,11 @@ struct firefly_connection_actions pong_actions = {
.connection_opened = pong_connection_opened
};
void pong_connection_opened(struct firefly_connection *conn)
void pong_connection_opened(struct firefly_connection *conn, void *ctx)
{
printf("PONG: conn opened\n");
UNUSED_VAR(conn);
UNUSED_VAR(ctx);
pong_pass_test(CONNECTION_OPEN);
}
......@@ -127,7 +128,7 @@ int64_t pong_connection_received(
printf("PONG: Accepting conn\n");
return firefly_connection_open(&pong_actions, NULL, event_queue,
firefly_transport_connection_tcp_posix_new(
llp, socket, ip_addr, port));
llp, socket, ip_addr, port), NULL);
} else {
fprintf(stderr, "ERROR: Received unknown connection: %s:%hu\n",
ip_addr, port);
......
......@@ -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 pong_connection_opened(struct firefly_connection *conn, void *ctx);
void *send_data_and_close(void *args);
/* Restr. state change. */
......@@ -107,9 +107,10 @@ struct firefly_connection_actions pong_actions = {
.connection_opened = pong_connection_opened
};
void pong_connection_opened(struct firefly_connection *conn)
void pong_connection_opened(struct firefly_connection *conn, void *ctx)
{
UNUSED_VAR(conn);
UNUSED_VAR(ctx);
pong_pass_test(CONNECTION_OPEN);
}
......@@ -125,7 +126,7 @@ int64_t pong_connection_received(
return firefly_connection_open(&pong_actions, NULL, event_queue,
firefly_transport_connection_udp_posix_new(
llp, ip_addr, port,
FIREFLY_TRANSPORT_UDP_POSIX_DEFAULT_TIMEOUT));
FIREFLY_TRANSPORT_UDP_POSIX_DEFAULT_TIMEOUT), NULL);
} else {
fprintf(stderr, "ERROR: Received unknown connection: %s:%hu\n",
ip_addr, port);
......
......@@ -85,7 +85,7 @@ struct firefly_connection *setup_test_conn_new(
test_trsp_conn->open = test_conn_open;
test_trsp_conn->close = test_conn_close;
test_trsp_conn->context = &conn;
int res = firefly_connection_open(conn_actions, NULL, eq, test_trsp_conn);
int res = firefly_connection_open(conn_actions, NULL, eq, test_trsp_conn, NULL);
CU_ASSERT_TRUE_FATAL(res > 0);
event_execute_test(eq, 1);
......
......@@ -128,6 +128,7 @@ static int mock_firefly_reader_start(struct labcomm_reader *r,
struct labcomm_signature *signature,
void *value)
{
UNUSED_VAR(action_context);
UNUSED_VAR(local_index);
UNUSED_VAR(remote_index);
UNUSED_VAR(signature);
......@@ -463,6 +464,7 @@ static int mock_firefly_app_reader_start(struct labcomm_reader *r,
struct labcomm_signature *signature,
void *value)
{
UNUSED_VAR(action_context);
UNUSED_VAR(local_index);
UNUSED_VAR(remote_index);
UNUSED_VAR(signature);
......@@ -736,8 +738,9 @@ bool firefly_channel_received(struct firefly_channel *chan)
return false;
}
static void connection_opened(struct firefly_connection *conn)
static void connection_opened(struct firefly_connection *conn, void *ctx)
{
UNUSED_VAR(ctx);
firefly_channel_open(conn);
}
......@@ -855,7 +858,7 @@ void test_something()
firefly_connection_open(&conn_actions, NULL, events,
firefly_transport_connection_udp_posix_new(
llp, IP_ADDR, MOCK_UDP_PORT, RESEND_TIMEOUT));
llp, IP_ADDR, MOCK_UDP_PORT, RESEND_TIMEOUT), NULL);
// Receive ingored request
current_packet = next_packet_wait(prev_packet);
......
......@@ -98,7 +98,7 @@ void test_conn_close_empty()
.close = free_plat_conn_test,
.context = &conn
};
int res = firefly_connection_open(NULL, NULL, eq, &test_trsp_conn);
int res = firefly_connection_open(NULL, NULL, eq, &test_trsp_conn, NULL);
CU_ASSERT_TRUE_FATAL(res > 0);
event_execute_test(eq, 1);
......@@ -122,7 +122,7 @@ void test_conn_close_mult_chans()
.close = free_plat_conn_test,
.context = &conn
};
int res = firefly_connection_open(NULL, NULL, eq, &test_trsp_conn);
int res = firefly_connection_open(NULL, NULL, eq, &test_trsp_conn, NULL);
CU_ASSERT_TRUE_FATAL(res > 0);
event_execute_test(eq, 1);
......@@ -159,7 +159,7 @@ void test_conn_close_mult_chans_overflow()
.close = free_plat_conn_test,
.context = &conn
};
int res = firefly_connection_open(NULL, NULL, eq, &test_trsp_conn);
int res = firefly_connection_open(NULL, NULL, eq, &test_trsp_conn, NULL);
CU_ASSERT_TRUE_FATAL(res > 0);
event_execute_test(eq, 1);
......@@ -209,7 +209,7 @@ void test_conn_close_open_chan()
struct firefly_connection_actions actions = {
.channel_error = test_channel_error
};
int res = firefly_connection_open(&actions, NULL, eq, &test_trsp_conn);
int res = firefly_connection_open(&actions, NULL, eq, &test_trsp_conn, NULL);
CU_ASSERT_TRUE_FATAL(res > 0);
event_execute_test(eq, 1);
......@@ -247,7 +247,7 @@ void test_conn_close_send_data()
struct firefly_connection_actions actions = {
.channel_error = test_channel_error
};
int res = firefly_connection_open(&actions, NULL, eq, &test_trsp_conn);
int res = firefly_connection_open(&actions, NULL, eq, &test_trsp_conn, NULL);
CU_ASSERT_TRUE_FATAL(res > 0);
event_execute_test(eq, 1);
......@@ -283,7 +283,7 @@ void test_conn_close_send_first()
.close = NULL,
.context = &conn
};
int res = firefly_connection_open(NULL, NULL, eq, &test_trsp_conn);
int res = firefly_connection_open(NULL, NULL, eq, &test_trsp_conn, NULL);
CU_ASSERT_TRUE_FATAL(res > 0);
event_execute_test(eq, 1);
......@@ -316,7 +316,7 @@ void test_conn_close_recv_any()
.close = free_plat_conn_test,
.context = &conn
};
int res = firefly_connection_open(NULL, NULL, eq, &test_trsp_conn);
int res = firefly_connection_open(NULL, NULL, eq, &test_trsp_conn, NULL);
CU_ASSERT_TRUE_FATAL(res > 0);
event_execute_test(eq, 1);
......@@ -363,7 +363,7 @@ void test_conn_close_recv_chan_req_first()
.close = free_plat_conn_test,
.context = &conn
};
int res = firefly_connection_open(&conn_actions, NULL, eq, &test_trsp_conn);
int res = firefly_connection_open(&conn_actions, NULL, eq, &test_trsp_conn, NULL);
CU_ASSERT_TRUE_FATAL(res > 0);
event_execute_test(eq, 1);
......
......@@ -100,7 +100,7 @@ void test_important_signature()
.context = &ps
};
int res = firefly_connection_open(NULL, NULL, eq, &test_trsp_conn);
int res = firefly_connection_open(NULL, NULL, eq, &test_trsp_conn, NULL);
CU_ASSERT_TRUE_FATAL(res > 0);
event_execute_test(eq, 1);
struct firefly_channel *chan = firefly_channel_new(conn);
......@@ -133,7 +133,7 @@ void test_important_recv_ack()
.context = &ps
};
int res = firefly_connection_open(NULL, NULL, eq, &test_trsp_conn);
int res = firefly_connection_open(NULL, NULL, eq, &test_trsp_conn, NULL);
CU_ASSERT_TRUE_FATAL(res > 0);
event_execute_test(eq, 1);
struct firefly_channel *chan = firefly_channel_new(conn);
......@@ -171,7 +171,7 @@ void test_important_signatures_mult()
.context = &ps
};
int res = firefly_connection_open(NULL, NULL, eq, &test_trsp_conn);
int res = firefly_connection_open(NULL, NULL, eq, &test_trsp_conn, NULL);
CU_ASSERT_TRUE_FATAL(res > 0);
event_execute_test(eq, 1);
struct firefly_channel *chan = firefly_channel_new(conn);
......@@ -214,7 +214,7 @@ void test_important_seqno_overflow()
.context = &ps
};
int res = firefly_connection_open(NULL, NULL, eq, &test_trsp_conn);
int res = firefly_connection_open(NULL, NULL, eq, &test_trsp_conn, NULL);
CU_ASSERT_TRUE_FATAL(res > 0);
event_execute_test(eq, 1);
struct firefly_channel *chan = firefly_channel_new(conn);
......@@ -247,7 +247,7 @@ void test_important_send_ack()
.context = &ps
};
int res = firefly_connection_open(NULL, NULL, eq, &test_trsp_conn);
int res = firefly_connection_open(NULL, NULL, eq, &test_trsp_conn, NULL);
CU_ASSERT_TRUE_FATAL(res > 0);
event_execute_test(eq, 1);
struct firefly_channel *chan = firefly_channel_new(conn);
......@@ -288,7 +288,7 @@ void test_not_important_not_send_ack()
.context = &ps
};
int res = firefly_connection_open(NULL, NULL, eq, &test_trsp_conn);
int res = firefly_connection_open(NULL, NULL, eq, &test_trsp_conn, NULL);
CU_ASSERT_TRUE_FATAL(res > 0);
event_execute_test(eq, 1);
struct firefly_channel *chan = firefly_channel_new(conn);
......@@ -327,7 +327,7 @@ void test_important_mult_simultaneously()
.context = &ps
};
int res = firefly_connection_open(NULL, NULL, eq, &test_trsp_conn);
int res = firefly_connection_open(NULL, NULL, eq, &test_trsp_conn, NULL);
CU_ASSERT_TRUE_FATAL(res > 0);
event_execute_test(eq, 1);
struct firefly_channel *chan = firefly_channel_new(conn);
......@@ -414,7 +414,7 @@ void test_errorneous_ack()
.context = &ps
};
int res = firefly_connection_open(NULL, NULL, eq, &test_trsp_conn);
int res = firefly_connection_open(NULL, NULL, eq, &test_trsp_conn, NULL);
CU_ASSERT_TRUE_FATAL(res > 0);
event_execute_test(eq, 1);
struct firefly_channel *chan = firefly_channel_new(conn);
......@@ -470,7 +470,7 @@ void test_important_recv_duplicate()
.context = &ps
};
int res = firefly_connection_open(NULL, NULL, eq, &test_trsp_conn);
int res = firefly_connection_open(NULL, NULL, eq, &test_trsp_conn, NULL);
CU_ASSERT_TRUE_FATAL(res > 0);
event_execute_test(eq, 1);
struct firefly_channel *chan = firefly_channel_new(conn);
......@@ -565,7 +565,7 @@ void test_important_handshake_recv()
.context = &ps
};
int res = firefly_connection_open(&conn_actions, NULL, eq, &test_trsp_conn);
int res = firefly_connection_open(&conn_actions, NULL, eq, &test_trsp_conn, NULL);
CU_ASSERT_TRUE_FATAL(res > 0);
event_execute_test(eq, 1);
......@@ -623,7 +623,7 @@ void test_important_handshake_recv_errors()
.context = &ps
};
int res = firefly_connection_open(&conn_actions, NULL, eq, &test_trsp_conn);
int res = firefly_connection_open(&conn_actions, NULL, eq, &test_trsp_conn, NULL);
CU_ASSERT_TRUE_FATAL(res > 0);
event_execute_test(eq, 1);
......@@ -703,7 +703,7 @@ void test_important_handshake_open()
.context = &ps
};
int res = firefly_connection_open(&conn_actions, NULL, eq, &test_trsp_conn);
int res = firefly_connection_open(&conn_actions, NULL, eq, &test_trsp_conn, NULL);
CU_ASSERT_TRUE_FATAL(res > 0);
event_execute_test(eq, 1);
......@@ -756,7 +756,7 @@ void test_important_handshake_open_errors()
.context = &ps
};
int res = firefly_connection_open(&conn_actions, NULL, eq, &test_trsp_conn);
int res = firefly_connection_open(&conn_actions, NULL, eq, &test_trsp_conn, NULL);
CU_ASSERT_TRUE_FATAL(res > 0);
event_execute_test(eq, 1);
......@@ -811,7 +811,7 @@ void test_important_ack_on_close()
.context = &ps
};
int res = firefly_connection_open(NULL, NULL, eq, &test_trsp_conn);
int res = firefly_connection_open(NULL, NULL, eq, &test_trsp_conn, NULL);
CU_ASSERT_TRUE_FATAL(res > 0);
event_execute_test(eq, 1);
struct firefly_channel *chan = firefly_channel_new(conn);
......
......@@ -197,7 +197,7 @@ static int64_t on_conn_recv_keep(
recv_conn_called = true;
int64_t res = firefly_connection_open(NULL, NULL, eq,
firefly_transport_connection_eth_posix_new(llp,
mac_address, "lo"));
mac_address, "lo"), NULL);
CU_ASSERT_TRUE(res > 0);
return res;
}
......@@ -209,7 +209,7 @@ static int64_t on_conn_recv_keep_two(
recv_conn_called = true;
int64_t res = firefly_connection_open(NULL, NULL, eq,
firefly_transport_connection_eth_posix_new(llp,
mac_address, "lo"));
mac_address, "lo"), NULL);
CU_ASSERT_TRUE_FATAL(res > 0);
return res;
}
......@@ -268,7 +268,7 @@ void test_eth_recv_data()
send_data();
int res = firefly_connection_open(NULL, NULL, eq,
firefly_transport_connection_eth_posix_new(llp,
remote_mac_addr, "lo"));
remote_mac_addr, "lo"), NULL);
CU_ASSERT_TRUE_FATAL(res > 0);
event_execute_test(eq, 1);
......
......@@ -137,7 +137,7 @@ int64_t recv_conn_recv_conn(
struct firefly_transport_connection *conn_udp =
firefly_transport_connection_udp_posix_new(llp, ipaddr, port, 1000);
int64_t res = firefly_connection_open(NULL, NULL, eq, conn_udp);
int64_t res = firefly_connection_open(NULL, NULL, eq, conn_udp, NULL);
return res;
}
......@@ -202,8 +202,9 @@ int64_t recv_data_recv_conn(
}
static struct firefly_connection *tmp_conn;
static void tmp_on_conn_open(struct firefly_connection *conn)
static void tmp_on_conn_open(struct firefly_connection *conn, void *ctx)
{
UNUSED_VAR(ctx);
tmp_conn = conn;
}
......@@ -226,7 +227,7 @@ void test_recv_data()
struct firefly_transport_connection *conn_udp =
firefly_transport_connection_udp_posix_new(llp, ipaddr, port, 1000);
int res = firefly_connection_open(&actions, NULL, eq, conn_udp);
int res = firefly_connection_open(&actions, NULL, eq, conn_udp, NULL);
CU_ASSERT_TRUE_FATAL(res > 0);
event_execute_test(eq, 1);
conn = tmp_conn;
......@@ -339,7 +340,7 @@ int64_t recv_conn_keep_two(struct firefly_transport_llp *llp,
struct firefly_transport_connection *conn_udp =
firefly_transport_connection_udp_posix_new(llp, ipaddr, port, 0);
int64_t res = firefly_connection_open(NULL, NULL, eq, conn_udp);
int64_t res = firefly_connection_open(NULL, NULL, eq, conn_udp, NULL);
return res;
}
......@@ -431,7 +432,7 @@ void test_conn_open_and_send()
struct firefly_transport_connection *conn_udp =
firefly_transport_connection_udp_posix_new(llp,
"127.0.0.1", 55550, 1000);
int res = firefly_connection_open(&actions, NULL, eq, conn_udp);
int res = firefly_connection_open(&actions, NULL, eq, conn_udp, NULL);
CU_ASSERT_TRUE_FATAL(res > 0);