37 using namespace basis;
39 using namespace cromp;
51 #define LOG(a) CLASS_EMERGENCY_LOG(program_wide_logger::get(), a)
69 class cromp_server_tester;
78 ~our_cromp_server() {}
83 cromp_server_tester &_parent;
93 cromp_server_tester();
94 ~cromp_server_tester();
96 virtual int execute();
101 our_cromp_server *_uplink;
103 bool _leave_when_no_clients;
113 real_bubbles_tentacle(cromp_server_tester &parent,
bool backgrounding)
120 _parent._saw_clients =
true;
123 if (!inf)
return NO_HANDLER;
126 store_product(junk, item_id);
131 cromp_server_tester &_parent;
136 cromp_server_tester::cromp_server_tester()
141 _leave_when_no_clients(false),
153 if (args.get_value(
"port", port_text,
false)) {
155 port = port_text.
convert(5678);
158 if (args.find(
"exit", posn)) {
159 LOG(
"seeing the 'exit without clients' flag set.");
160 _leave_when_no_clients =
true;
168 if (args.get_value(
"host", host_temp,
false)) {
170 hostname = host_temp;
172 strcpy(c_address.hostname, hostname.s());
177 if (args.find(
"encrypt", indy) || (args.find(
'e', indy)) ) {
179 LOG(
"turning on encryption.");
185 c_address.port = port;
187 LOG(
"starting cromp_server");
188 _uplink =
new our_cromp_server(*
this, c_address);
190 _uplink->enable_servers(_encryption);
193 cromp_server_tester::~cromp_server_tester()
198 int cromp_server_tester::execute()
206 if (!_uplink->clients() && _leave_when_no_clients && _saw_clients) {
212 int client_count = _uplink->clients();
213 const char *verb =
"are";
214 if (client_count == 1) verb =
"is";
215 const char *ending =
"s";
216 if (client_count == 1) ending =
"";
217 LOG(
a_sprintf(
"There %s %d client%s.", verb, client_count, ending));
223 LOG(
"tearing down entire server and re-creating.");
225 _uplink =
new our_cromp_server(*
this, c_address);
227 _uplink->enable_servers(_encryption);
230 time_control::sleep_ms(100);
The application_shell is a base object for console programs.
a_sprintf is a specialization of astring that provides printf style support.
void reset(int number=0, const contents *initial_contents=NULL_POINTER)
Resizes this array and sets the contents from an array of contents.
Provides a dynamically resizable ASCII character string.
int convert(int default_value) const
Converts the string into a corresponding integer.
A very common template for a dynamic array of bytes.
Outcomes describe the state of completion for an operation.
virtual clonable * clone() const
must be provided to allow creation of a copy of this object.
An infoton is an individual request parcel with accompanying information.
Identifies requests made on an octopus by users.
this type of address describes a destination out on the internet.
Represents a point in time relative to the operating system startup time.
#define NULL_POINTER
The value representing a pointer to nothing.
#define DEFINE_CLASS_NAME(objname)
Defines the name of a class by providing a couple standard methods.
#define FUNCDEF(func_in)
FUNCDEF sets the name of a function (and plugs it into the callstack).
Provides macros that implement the 'main' program of an application.
#define HOOPLE_MAIN(obj_name, obj_args)
options that should work for most unix and linux apps.
Implements an application lock to ensure only one is running at once.
The guards collection helps in testing preconditions and reporting errors.
void WHACK(contents *&ptr)
deletion with clearing of the pointer.
const int SECOND_ms
Number of milliseconds in a second.
A platform independent way to obtain the timestamp of a file.
A logger that sends to the console screen using the standard output device.
An extension to floating point primitives providing approximate equality.
Provides access to the operating system's socket methods.
A dynamic container class that holds any kind of object via pointers.
Useful support functions for unit testing, especially within hoople.
const bool SUPPORT_BACKGROUNDING
const bool IMMEDIATE_EVALUATION
const int REPORTING_INTERVAL
const int ACCEPTING_THREADS