> On July 5, 2018, 7:48 p.m., Gastón Kleiman wrote: > > src/master/master.cpp > > Lines 9794-9806 (original), 9794-9809 (patched) > > <https://reviews.apache.org/r/67722/diff/2/?file=2049190#file2049190line9794> > > > > I personally find the following easier to read than the nested ifs: > > > > ``` > > if (future.isReady() && future.isSome()) { > > LOG(INFO) << "Successfully authenticated principal '" << > > future->get() << "'" > > << " at " << pid; > > > > authenticated.put(pid, future->get()); > > } else if (future.isReady() && !future.isSome()) { > > LOG(WARNING) << "Authentication of " << pid << " was unsuccessful:" > > << " Invalid credentials"; > > } else if (future.isFailed()) { > > LOG(WARNING) << "An error ocurred while attempting to authenticate " > > << pid > > << ": " << future.failure(); > > } else if (future.isDiscarded()) { > > LOG(INFO) << "Authentication of " << pid << " was discarded"; > > } > > ``` > > > > I'm curious about what other people think.
THe only thing I do not agree from your snippet is to log a warning when invalid credentials are passed, afterall that is consider a normal behavior of the program. - Alexander ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/67722/#review205751 ----------------------------------------------------------- On July 3, 2018, 12:17 p.m., Alexander Rojas wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/67722/ > ----------------------------------------------------------- > > (Updated July 3, 2018, 12:17 p.m.) > > > Review request for mesos, Gastón Kleiman, Greg Mann, and Vinod Kone. > > > Repository: mesos > > > Description > ------- > > This patch fixes a bug where the code path could cause a crash because > of calling `Fture<T>::get()` on a future which is failed. > > > Diffs > ----- > > src/master/master.cpp ddc8df0ea82241be6c733237feef1553c7669eb2 > > > Diff: https://reviews.apache.org/r/67722/diff/2/ > > > Testing > ------- > > ```sh > make check > ``` > > > Thanks, > > Alexander Rojas > >