Skip to content

Commit

Permalink
Refine TCP Fast Open option parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
oakaigh committed Jan 21, 2019
1 parent e1219da commit 6867569
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/listener.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,8 @@ accept_listener_protocol(struct Listener *listener, const char *protocol) {

int
accept_listener_fastopen(struct Listener *listener, const char *fastopen) {
if (listener->fastopen = parse_boolean(fastopen))
listener->fastopen = parse_boolean(fastopen);

This comment has been minimized.

Copy link
@oldium

oldium Jul 7, 2019

Contributor

You are reusing existing variable for different purpose, in this case you say that it is a boolean, then you change it to number. This is error prone.

if (listener->fastopen)
listener->fastopen = 3;
else if (strcasecmp(fastopen, "frontend") == 0)
listener->fastopen = 2;
Expand Down

0 comments on commit 6867569

Please sign in to comment.