projects
/
m6w6
/
libmemcached
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
Extend test.
[m6w6/libmemcached]
/
libtest
/
server.h
diff --git
a/libtest/server.h
b/libtest/server.h
index 198e0f6abdc3b8981abcd3aece67c3d63976ac93..00f29cd837b19c9c21630c7fbbf0be835d942b04 100644
(file)
--- a/
libtest/server.h
+++ b/
libtest/server.h
@@
-14,6
+14,7
@@
#include <netinet/in.h>
#include <string>
#include <unistd.h>
#include <netinet/in.h>
#include <string>
#include <unistd.h>
+#include <vector>
#define SERVERS_TO_CREATE 5
#define SERVERS_TO_CREATE 5
@@
-31,21
+32,12
@@
private:
std::string _command;
test_server_getpid *__get_pid;
test_server_ping *__ping;
std::string _command;
test_server_getpid *__get_pid;
test_server_ping *__ping;
+ std::string _hostname;
public:
public:
+ server_st(in_port_t port_arg, test_server_getpid *, test_server_ping *);
- char hostname[NI_MAXHOST];
-
- server_st() :
- _used(false),
- _pid(-1),
- _port(0),
- __get_pid(NULL),
- __ping(NULL)
- {
- pid_file[0]= 0;
- strncpy(hostname, "localhost", sizeof(hostname));
- }
+ server_st(const std::string &socket_file, test_server_getpid *, test_server_ping *);
void set_methods(test_server_getpid *get_pid_arg, test_server_ping *ping_arg)
{
void set_methods(test_server_getpid *get_pid_arg, test_server_ping *ping_arg)
{
@@
-53,6
+45,14
@@
public:
__ping= ping_arg;
}
__ping= ping_arg;
}
+ const char *hostname() const
+ {
+ if (_hostname.empty())
+ return "";
+
+ return _hostname.c_str();
+ }
+
bool ping()
{
if (__ping)
bool ping()
{
if (__ping)
@@
-110,12
+110,7
@@
public:
bool is_socket() const
{
bool is_socket() const
{
- return hostname[0] == '/';
- }
-
- void set_hostname(const char *arg)
- {
- strncpy(hostname, arg, sizeof(hostname));
+ return _hostname[0] == '/';
}
bool kill();
}
bool kill();
@@
-129,16
+124,19
@@
std::ostream& operator<<(std::ostream& output, const server_st &arg);
struct server_startup_st
{
struct server_startup_st
{
- uint
8
_t count;
+ uint
32
_t count;
uint8_t udp;
std::string server_list;
uint8_t udp;
std::string server_list;
- s
erver_st server[SERVERS_TO_CREATE]
;
+ s
td::vector<server_st *> servers
;
server_startup_st() :
count(SERVERS_TO_CREATE),
udp(0)
{ }
server_startup_st() :
count(SERVERS_TO_CREATE),
udp(0)
{ }
+ void shutdown();
+ void push_server(server_st *);
+
~server_startup_st();
};
~server_startup_st();
};