@@ -378,8 +378,8 @@ void ControlConnection::refresh_node(RefreshNodeType type, const Address& addres
378378
379379 LOG_DEBUG (" Refresh node: %s" , query.c_str ());
380380
381- if ( write_and_flush ( RequestCallback::Ptr (
382- new RefreshNodeCallback (address, type, is_all_peers, query, this )) ) < 0 ) {
381+ RequestCallback::Ptr callback ( new RefreshNodeCallback (address, type, is_all_peers, query, this ));
382+ if ( write_and_flush (callback ) < 0 ) {
383383 LOG_ERROR (" No more stream available while attempting to refresh node info" );
384384 defunct ();
385385 }
@@ -448,8 +448,9 @@ void ControlConnection::refresh_keyspace(const StringRef& keyspace_name) {
448448
449449 LOG_DEBUG (" Refreshing keyspace %s" , query.c_str ());
450450
451- if (write_and_flush (RequestCallback::Ptr (
452- new RefreshKeyspaceCallback (keyspace_name.to_string (), query, this ))) < 0 ) {
451+ RequestCallback::Ptr callback (
452+ new RefreshKeyspaceCallback (keyspace_name.to_string (), query, this ));
453+ if (write_and_flush (callback) < 0 ) {
453454 LOG_ERROR (" No more stream available while attempting to refresh keyspace info" );
454455 defunct ();
455456 }
@@ -594,8 +595,9 @@ void ControlConnection::refresh_type(const StringRef& keyspace_name, const Strin
594595
595596 LOG_DEBUG (" Refreshing type %s" , query.c_str ());
596597
597- if (!write_and_flush (RequestCallback::Ptr (new RefreshTypeCallback (
598- keyspace_name.to_string (), type_name.to_string (), query, this )))) {
598+ RequestCallback::Ptr callback (
599+ new RefreshTypeCallback (keyspace_name.to_string (), type_name.to_string (), query, this ));
600+ if (write_and_flush (callback) < 0 ) {
599601 LOG_ERROR (" No more stream available while attempting to refresh type info" );
600602 defunct ();
601603 }
@@ -654,9 +656,10 @@ void ControlConnection::refresh_function(const StringRef& keyspace_name,
654656 request->set (1 , CassString (function_name.data (), function_name.size ()));
655657 request->set (2 , signature.get ());
656658
657- if (!write_and_flush (RequestCallback::Ptr (
658- new RefreshFunctionCallback (keyspace_name.to_string (), function_name.to_string (),
659- to_strings (arg_types), is_aggregate, request, this )))) {
659+ RequestCallback::Ptr callback (
660+ new RefreshFunctionCallback (keyspace_name.to_string (), function_name.to_string (),
661+ to_strings (arg_types), is_aggregate, request, this ));
662+ if (write_and_flush (callback) < 0 ) {
660663 LOG_ERROR (" No more stream available while attempting to refresh function info" );
661664 defunct ();
662665 }
0 commit comments