gearmand.cc | gearmand.cc | |||
---|---|---|---|---|
skipping to change at line 37 | skipping to change at line 37 | |||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
* | * | |||
*/ | */ | |||
#include <config.h> | #include "mem_config.h" | |||
#include <libtest/common.h> | #include <libtest/common.h> | |||
#include <libtest/gearmand.h> | #include <libtest/gearmand.h> | |||
#include "util/instance.hpp" | #include "util/instance.hpp" | |||
#include "util/operation.hpp" | #include "util/operation.hpp" | |||
using namespace datadifferential; | using namespace datadifferential; | |||
using namespace libtest; | using namespace libtest; | |||
skipping to change at line 60 | skipping to change at line 60 | |||
#include <cstdio> | #include <cstdio> | |||
#include <cstdlib> | #include <cstdlib> | |||
#include <cstring> | #include <cstring> | |||
#include <iostream> | #include <iostream> | |||
#include <signal.h> | #include <signal.h> | |||
#include <sstream> | #include <sstream> | |||
#include <sys/types.h> | #include <sys/types.h> | |||
#include <sys/wait.h> | #include <sys/wait.h> | |||
#include <unistd.h> | #include <unistd.h> | |||
#include <libgearman/gearman.h> | ||||
#ifndef __INTEL_COMPILER | #ifndef __INTEL_COMPILER | |||
#pragma GCC diagnostic ignored "-Wold-style-cast" | #pragma GCC diagnostic ignored "-Wold-style-cast" | |||
#endif | #endif | |||
using namespace libtest; | using namespace libtest; | |||
class Gearmand : public libtest::Server | class Gearmand : public libtest::Server | |||
{ | { | |||
private: | private: | |||
public: | public: | |||
Gearmand(const std::string& host_arg, in_port_t port_arg, const char* bin ary= GEARMAND_BINARY); | Gearmand(const std::string& host_arg, in_port_t port_arg, const char* bin ary= GEARMAND_BINARY); | |||
bool ping() | bool ping() | |||
{ | { | |||
gearman_client_st *client= gearman_client_create(NULL); | if (out_of_ban_killed()) | |||
if (client == NULL) | ||||
{ | { | |||
Error << "Could not allocate memory for gearman_client_create()"; | ||||
return false; | return false; | |||
} | } | |||
gearman_client_set_timeout(client, 3000); | ||||
if (gearman_success(gearman_client_add_server(client, hostname().c_str( | ||||
), port()))) | ||||
{ | ||||
gearman_return_t rc= gearman_client_echo(client, test_literal_param(" | ||||
This is my echo test")); | ||||
if (gearman_success(rc)) | ||||
{ | ||||
gearman_client_free(client); | ||||
return true; | ||||
} | ||||
if (out_of_ban_killed() == false) | ||||
{ | ||||
Error << hostname().c_str() << ":" << port() << " " << gearman_clie | ||||
nt_error(client); | ||||
} | ||||
} | ||||
else | ||||
{ | ||||
Error << "gearman_client_add_server() " << gearman_client_error(clien | ||||
t); | ||||
} | ||||
gearman_client_free(client); | SimpleClient client(_hostname, _port); | |||
return false;; | std::string response; | |||
return client.send_message("version", response); | ||||
} | } | |||
const char *name() | const char *name() | |||
{ | { | |||
return "gearmand"; | return "gearmand"; | |||
}; | }; | |||
void log_file_option(Application& app, const std::string& arg) | void log_file_option(Application& app, const std::string& arg) | |||
{ | { | |||
if (arg.empty() == false) | if (arg.empty() == false) | |||
End of changes. 7 change blocks. | ||||
33 lines changed or deleted | 5 lines changed or added | |||
This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |