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
|
// Sends the writes and sends the request when the connecting is established
|
||||||
this.socket.once('connect', () => {
|
this.socket.once('connect', () => {
|
||||||
try {
|
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);
|
this.request.sende(this.socket);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
response = stringifyError(error as 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
|
* @param requestBody
|
||||||
*/
|
*/
|
||||||
public writeEntries(requestBody: Pdr2_RequestBody): void {
|
public writeBody(requestBody: Pdr2_RequestBody): void {
|
||||||
// write additionalInformation
|
// writes additional information into the request
|
||||||
for (const tupel of requestBody.additionalInformation) {
|
this.writeEntries(requestBody.additionalInformation);
|
||||||
this.writeEntry(tupel);
|
// writes the amount of upcoming entries into the request
|
||||||
}
|
|
||||||
|
|
||||||
// write amount of argument entries
|
|
||||||
this.writeEntry(['integer', requestBody.arguments.length]);
|
this.writeEntry(['integer', requestBody.arguments.length]);
|
||||||
|
// writes the data entries into the request
|
||||||
// write arguments
|
|
||||||
for (const args of requestBody.arguments) {
|
for (const args of requestBody.arguments) {
|
||||||
for (const tupel of args) {
|
this.writeEntries(args);
|
||||||
this.writeEntry(tupel);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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