Skip to content

Commit

Permalink
enhancement(activity.c): prevent flooding logcat with `Connection ref…
Browse files Browse the repository at this point in the history
…used` messages
  • Loading branch information
twaik committed Feb 10, 2025
1 parent 500779a commit b7c315f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions app/src/main/cpp/lorie/activity.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ static jboolean requestConnection(__unused JNIEnv *env, __unused jclass clazz) {
check(r < 0, "poll failed: %s", strerror(errno));
socklen_t len = sizeof(so_error);
check(getsockopt(sock, SOL_SOCKET, SO_ERROR, &so_error, &len) < 0, "getsockopt failed: %s", strerror(errno));
if (so_error == ECONNREFUSED) goto end; // Regular situation which happens often if server is not started. No need to spam logcat with this.
check(so_error != 0, "Connection failed: %s", strerror(so_error));

check(write(sock, MAGIC, sizeof(MAGIC)) < 0, "failed to send message: %s", strerror(errno));
Expand Down

0 comments on commit b7c315f

Please sign in to comment.