-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ci lamp dev clean #13
base: ci_lamp_dev
Are you sure you want to change the base?
Conversation
…odules into ci_lamp_dev_clean
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unit tests I didn't properly review. Could you reply to my comments and fix where applicable?
@@ -9,7 +9,7 @@ TEST_LDFLAGS=-pthread $(PREFIX)/modules/*.o $(PREFIX)/lib/*.o -lvdeplug -lpcap | |||
OPTIONS?= | |||
UNITS_DIR=../build/test/units | |||
|
|||
CFLAGS=-I$(PICOTCP)/build/include | |||
CFLAGS=-I$(PICOTCP)/build/include -I../../../out/include -I../../wolfssl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like the ../../.. a lot. Do we refer to the output directory while building or should we be using the .h files from the source code?
@frederikvs @mkrrr your take?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
going to something similar to the $(PICOTCP)
would already be an improvement IMO. Create an environment var to hold the path to other libraries, use that in the -I
.
/* Uncomment the following include to compile picotcp-modules in | ||
* ci_lamp_dev_clean branch on its own and not with tass-connected-device | ||
* */ | ||
//#include <wolfcrypt/src/coding.c> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@VincentDeHaen Any clue how we can do this less hackerish? The code should work nomatter where we are compiling it from...
@@ -277,6 +283,11 @@ static int8_t pico_http_uri_destroy(struct pico_http_uri *urikey) | |||
PICO_FREE(urikey->host); | |||
urikey->host = NULL; | |||
} | |||
if (urikey->user_pass) | |||
{ | |||
PICO_FREE(urikey->resource); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bug. Please fix the ->resource
@@ -330,7 +341,9 @@ static int8_t pico_process_uri(const char *uri, struct pico_http_uri *urikey) | |||
dbg("Start: pico_process_uri(..) %s\n", uri); | |||
if (!uri || !urikey || uri[0] == '/') | |||
{ | |||
if (urikey) pico_http_uri_destroy(urikey); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what the code style policy is, but I prefer the explicit use of { } and to put each thing on its own line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, it's a bit confusing to first check on the possible non-existance of the urikey variable, and then to check on that it exists. Can you write the code differently? (could be that I'm nitpicking, then just ignore this comment :-))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use of { } is debatable, I don't really mind them missing, but it's definitely more readable if the body of the if is on its own line.
@@ -378,27 +392,22 @@ static int8_t pico_process_uri(const char *uri, struct pico_http_uri *urikey) | |||
index++; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Phew this function is getting very long. Could you rework this into different smaller functions? (or at least create a jira ticket for it)
{ | ||
client->connectionID = global_client_conn_ID++; | ||
} | ||
client->connectionID = connID >= 0 ? connID : global_client_conn_ID++; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here brackets would improve readability. Just to verify: you know that global_client_conn_ID is only incremeted AFTER it's assigned? That's ok?
@@ -1895,15 +1909,15 @@ static inline int32_t read_chunked_data(struct pico_http_client *client, unsigne | |||
{ | |||
uint32_t len_read = 0; | |||
int32_t value; | |||
/* read the chunk line */ | |||
// read the chunk line |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these comments were actually done on purpose. The old comments are the actual proper C-style comments
@@ -2384,7 +2402,7 @@ int8_t pico_http_set_close_ev(uint16_t conn) | |||
return HTTP_RETURN_ERROR; | |||
} | |||
client->wakeup(EV_HTTP_CLOSE, client->connectionID); | |||
|
|||
return EV_HTTP_CLOSE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's the impact of this line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Getting rid of warning.
"UG9vb3dlcjpyYW5nZXI=", "c3VwZXI6cHdk", "aWFtOmdvZA=="}; | ||
|
||
int i; | ||
for (i = 0; i < 9; i++){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there are ways to get rid of the hardcoded 9, but maybe not :-)
for (i = 0; i < 9; i++){ | ||
char buffout[256]; | ||
word32 outLen = sizeof(buffout); | ||
Base64_Encode((byte*) userpass[i], strlen(userpass[i]), (byte*) buffout, &outLen); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So here we're actually testing the code from someone else?
@@ -1,4 +1,6 @@ | |||
PICOTCP?=../../picotcp | |||
WOLFSSL?=../../wolfssl | |||
OUT?=../../../out |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@frederikvs Do we usually get the header files from the out directory ? Although, with the picotcp one it seems that we're also retrieving them from the build directory...
@phalox Can you review ? I need to add some task to Jira to refactor some functions but now it's working both on our computers and on jenkins. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you change the buffout declaration to a DEFINE lenght? Then you also don't need the sizeof(). Please name this properly so that we know why it's 256 bytes long.
// removing the trailing \n from the base46_Encode | ||
buffout[strlen(buffout)-2] = '\0'; | ||
// removing the trailing \n from the base46_Encode | ||
buffout[strlen(buffout)-1] = '\0'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm guessing this was a bug before?
if (Base64_Encode((byte*) buffin, (word32) inLen, (byte*) buffout, (word32*) &outLen) != 0){ | ||
// encoding error | ||
dbg("error happened while encoding\n"); | ||
} | ||
// removing the trailing \n from the base46_Encode | ||
buffout[strlen(buffout)-2] = '\0'; | ||
// removing the trailing \n from the base46_Encode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
be careful with spacing. Can you verify if these files were made with tabs or with spaces. Stay consistent.
Phew this "pico_process_uri" function got really ugly over time. Could you rework the code? Make smaller functions out of this, get rid of magic numers/calculations of length... |
I'm not really sure to have the time to refactor all the function right now because we'll do a demo now and it's my last afternoon before going to Barco. So I'll make a task on jira ? |
Sure! :-) Or maybe on github in this repository ( @frederikvs where do you think such a ticket belongs?) |
@phalox Could you review this ?