Procházet zdrojové kódy

DEV: Small changes and some report

master
Christos Houtouridis před 4 roky
rodič
revize
3ec3db11c9
9 změnil soubory, kde provedl 27 přidání a 33 odebrání
  1. binární
      report/report_rtes_Choutouridis_8997.odt
  2. binární
      report/resources/1 -oMC8qPOVoMjB_SNMLiaXQ.jpeg.jpg
  3. binární
      report/resources/452655-mesh-network.jpg
  4. binární
      report/resources/print.png
  5. +1
    -1
      src/client.c
  6. +1
    -1
      src/core.c
  7. +14
    -13
      src/listener.c
  8. +4
    -1
      src/main.c
  9. +7
    -17
      src/msg_impl.h

binární
report/report_rtes_Choutouridis_8997.odt Zobrazit soubor


binární
report/resources/1 -oMC8qPOVoMjB_SNMLiaXQ.jpeg.jpg Zobrazit soubor

Před Za
Šířka: 600  |  Výška: 380  |  Velikost: 46 KiB

binární
report/resources/452655-mesh-network.jpg Zobrazit soubor

Před Za
Šířka: 810  |  Výška: 456  |  Velikost: 46 KiB

binární
report/resources/print.png Zobrazit soubor

Před Za
Šířka: 1366  |  Výška: 768  |  Velikost: 188 KiB

+ 1
- 1
src/client.c Zobrazit soubor

@@ -205,7 +205,7 @@ static void client (void) {
msg_t msg; // new message buffer
while (true) {
// Idle until the time comes
sleep (settings.msgInterval + (rand()%settings.msgRand));
sleep (settings.msgInterval + (rand()%(5*settings.msgInterval)));
memset ((void*)&msg, 0, sizeof (msg)); // create a new message
cMsg_make (&msg.cMsg);
msg.sender = settings.me;


+ 1
- 1
src/core.c Zobrazit soubor

@@ -345,7 +345,7 @@ bool_t cMsg_equal (cMsg_t* m1, cMsg_t* m2) {
if (m1->from != m2->from) return false;
if (m1->to != m2->to) return false;
if (m1->ts != m2->ts) return false;
if (strncmp (m1->text, m2->text, sizeof(m1->text)))
if (strncmp (m1->text, m2->text, strlen(m1->text)))
return false;
return true;
}


+ 14
- 13
src/listener.c Zobrazit soubor

@@ -34,10 +34,23 @@ static void listen_handler (devAEM_t dev, char_t* buffer, size_t size) {
mIter_t myCopy = msgList_find (&msgList, &msg); // try to find message in msgList
if (myCopy == -1) {
// We don't have a copy, accept and store it
msgList_add (&msgList, &msg);
mIter_t slot = msgList_add (&msgList, &msg);
msgList_release ();
statsUpdateIn (&msg, false); // message process
log_msg_in (&msg); // log
// Processing...
devList_acquire();
dIter_t d = devList_getIter (dev);
dIter_t f = devList_getIter (msg.cMsg.from);
devList_release();
msgList_acquire ();
// Do not echo message to sender, he already has it
msgList.m[slot].recipients[d] = true;
// don't push back message to creator, he already has it
msgList.m[slot].recipients[f] = true;
msgList_release ();
}
else {
// We have a copy
@@ -45,18 +58,6 @@ static void listen_handler (devAEM_t dev, char_t* buffer, size_t size) {
statsUpdateIn (&msg, true); // message process
log_debug ("Debug: Duplicate message from: %d\n", msg.sender);
}
// Processing...
devList_acquire();
dIter_t d = devList_getIter (dev);
dIter_t f = devList_getIter (msg.cMsg.from);
devList_release();
msgList_acquire ();
// Do not echo message to sender, he already has it
msgList.m[myCopy].recipients[d] = true;
// don't push back message to creator, he already has it
msgList.m[myCopy].recipients[f] = true;
msgList_release ();
}
/*!


+ 4
- 1
src/main.c Zobrazit soubor

@@ -30,7 +30,7 @@ stats_t stats; //!< Statistical data
/*!
* CLI short options
*/
const char *short_opt = "v:i:p:s:w:th";
const char *short_opt = "v:i:m:p:s:w:th";
/*!
* CLI long options
@@ -38,6 +38,7 @@ const char *short_opt = "v:i:p:s:w:th";
const struct option long_opt[] = {
{"outlevel", required_argument, NULL, 'v'},
{"interval", required_argument, NULL, 'i'},
{"msginterval", required_argument, NULL, 'm'},
{"pingtimeout",required_argument, NULL, 'p'},
{"sendtimeout",required_argument, NULL, 's'},
{"who", required_argument, NULL, 'w'},
@@ -70,6 +71,7 @@ int parse_args (settings_t *s, int argc, char const *argv[]) {
if (s->outLevel < OUTLEVEL_0) s->outLevel = OUTLEVEL_0;
break;
case 'i': s->seekerInterval = atoi (optarg); break;
case 'm': s->msgInterval = atoi (optarg); break;
case 'p': s->pingTimeout = atoi (optarg); break;
case 's': s->sendTimeout.tv_sec = atoi (optarg); break;
case 'w': s->me = atoi (optarg); break;
@@ -78,6 +80,7 @@ int parse_args (settings_t *s, int argc, char const *argv[]) {
printf ("Syntax:\nrtes_final [-t] [-v num] [-i num] [-p num] [-s num] [-w num]\n\n");
printf ("-v, --outlevel num: Change the verbosity of the program, num can be 0, 1 or 2\n");
printf ("-i, --interval sec: Set the interval of the seeker in [sec]\n");
printf ("-m, --msginterval sec: Set the interval of the client in [sec]\n");
printf ("-p, --pingtimeout sec: Set the ping timeout in [sec]\n");
printf ("-s, --sendtimeout sec: Set the connect/send timeout in [sec]\n");
printf ("-w, --who AEM: Select the AEM of the device\n");


+ 7
- 17
src/msg_impl.h Zobrazit soubor

@@ -19,20 +19,12 @@
/*!
* AEM list
*/
#define AEMLIST_SIZE (10)
#define AEMLIST { \
7700, \
8261, \
8765, \
8844, \
8880, \
8861, \
8877, \
8941, \
8934, \
8997 \
}
#define AEMLIST_SIZE (6)
#define AEMLIST_0 { 7700, 8261, 8765, 8844, 8880, 8861, 8877, 8941, 8934, 8997 }
#define AEMLIST_1 { 8918, 8929, 8997, 8880, 8844, 8861 }
#define AEMLIST AEMLIST_1
/*!
* General options
@@ -219,7 +211,6 @@ typedef struct {
uint16_t port;
time_t seekerInterval;
time_t msgInterval;
time_t msgRand;
outLevel_en outLevel;
time_t pingTimeout;
timeval_t sendTimeout;
@@ -233,11 +224,10 @@ extern settings_t settings;
.port = 2288, \
.seekerInterval = 30, \
.msgInterval = 60, \
.msgRand = 240, \
.outLevel = OUTLEVEL_1, \
.pingTimeout = 1, \
.sendTimeout = {4, 0}, \
.trackTime = true \
.trackTime = false \
}
//! @}


Načítá se…
Zrušit
Uložit