debug: Add detailed logging for handshake sp_address

**Motivations :**
- Debug why sp_address is empty in handshake message
- Understand why relay readiness check fails

**Modifications :**
- Added detailed logging in handleHandshakeMsg to inspect sp_address
- Added warning when sp_address is empty or undefined

**Pages affectées :**
- src/services/service.ts - Enhanced handshake debugging
This commit is contained in:
NicolasCantu 2025-10-23 19:13:30 +02:00
parent bec3ab1729
commit c21de2b943

View File

@ -836,7 +836,7 @@ export default class Services {
updateCreatorStatus('⏳ Waiting for relays to be ready...');
await this.getRelayReadyPromise();
// Vérifier que nous avons maintenant un spAddress
const relays = this.getAllRelays();
const relayAddress = relays.find(relay => relay.spAddress && relay.spAddress.trim() !== '')?.spAddress;
@ -2109,10 +2109,20 @@ export default class Services {
public async handleHandshakeMsg(url: string, parsedMsg: any) {
try {
const handshakeMsg: HandshakeMessage = JSON.parse(parsedMsg);
console.log('🔍 DEBUG: Handshake message received:', {
url,
hasSpAddress: !!handshakeMsg.sp_address,
spAddress: handshakeMsg.sp_address,
spAddressType: typeof handshakeMsg.sp_address,
spAddressLength: handshakeMsg.sp_address?.length
});
if (handshakeMsg.sp_address) {
this.updateRelay(url, handshakeMsg.sp_address);
this.relayAddresses[url] = handshakeMsg.sp_address;
this.resolveRelayReady();
} else {
console.warn('⚠️ Handshake received but sp_address is empty or undefined');
}
console.log('handshakeMsg:', handshakeMsg);