Optimierung des pdr2 request flows
This commit is contained in:
parent
8feb2f9e13
commit
fe1c320081
@ -54,7 +54,11 @@ export class ProdressConnection {
|
||||
// Sends the writes and sends the request when the connecting is established
|
||||
this.socket.once('connect', () => {
|
||||
try {
|
||||
this.request.writeEntries(this.requestBody);
|
||||
// sets the flag for awaiting a response to true
|
||||
this.request.writeEntry(['integer', 1]);
|
||||
// writes the body in to the request
|
||||
this.request.writeBody(this.requestBody);
|
||||
// sends the request
|
||||
this.request.sende(this.socket);
|
||||
} catch (error) {
|
||||
response = stringifyError(error as Error);
|
||||
|
||||
@ -26,24 +26,28 @@ export class ProdressRequest extends Request {
|
||||
}
|
||||
|
||||
/**
|
||||
* writes entries based on the provided requestTupelList into the request
|
||||
* writes the provided body into the request
|
||||
* @param requestBody
|
||||
*/
|
||||
public writeEntries(requestBody: Pdr2_RequestBody): void {
|
||||
// write additionalInformation
|
||||
for (const tupel of requestBody.additionalInformation) {
|
||||
this.writeEntry(tupel);
|
||||
}
|
||||
|
||||
// write amount of argument entries
|
||||
public writeBody(requestBody: Pdr2_RequestBody): void {
|
||||
// writes additional information into the request
|
||||
this.writeEntries(requestBody.additionalInformation);
|
||||
// writes the amount of upcoming entries into the request
|
||||
this.writeEntry(['integer', requestBody.arguments.length]);
|
||||
|
||||
// write arguments
|
||||
// writes the data entries into the request
|
||||
for (const args of requestBody.arguments) {
|
||||
for (const tupel of args) {
|
||||
this.writeEntry(tupel);
|
||||
this.writeEntries(args);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* writes entries based on the provided requestTupelList into the request
|
||||
* @param requestTupelList
|
||||
*/
|
||||
public writeEntries(requestTupelList: Pdr2_RequestTupel[]): void {
|
||||
for (const tupel of requestTupelList) {
|
||||
this.writeEntry(tupel);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user