Skip to content

Commit

Permalink
Update holepunch test for changes to offer being stored in holepunch …
Browse files Browse the repository at this point in the history
…session
  • Loading branch information
streetpea committed Oct 31, 2024
1 parent d5db9d6 commit a60423c
Showing 1 changed file with 4 additions and 19 deletions.
23 changes: 4 additions & 19 deletions lib/src/remote/holepunch-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,7 @@ int main(int argc, char **argv)
}
printf(">> Created session\n");

ChiakiHolepunchMessage our_offer_msg_ctrl = NULL;
ChiakiHolepunchCandidate local_candidates = NULL;
err = holepunch_session_create_offer(session, &local_candidates, &our_offer_msg_ctrl);
err = holepunch_session_create_offer(session);
if (err != CHIAKI_ERR_SUCCESS)
{
fprintf(stderr, "!! Failed to create offer msg for ctrl connection");
Expand All @@ -147,47 +145,34 @@ int main(int argc, char **argv)
if (err != CHIAKI_ERR_SUCCESS)
{
fprintf(stderr, "!! Failed to start session\n");
if(local_candidates)
free(local_candidates);
chiaki_holepunch_session_fini(session);
return -1;
}
printf(">> Started session\n");

err = chiaki_holepunch_session_punch_hole(session, local_candidates, our_offer_msg_ctrl, CHIAKI_HOLEPUNCH_PORT_TYPE_CTRL);
err = chiaki_holepunch_session_punch_hole(session, CHIAKI_HOLEPUNCH_PORT_TYPE_CTRL);
if (err != CHIAKI_ERR_SUCCESS)
{
fprintf(stderr, "!! Failed to punch hole for control connection.\n");
if(local_candidates)
free(local_candidates);
chiaki_holepunch_session_fini(session);
return -1;
}
printf(">> Punched hole for control connection!\n");
if(local_candidates)
free(local_candidates);
local_candidates = NULL;

ChiakiHolepunchMessage our_offer_msg_data = NULL;
err = holepunch_session_create_offer(session, &local_candidates, &our_offer_msg_data);
err = holepunch_session_create_offer(session);
if (err != CHIAKI_ERR_SUCCESS)
{
fprintf(stderr, "!! Failed to create offer msg for ctrl connection");
return err;
}
printf(">> Created offer msg for ctrl connection\n");
err = chiaki_holepunch_session_punch_hole(session, local_candidates, our_offer_msg_data, CHIAKI_HOLEPUNCH_PORT_TYPE_DATA);
err = chiaki_holepunch_session_punch_hole(session, CHIAKI_HOLEPUNCH_PORT_TYPE_DATA);
if (err != CHIAKI_ERR_SUCCESS)
{
fprintf(stderr, "!! Failed to punch hole for data connection.\n");
if(local_candidates)
free(local_candidates);
chiaki_holepunch_session_fini(session);
return -1;
}
printf(">> Punched hole for data connection!\n");
if(local_candidates)
free(local_candidates);

printf(">> Successfully punched holes for all neccessary connections!\n");

Expand Down

0 comments on commit a60423c

Please sign in to comment.