> On Jan. 15, 2015, 7:28 p.m., Ben Mahler wrote: > > src/authentication/cram_md5/authenticator.hpp, lines 485-487 > > <https://reviews.apache.org/r/29887/diff/6/?file=822414#file822414line485> > > > > Have you considered storing the error instead of a boolean? That way, > > you can capture the error and return it consistently on subsequent calls. > > It also cleans the code up a bit: > > > > ``` > > static process::Once* initialized = new process::Once(); > > static Option<Error>* error = new Option<Error>(); > > > > if (!initialized->once()) { > > LOG(INFO) << "Initializing server SASL"; > > > > int result = sasl_server_init(NULL, "mesos"); > > > > if (result != SASL_OK) { > > *error = Error( > > std::string("Failed to initialize SASL: ") + > > sasl_errstring(result, NULL, NULL)); > > } else { > > result = sasl_auxprop_add_plugin( > > InMemoryAuxiliaryPropertyPlugin::name(), > > &InMemoryAuxiliaryPropertyPlugin::initialize); > > > > if (result != SASL_OK) { > > *error = Error( > > std::string("Failed to add in-memory auxiliary property > > plugin: ") + > > sasl_errstring(result, NULL, NULL)); > > } > > } > > > > initialized->done(); > > } > > > > if (error->isSome()) { > > return error->get(); > > } > > ```
Much cleaner, thank you! - Till ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/29887/#review68300 ----------------------------------------------------------- On Jan. 15, 2015, 3:57 a.m., Till Toenshoff wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/29887/ > ----------------------------------------------------------- > > (Updated Jan. 15, 2015, 3:57 a.m.) > > > Review request for mesos, Adam B, Ben Mahler, and Vinod Kone. > > > Bugs: MESOS-2050 > https://issues.apache.org/jira/browse/MESOS-2050 > > > Repository: mesos-git > > > Description > ------- > > see summary. > > > Diffs > ----- > > src/authentication/cram_md5/authenticator.hpp 1819ef4 > > Diff: https://reviews.apache.org/r/29887/diff/ > > > Testing > ------- > > make check (with enhanced verbosity, GLOG_v=2 and gtest_repeat=10000) > > > Thanks, > > Till Toenshoff > >
