Minor changes

This commit is contained in:
Loic Guegan 2023-07-15 13:54:03 +02:00
parent a37251135e
commit b80973cbd0
5 changed files with 15 additions and 8 deletions

View file

@ -14,7 +14,10 @@ client: src/client.c
logger: src/logger.c src/utils.c
$(CC) $^ -o $@
start: publisher client
$(error "Not yet implemented")
clean:
rm -f logger client publisher
.PHONY: clean publisher client logger
.PHONY: clean publisher client logger start

View file

@ -1,3 +1,7 @@
##### ZeroMQ
PUBLISHER_PORT=5556
PUBLISHER_ADDR=localhost
LOGGER_DIR=./logs
##### Logger/Publisher
LOGGERS_DIR=./logs
LOG_INTERVAL=30

0
jean
View file

View file

@ -60,7 +60,7 @@ int main (int argc, char *argv [])
int power;
time_t interval;
for(int i=0;i<1;i++){
while(1){
interval=INTERVAL(__loginterval);
*logfilepath='\0';
sprintf(logfilepath,"%s/%ld",__logdir,interval);

View file

@ -40,11 +40,11 @@ int main (int argc, char *argv [])
}
//----- Start publisher
DIR *dr = opendir(__logdir);
struct dirent *de; // Pointer for directory entry
for(int i=0;i<=0;i++){
while(1){
int interval=INTERVAL(__loginterval);
int interval_next=INTERVAL_NEXT(__loginterval);
DIR *dr = opendir(__logdir);
while ((de = readdir(dr)) != NULL){
if(strcmp(de->d_name,".") && strcmp(de->d_name,"..")){
char *client=de->d_name;
@ -61,12 +61,12 @@ int main (int argc, char *argv [])
// Send current one
if(FILE_EXISTS(logfile)){
publish(logfile,client,interval);
remove(logfile);
}
}
}
closedir(dr);
}
closedir(dr);
zmq_close (publisher);
zmq_ctx_destroy (context);
@ -89,5 +89,5 @@ int main (int argc, char *argv [])
}
void publish(char *filepath, char* client, int interval){
printf("Publish!\n");
}