Skip to content

Commit

Permalink
Undo an accidental commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
jdunkerley authored Jul 9, 2024
1 parent 1ea1b8a commit 910cc9a
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions app/gui2/src/util/net/dataServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ export class DataServer extends ObservableV2<DataServerEvents> {
initialized: Promise<Result<void, Error>>
private initializationScheduled = false
resolveCallbacks = new Map<string, (data: any) => void>()
private hasConnected = false
private hasReceived = false

/** `websocket.binaryType` should be `ArrayBuffer`. */
constructor(
Expand All @@ -69,7 +67,6 @@ export class DataServer extends ObservableV2<DataServerEvents> {
abort.handleDispose(this)

websocket.addEventListener('message', ({ data: rawPayload }) => {
this.hasReceived = true
if (!(rawPayload instanceof ArrayBuffer)) {
console.warn('Data Server: Data type was invalid:', rawPayload)
// Ignore all non-binary messages. If the messages are `Blob`s instead, this is a
Expand All @@ -94,15 +91,10 @@ export class DataServer extends ObservableV2<DataServerEvents> {
this.emit(`${payloadType}`, [payload, uuid])
}
})
websocket.addEventListener('error', (error) => {
console.error('Language Server Binary socket error:', error)
if (!this.hasReceived) {
console.error('Failed before receiving anything from the server')
this.websocket.close()
}
})
websocket.addEventListener('error', (error) =>
console.error('Language Server Binary socket error:', error),
)
websocket.addEventListener('close', () => {
console.error('Websocket Closed.', this.hasConnected, this.hasReceived)
this.scheduleInitializationAfterConnect()
})

Expand All @@ -119,9 +111,6 @@ export class DataServer extends ObservableV2<DataServerEvents> {
this.initializationScheduled = true
this.initialized = new Promise((resolve) => {
const cb = () => {
console.error('Websocket Opened')
this.hasConnected = true
this.hasReceived = false
this.websocket.removeEventListener('open', cb)
this.initializationScheduled = false
resolve(this.initialize())
Expand All @@ -144,7 +133,6 @@ export class DataServer extends ObservableV2<DataServerEvents> {
result.error.log('Error initializing Language Server Binary Protocol')
return result
} else {
this.hasConnected = true
return Ok()
}
}
Expand Down

0 comments on commit 910cc9a

Please sign in to comment.