Skip to content

Commit

Permalink
Revert back to type script 3.5.3 to resolve compatability problems. (#…
Browse files Browse the repository at this point in the history
…133)

* Don't send auth header if there's no auth value

* Back to 3.5.3

* If the service never sends any messages and the connection fails, don't reconnect.
  • Loading branch information
rhurey committed Jan 29, 2020
1 parent c33ee85 commit 6c42928
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"source-map-loader": "^0.2.4",
"ts-jest": "^24.2.0",
"tslint": "^5.20.1",
"typescript": "^3.7.3",
"typescript": "^3.5.3",
"webpack-stream": "^5.2.1"
},
"scripts": {
Expand Down
8 changes: 7 additions & 1 deletion src/common.speech/ServiceRecognizerBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export abstract class ServiceRecognizerBase implements IDisposable {
private privSpeechContext: SpeechContext;
private privDynamicGrammar: DynamicGrammarBuilder;
private privAgentConfig: AgentConfig;
private privServiceHasSentMessage: boolean;
protected privRequestSession: RequestSession;
protected privConnectionId: string;
protected privRecognizerConfig: RecognizerConfig;
Expand Down Expand Up @@ -347,6 +348,7 @@ export abstract class ServiceRecognizerBase implements IDisposable {
return this.fetchConnection().on((connection: IConnection): Promise<IConnection> => {
return connection.read()
.onSuccessContinueWithPromise((message: ConnectionMessage) => {

if (this.receiveMessageOverride !== undefined) {
return this.receiveMessageOverride();
}
Expand All @@ -364,6 +366,8 @@ export abstract class ServiceRecognizerBase implements IDisposable {
}
}

this.privServiceHasSentMessage = true;

const connectionMessage = SpeechConnectionMessage.fromConnectionMessage(message);

if (connectionMessage.requestId.toLowerCase() === this.privRequestSession.requestId.toLowerCase()) {
Expand Down Expand Up @@ -488,9 +492,11 @@ export abstract class ServiceRecognizerBase implements IDisposable {
if (this.privConnectionPromise) {
if (this.privConnectionPromise.result().isCompleted &&
(this.privConnectionPromise.result().isError
|| this.privConnectionPromise.result().result.state() === ConnectionState.Disconnected)) {
|| this.privConnectionPromise.result().result.state() === ConnectionState.Disconnected) &&
this.privServiceHasSentMessage === true) {
this.privConnectionId = null;
this.privConnectionPromise = null;
this.privServiceHasSentMessage = false;
return this.connectImpl();
} else {
return this.privConnectionPromise;
Expand Down

0 comments on commit 6c42928

Please sign in to comment.