removed ret from caller checks; fixed stopcrypto and startcrypto
This commit is contained in:
parent
e7e1ef55d6
commit
9c8b85c809
|
|
@ -62,7 +62,7 @@ int start_crypto(const char *pass) {
|
|||
size_t errm_size;
|
||||
|
||||
int result = SendCall(STARTCRYPTO, pass, &ret, &errm, &errm_size);
|
||||
if (result != 0 || ret != 0) {
|
||||
if (result != 0) {
|
||||
std::cout << "Start Crypto failed. return is " << ret << " and message is "
|
||||
<< (errm ? errm : "no message") << std::endl;
|
||||
} else {
|
||||
|
|
@ -80,7 +80,7 @@ int stop_crypto() {
|
|||
size_t errm_size;
|
||||
|
||||
int result = SendCall(STOPCRYPTO, "", &ret, &errm, &errm_size);
|
||||
if (result != 0 || ret != 0) {
|
||||
if (result != 0) {
|
||||
std::cout << "Stop Crypto failed. return is " << ret << " and message is "
|
||||
<< (errm ? errm : "no message") << std::endl;
|
||||
} else {
|
||||
|
|
@ -98,7 +98,7 @@ int finalize() {
|
|||
size_t errm_size;
|
||||
|
||||
int result = SendCall(FINALIZE, "", &ret, &errm, &errm_size);
|
||||
if (result != 0 || ret != 0) {
|
||||
if (result != 0) {
|
||||
std::cout << "Finalize failed. return code is " << result << ", ret is "
|
||||
<< ret << ", and message is " << (errm ? errm : "no message")
|
||||
<< std::endl;
|
||||
|
|
|
|||
|
|
@ -145,6 +145,8 @@ int SendCall(int id /*IN*/, const char *path /*IN*/, int *ret /*OUT*/,
|
|||
return -4;
|
||||
}
|
||||
|
||||
debug(D_NOTICE, "SendCall: Sending message type %d, path '%s'", id, path);
|
||||
|
||||
// prepare and send the message to the socket
|
||||
message *mes = (message *)sendbuf;
|
||||
memset(mes, 0, sendsize);
|
||||
|
|
@ -171,6 +173,7 @@ int SendCall(int id /*IN*/, const char *path /*IN*/, int *ret /*OUT*/,
|
|||
}
|
||||
sendbytes += rc;
|
||||
}
|
||||
debug(D_NOTICE, "SendCall: Sent %lu bytes", sendbytes);
|
||||
|
||||
if (sendbytes != mes->length) {
|
||||
sprintf((char *)error_msg,
|
||||
|
|
@ -221,6 +224,8 @@ int SendCall(int id /*IN*/, const char *path /*IN*/, int *ret /*OUT*/,
|
|||
}
|
||||
}
|
||||
|
||||
debug(D_NOTICE, "SendCall: Received %zu bytes", recvbytes);
|
||||
|
||||
if (!received_data) {
|
||||
*ret = 0;
|
||||
*out = strdup("");
|
||||
|
|
@ -234,6 +239,16 @@ int SendCall(int id /*IN*/, const char *path /*IN*/, int *ret /*OUT*/,
|
|||
result = 0;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (recvbytes >= sizeof(message)) {
|
||||
message *rep = (message *)recvbuf;
|
||||
debug(D_NOTICE, "SendCall: Received message type: %d, length: %lu",
|
||||
rep->type, rep->length);
|
||||
if (recvbytes >= rep->length) {
|
||||
debug(D_NOTICE, "SendCall: Entire message content: '%s'", rep->value);
|
||||
}
|
||||
}
|
||||
|
||||
if (recvbytes < sizeof(message)) {
|
||||
debug(D_ERROR, "got incomplete message from socket");
|
||||
*ret = -250;
|
||||
|
|
|
|||
Loading…
Reference in New Issue