mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-02-03 00:24:57 +01:00
Dev/server malloc check (#1023)
* usleep in communication to actually relay the err message of memory allocation to the client (weird but test for now), function in server to handle memory allcoation issues (updates mess, ret and sendsit to the client and returns prior from function implementatin, setting fnum in client for the speicific functions that send to detector each argument separtely, they need to remember the fnum else they throw with the incorrect fnum * server: every malloc must check if it succeeded, rearranging so that the free is clear as well (only in funcs so far) * fixed malloc checks in other places other than funcs.c
This commit is contained in:
@@ -590,13 +590,16 @@ int Server_SendResult(int fileDes, intType itype, void *retval,
|
||||
sendData(fileDes, &ret1, sizeof(ret1), INT32);
|
||||
if (ret == FAIL) {
|
||||
// send error message
|
||||
if (strlen(mess))
|
||||
if (strlen(mess)) {
|
||||
sendData(fileDes, mess, MAX_STR_LENGTH, OTHER);
|
||||
usleep(0); // test
|
||||
}
|
||||
// debugging feature. should not happen.
|
||||
else
|
||||
else {
|
||||
LOG(logERROR, ("No error message provided for this failure in %s "
|
||||
"server. Will mess up TCP.\n",
|
||||
(isControlServer ? "control" : "stop")));
|
||||
}
|
||||
}
|
||||
// send return value
|
||||
sendData(fileDes, retval, retvalSize, itype);
|
||||
|
||||
Reference in New Issue
Block a user