Skip to content

Commit

Permalink
Update to set to remote (i.e., STATIC) if candidate is not local
Browse files Browse the repository at this point in the history
  • Loading branch information
streetpea committed May 13, 2024
1 parent 753d078 commit 515936e
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions lib/src/remote/holepunch.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,7 @@ typedef struct http_response_data_t
typedef enum candidate_type_t
{
CANDIDATE_TYPE_STATIC = 0,
CANDIDATE_TYPE_LOCAL = 1,
CANDIDATE_TYPE_DERIVED = 2,
CANDIDATE_TYPE_LOCAL = 1
} CandidateType;

typedef struct candidate_t
Expand Down Expand Up @@ -3418,15 +3417,8 @@ static ChiakiErrorCode session_message_parse(
const char *type_str = json_object_get_string(jobj);
if (strcmp(type_str, "LOCAL") == 0)
candidate.type = CANDIDATE_TYPE_LOCAL;
else if (strcmp(type_str, "STATIC") == 0)
candidate.type = CANDIDATE_TYPE_STATIC;
else if (strcmp(type_str, "DERIVED") == 0)
candidate.type = CANDIDATE_TYPE_DERIVED;
else
{
CHIAKI_LOGE(log, "Type field wasn't LOCAL or STATIC.");
goto invalid_schema;
}
candidate.type = CANDIDATE_TYPE_STATIC;

json_object_object_get_ex(candidate_json, "addr", &jobj);
if (jobj == NULL || !json_object_is_type(jobj, json_type_string))
Expand Down Expand Up @@ -3736,8 +3728,6 @@ static void print_candidate(ChiakiLog *log, Candidate *candidate)
CHIAKI_LOGV(log, "--------------LOCAL CANDIDATE---------------------");
else if(candidate->type == CANDIDATE_TYPE_STATIC)
CHIAKI_LOGV(log, "--------------REMOTE CANDIDATE--------------------");
else if(candidate->type == CANDIDATE_TYPE_DERIVED)
CHIAKI_LOGV(log, "--------------DERIVED CANDIDATE-------------------");
else
CHIAKI_LOGV(log, "--------------CANDIDATE TYPE UNKNOWN--------------");
CHIAKI_LOGV(log, "Address: %s", candidate->addr);
Expand Down

0 comments on commit 515936e

Please sign in to comment.