Skip to content

Commit

Permalink
Restyled by google-java-format
Browse files Browse the repository at this point in the history
  • Loading branch information
restyled-commits authored and joonhaengHeo committed May 24, 2024
1 parent 48d3da8 commit 60aa0c2
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,11 @@ public void onStopDiscoveryFailed(String serviceType, int errorCode) {
@Override
public void onDiscoveryStopped(String serviceType) {
Log.w(TAG, "Successfully stopped discovery service '" + serviceType);
new Handler(Looper.getMainLooper()).post(() -> {
this.handleServiceBrowse(chipMdnsCallback);
});
new Handler(Looper.getMainLooper())
.post(
() -> {
this.handleServiceBrowse(chipMdnsCallback);
});
}

public void handleServiceBrowse(ChipMdnsCallback chipMdnsCallback) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,22 +120,27 @@ public void onResolveFailed(NsdServiceInfo serviceInfo, int errorCode) {
Log.w(
TAG,
"Failed to resolve service '" + serviceInfo.getServiceName() + "': " + errorCode);
new Handler(Looper.getMainLooper()).post(() -> {
chipMdnsCallback.handleServiceResolve(
serviceInfo.getServiceName(),
// Use the target service info since the resolved service info sometimes appends a
// "." at the front likely because it is trying to strip the service name out of it
// and something is missed.
// The target service info service type should be effectively the same as the
// resolved service info.
NsdServiceFinderAndResolver.this.targetServiceInfo.getServiceType(),
null,
null,
0,
null,
callbackHandle,
contextHandle);
});
new Handler(Looper.getMainLooper())
.post(
() -> {
chipMdnsCallback.handleServiceResolve(
serviceInfo.getServiceName(),
// Use the target service info since the resolved service info sometimes
// appends a
// "." at the front likely because it is trying to strip the service name
// out of it
// and something is missed.
// The target service info service type should be effectively the same as
// the
// resolved service info.
NsdServiceFinderAndResolver.this.targetServiceInfo.getServiceType(),
null,
null,
0,
null,
callbackHandle,
contextHandle);
});

if (multicastLock.isHeld()) {
multicastLock.release();
Expand All @@ -160,23 +165,28 @@ public void onServiceResolved(NsdServiceInfo serviceInfo) {
final String hostName = serviceInfo.getHost().getHostName();
final String address = serviceInfo.getHost().getHostAddress();
final int port = serviceInfo.getPort();
new Handler(Looper.getMainLooper()).post(() -> {
// TODO: Find out if DNS-SD results for Android should contain interface ID
chipMdnsCallback.handleServiceResolve(
serviceInfo.getServiceName(),
// Use the target service info since the resolved service info sometimes appends a
// "." at the front likely because it is trying to strip the service name out of it
// and something is missed.
// The target service info service type should be effectively the same as the
// resolved service info.
NsdServiceFinderAndResolver.this.targetServiceInfo.getServiceType(),
hostName,
address,
port,
serviceInfo.getAttributes(),
callbackHandle,
contextHandle);
});
new Handler(Looper.getMainLooper())
.post(
() -> {
// TODO: Find out if DNS-SD results for Android should contain interface ID
chipMdnsCallback.handleServiceResolve(
serviceInfo.getServiceName(),
// Use the target service info since the resolved service info sometimes
// appends a
// "." at the front likely because it is trying to strip the service name
// out of it
// and something is missed.
// The target service info service type should be effectively the same as
// the
// resolved service info.
NsdServiceFinderAndResolver.this.targetServiceInfo.getServiceType(),
hostName,
address,
port,
serviceInfo.getAttributes(),
callbackHandle,
contextHandle);
});

if (multicastLock.isHeld()) {
multicastLock.release();
Expand Down

0 comments on commit 60aa0c2

Please sign in to comment.