Skip to content

Commit

Permalink
Merge pull request #6 from ThibaultBee/bugfix/setSockOpt
Browse files Browse the repository at this point in the history
  • Loading branch information
ThibaultBee authored Aug 27, 2020
2 parents b83ddf1 + 0660d81 commit 105b376
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions lib/src/main/cpp/glue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,13 +304,14 @@ nativeSetSockOpt(JNIEnv *env,
int optval_len = 0;
const void *optval = srt_optval_j2n(env, optVal, &optval_len);

int res = srt_setsockopt((SRTSOCKET) u,
0 /*level: ignored*/, (SRT_SOCKOPT) sockopt, optval, optval_len);

if (!optval) {
free((void *) optval);
return -EFAULT;
}

int res = srt_setsockopt((SRTSOCKET) u,
0 /*level: ignored*/, (SRT_SOCKOPT) sockopt, optval, optval_len);
free((void *) optval);

return
res;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/src/main/cpp/structs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ srt_optval_j2n(JNIEnv *env, jobject optVal, int *optval_len) {
return nullptr;
}

if (strcmp(class_name, "java.lang.String;") == 0) {
if (strcmp(class_name, "java.lang.String") == 0) {
const char *optval = env->GetStringUTFChars((jstring) optVal, nullptr);
*optval_len = strlen(optval);
srt_optval = strdup(optval);
Expand Down

0 comments on commit 105b376

Please sign in to comment.