Now, I fiddling with the message writitng code, I get all remote object
messages but in the wrong order. They are sent in the right order, though. Have to chnage the code to use one connection asynchronously for everything only.
This commit is contained in:
29
conman.c
29
conman.c
@ -74,6 +74,15 @@
|
||||
#include "sicshipadaba.h"
|
||||
#include "protocol.h"
|
||||
#include "sicsvar.h"
|
||||
#include <json/json.h>
|
||||
|
||||
/*
|
||||
Greetings from protocol.c for SCLogWrite...
|
||||
*/
|
||||
extern struct json_object *mkJSON_Object(SConnection * pCon, char *pBuffer,
|
||||
int iOut);
|
||||
|
||||
|
||||
/*
|
||||
#define UUDEB 1
|
||||
define UUDEB , for buffer writing for checking encoding */
|
||||
@ -1082,13 +1091,14 @@ int SCPureSockWrite(SConnection * self, char *buffer, int iOut)
|
||||
{
|
||||
char pBueffel[1024];
|
||||
char *pPtr;
|
||||
json_object *myJson = NULL;
|
||||
|
||||
/* for commandlog tail */
|
||||
if (!VerifyConnection(self)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(self->iProtocolID == 5) {
|
||||
if(self->iProtocolID == 4) { /* act */
|
||||
if (strlen(buffer) + 30 > 1024) {
|
||||
pPtr = (char *) malloc((strlen(buffer) + 30) * sizeof(char));
|
||||
memset(pPtr, 0, strlen(buffer) + 20);
|
||||
@ -1100,6 +1110,12 @@ int SCPureSockWrite(SConnection * self, char *buffer, int iOut)
|
||||
if(pPtr != pBueffel){
|
||||
free(pPtr);
|
||||
}
|
||||
} else if(self->iProtocolID == 3) {
|
||||
myJson = mkJSON_Object(self,buffer,iOut);
|
||||
if(myJson != NULL){
|
||||
SCDoSockWrite(self,(char *)json_object_to_json_string(myJson));
|
||||
json_object_put(myJson);
|
||||
}
|
||||
} else {
|
||||
testAndWriteSocket(self, buffer, iOut);
|
||||
}
|
||||
@ -1113,6 +1129,7 @@ int SCLogWrite(SConnection * self, char *buffer, int iOut)
|
||||
{
|
||||
char pBueffel[1024];
|
||||
char *pPtr;
|
||||
json_object *myJson = NULL;
|
||||
|
||||
if (!VerifyConnection(self)) {
|
||||
return 0;
|
||||
@ -1121,7 +1138,7 @@ int SCLogWrite(SConnection * self, char *buffer, int iOut)
|
||||
WriteToCommandLogId(NULL, self->sockHandle, buffer);
|
||||
SetSendingConnection(NULL);
|
||||
|
||||
if(self->iProtocolID == 5) {
|
||||
if(self->iProtocolID == 4) { /* act */
|
||||
if (strlen(buffer) + 30 > 1024) {
|
||||
pPtr = (char *) malloc((strlen(buffer) + 30) * sizeof(char));
|
||||
memset(pPtr, 0, strlen(buffer) + 20);
|
||||
@ -1133,7 +1150,7 @@ int SCLogWrite(SConnection * self, char *buffer, int iOut)
|
||||
if(pPtr != pBueffel){
|
||||
free(pPtr);
|
||||
}
|
||||
} else if(self->iProtocolID == 2) {
|
||||
} else if(self->iProtocolID == 2) { /* withcode */
|
||||
if (strlen(buffer) + 30 > 1024) {
|
||||
pPtr = (char *) malloc((strlen(buffer) + 30) * sizeof(char));
|
||||
memset(pPtr, 0, strlen(buffer) + 20);
|
||||
@ -1145,6 +1162,12 @@ int SCLogWrite(SConnection * self, char *buffer, int iOut)
|
||||
if(pPtr != pBueffel){
|
||||
free(pPtr);
|
||||
}
|
||||
} else if(self->iProtocolID == 3) { /* json */
|
||||
myJson = mkJSON_Object(self,buffer,iOut);
|
||||
if(myJson != NULL){
|
||||
SCDoSockWrite(self,(char *)json_object_to_json_string(myJson));
|
||||
json_object_put(myJson);
|
||||
}
|
||||
} else {
|
||||
testAndWriteSocket(self, buffer, iOut);
|
||||
}
|
||||
|
Reference in New Issue
Block a user