Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Failed connection fix #8033

Merged
merged 1 commit into from
May 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,15 @@ export const promisedRequest = (network: SocketWebRTCClientNetwork, type: any, d
}

const handleFailedConnection = (locationConnectionFailed) => {
console.log('handleFailedConnection', locationConnectionFailed)
if (locationConnectionFailed) {
const currentLocation = getMutableState(LocationState).currentLocation.location
const locationInstanceConnectionState = getMutableState(LocationInstanceState)
const instanceId = getState(NetworkState).hostIds.world ?? ''
if (!locationInstanceConnectionState.instances[instanceId]?.connected?.value) {
if (
!locationInstanceConnectionState.instances[instanceId]?.connected?.value &&
!locationInstanceConnectionState.instances[instanceId]?.connecting?.value
) {
dispatchAction(LocationInstanceConnectionAction.disconnect({ instanceId }))
LocationInstanceConnectionService.provisionServer(
currentLocation.id.value,
Expand Down
1 change: 1 addition & 0 deletions packages/instanceserver/src/NetworkFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,7 @@ export async function handleHeartbeat(network: SocketWebRTCServerNetwork, spark:

export async function handleDisconnect(network: SocketWebRTCServerNetwork, spark: Spark, peerID: PeerID): Promise<any> {
const userId = getUserIdFromPeerID(network, peerID) as UserId
console.log('peers', network.peers)
const disconnectedClient = network.peers.get(peerID)
if (!disconnectedClient) return logger.warn(`Tried to handle disconnect for peer ${peerID} but was not found`)
// On local, new connections can come in before the old sockets are disconnected.
Expand Down
8 changes: 4 additions & 4 deletions packages/server-core/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ export const config = {
listenInfos: [
{
protocol: 'udp',
ip: configFile.instanceserver.hostname! || '0.0.0.0',
ip: configFile.instanceserver.domain! || '0.0.0.0',
announcedIp: null! as string,
port: process.env.DEV_CHANNEL === 'true ' ? 30000 : 40000
},
{
protocol: 'tcp',
ip: configFile.instanceserver.hostname! || '0.0.0.0',
ip: configFile.instanceserver.domain! || '0.0.0.0',
announcedIp: null! as string,
port: process.env.DEV_CHANNEL === 'true' ? 30000 : 40000
}
Expand Down Expand Up @@ -95,13 +95,13 @@ export const localConfig = {
listenInfos: [
{
protocol: 'udp',
ip: configFile.instanceserver.hostname! || '0.0.0.0',
ip: configFile.instanceserver.domain! || '0.0.0.0',
announcedIp: null! as string,
port: process.env.DEV_CHANNEL === 'true' ? 30000 : configFile.instanceserver.rtc_start_port
},
{
protocol: 'tcp',
ip: configFile.instanceserver.hostname! || '0.0.0.0',
ip: configFile.instanceserver.domain! || '0.0.0.0',
announcedIp: null! as string,
port: process.env.DEV_CHANNEL === 'true' ? 30000 : configFile.instanceserver.rtc_start_port
}
Expand Down
4 changes: 2 additions & 2 deletions packages/server-core/src/route/route/route.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { v4 as uuid } from 'uuid'
import { destroyEngine } from '@etherealengine/engine/src/ecs/classes/Engine'

import { Application } from '../../../declarations'
import { createFeathersExpressApp } from '../../createApp'
import { createFeathersKoaApp } from '../../createApp'
import { deleteFolderRecursive } from '../../util/fsHelperFunctions'

const params = { isInternal: true } as any
Expand Down Expand Up @@ -52,7 +52,7 @@ describe('route.test', () => {
let testRoute: string

before(async () => {
app = createFeathersExpressApp()
app = createFeathersKoaApp()
await app.setup()
})

Expand Down