This commit is contained in:
parent
0351d50bd3
commit
9cd15aedc4
|
@ -37,7 +37,7 @@ using namespace std;
|
||||||
#define EODMARGIN 3 // minutes
|
#define EODMARGIN 3 // minutes
|
||||||
|
|
||||||
#define EVENT_SIZE ( sizeof (struct inotify_event) )
|
#define EVENT_SIZE ( sizeof (struct inotify_event) )
|
||||||
#define BUF_LEN ( 32 * ( EVENT_SIZE + 16 ) )
|
#define BUF_LEN ( 1024 * ( EVENT_SIZE + 16 ) )
|
||||||
//char *name1 = "bestever.camera"; //
|
//char *name1 = "bestever.camera"; //
|
||||||
//char *name3 = "pricey.holdings"; //
|
//char *name3 = "pricey.holdings"; //
|
||||||
//char *name5 = "greedy.ventures"; //
|
//char *name5 = "greedy.ventures"; //
|
||||||
|
@ -126,7 +126,7 @@ void ausRegEPPTK::registryXOTE() { // PROD in OTE
|
||||||
// meant to be actual production.
|
// meant to be actual production.
|
||||||
|
|
||||||
bool actionableFileEvent,monitoring=true;
|
bool actionableFileEvent,monitoring=true;
|
||||||
int length, i = 0, mSleeps=0, nSleeps=0,debug=10000;
|
int length, i = 0, j, mSleeps=0, nSleeps=0,debug=10000;
|
||||||
int fd, wd;
|
int fd, wd;
|
||||||
char buffer[BUF_LEN];
|
char buffer[BUF_LEN];
|
||||||
|
|
||||||
|
@ -152,7 +152,7 @@ void ausRegEPPTK::registryXOTE() { // PROD in OTE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
while ( length >= 0 && monitoring )
|
while ( length >= 0 && (BUF_LEN - i) >= length && monitoring )
|
||||||
{ actionableFileEvent = false;
|
{ actionableFileEvent = false;
|
||||||
struct inotify_event *event = ( struct inotify_event * ) &buffer[ i ];
|
struct inotify_event *event = ( struct inotify_event * ) &buffer[ i ];
|
||||||
|
|
||||||
|
@ -184,7 +184,6 @@ void ausRegEPPTK::registryXOTE() { // PROD in OTE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
i += EVENT_SIZE + event->len;
|
|
||||||
|
|
||||||
if (actionableFileEvent) { char wxyz[100]; sprintf(wxyz,"./json/%s",event->name);
|
if (actionableFileEvent) { char wxyz[100]; sprintf(wxyz,"./json/%s",event->name);
|
||||||
mdJSON scriptor;
|
mdJSON scriptor;
|
||||||
|
@ -206,9 +205,15 @@ void ausRegEPPTK::registryXOTE() { // PROD in OTE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
j = i;
|
||||||
|
if (i >= (BUF_LEN - (EVENT_SIZE + event->len)))
|
||||||
i = 0;
|
i = 0;
|
||||||
length = read( fd, buffer, BUF_LEN );
|
else
|
||||||
|
i += EVENT_SIZE + event->len;
|
||||||
|
length = read( fd, &buffer[i], (BUF_LEN - j) );
|
||||||
}
|
}
|
||||||
|
if (monitoring)
|
||||||
|
theseLogs->logN(2,"JSON monitoring unexpected end: %d %d.",i,length);
|
||||||
done:
|
done:
|
||||||
( void ) inotify_rm_watch( fd, wd );
|
( void ) inotify_rm_watch( fd, wd );
|
||||||
( void ) close( fd );
|
( void ) close( fd );
|
||||||
|
|
Loading…
Reference in New Issue