Transports: Add method to get connected transport for peer

currently unused, for debugging only
This commit is contained in:
zzz
2026-03-19 10:05:17 -04:00
parent 50dda23e11
commit 80bb2b767f
3 changed files with 33 additions and 0 deletions

View File

@@ -108,6 +108,14 @@ public abstract class CommSystemFacade implements Service {
public abstract boolean isEstablished(Hash peer);
public byte[] getIP(Hash dest) { return null; }
public void queueLookup(byte[] ip) {}
/**
* For debugging
*
* @return the identifier for the transport if connected, or null
* @since 0.9.69
*/
public String getTransport(Hash peer) { return null; }
/**
* Tell the comm system that we may disconnect from this peer.

View File

@@ -186,6 +186,17 @@ public class CommSystemFacadeImpl extends CommSystemFacade {
public boolean isEstablished(Hash peer) {
return _manager.isEstablished(peer);
}
/**
* For debugging
*
* @return the identifier for the transport if connected, or null
* @since 0.9.69
*/
@Override
public String getTransport(Hash peer) {
return _manager.getTransport(peer);
}
/**
* @return a new list, may be modified

View File

@@ -638,6 +638,20 @@ public class TransportManager implements TransportEventListener {
return false;
}
/**
* For debugging
*
* @return the identifier for the transport if connected, or null
* @since 0.9.69
*/
String getTransport(Hash peer) {
for (Transport t : _transports.values()) {
if (t.isEstablished(peer))
return t.getStyle();
}
return null;
}
/**
* @return a new list, may be modified
* @since 0.9.34