Skip to content

Commit

Permalink
remove sync from channel closing (#118)
Browse files Browse the repository at this point in the history
<!--
Thank you for your contribution to the Kurento project.
Please provide enough information so that others can review your Pull
Request.

For more information, see the Contribution Guidelines:
https://github.com/Kurento/kurento/blob/main/.github/CONTRIBUTING.md
-->


## What is the current behavior you want to change?
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
-->


## What is the new behavior provided by this change?
<!--
Example: "Adding a function to do X",
then explain why it is necessary to have a way to do X.
-->


## How has this been tested?
<!--
Please describe in detail how you tested your changes.
Include details of your testing environment, tests ran to see how
your change affects other areas of the code, etc.
-->


## Types of changes
<!--
What types of changes does your code introduce?
Put an 'x' in all the boxes that apply:
-->
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature / enhancement (non-breaking change which improves the
project)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] My change requires a change to the documentation
- [ ] My change requires a change in other repository <!-- Explain which
one -->


## Checklist
<!--
Go over all the following points, and put an 'x' in all the boxes that
apply.
If you're unsure about any of these, don't hesitate to ask. We're here
to help!
-->
- [ ] I have read the [Contribution
Guidelines](https://github.com/Kurento/kurento/blob/main/.github/CONTRIBUTING.md)
- [ ] I have added an explanation of what the changes do and why they
should be included
- [ ] I have written new tests for the changes, as applicable, and have
successfully run them locally
  • Loading branch information
slabajo authored Feb 18, 2025
2 parents e1fd99e + 708bce8 commit 525b505
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.Future;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
Expand Down Expand Up @@ -356,11 +357,11 @@ public void closeNativeClient() {
handler = null;
}

private void closeChannel() {
private Future<Void> closeChannel() {
if (channel != null) {
log.debug("{} Closing client", label);
try {
channel.close().sync();
return channel.close();
} catch (Exception e) {
log.debug("{} Could not properly close websocket client. Reason: {}", label, e.getMessage(),
e);
Expand All @@ -369,6 +370,7 @@ private void closeChannel() {
} else {
log.warn("{} Trying to close a JsonRpcClientNettyWebSocket with channel == null", label);
}
return null;
}

}

0 comments on commit 525b505

Please sign in to comment.