Author: soliton
Date: Fri Nov 2 04:43:26 2007
New Revision: 21406
URL: http://svn.gna.org/viewcvs/wesnoth?rev=21406&view=rev
Log:
* more updates considering the new 'debug' log level
Modified:
trunk/doc/man/wesnoth.6
trunk/doc/man/wesnothd.6
trunk/src/network.cpp
trunk/src/network_worker.cpp
trunk/src/server/server.cpp
Modified: trunk/doc/man/wesnoth.6
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/doc/man/wesnoth.6?rev=21406&r1=21405&r2=21406&view=diff
==============================================================================
--- trunk/doc/man/wesnoth.6 (original)
+++ trunk/doc/man/wesnoth.6 Fri Nov 2 04:43:26 2007
@@ -68,18 +68,13 @@
.BR -h ", " --help
displays a summary of command line options to standard output, and exits.
.TP
-.BI --load \ savegame
+.BI --load \ <savegame>
loads the file savegame from the standard save game directory.
.TP
-.BR --log-error="domain1,domain2,..." ", " --log-warning="..." ", "
--log-info="..."
+.BR --log-<level>="domain1,domain2,..."
sets the severity level of the debug domains. "all" can be used to match
-any debug domain.
-.B --log-info
-shows all messages,
-.B --log-warning
-only warnings and errors, and
-.B --log-error
-just errors.
+any debug domain. Available levels: error, warning, info, debug. By default the
+error level is used.
.TP
.B --logdomains
Dumps a list of all log domains and exits.
@@ -118,6 +113,11 @@
.BR --no-delay
runs the game without any delays for graphic benchmarking. This is
automatically enabled by --nogui.
.TP
+.B --nogui
+runs the game without the GUI. Must appear before
+.B --multiplayer
+to have the desired effect.
+.TP
.BR --exit-at-end
exits once the scenario is over, without displaying victory/defeat dialog
which requires the user to click OK. This is also used for scriptable
benchmarking.
.
@@ -138,11 +138,6 @@
use this option to play in the selected era instead of the "Default"
era. The era is chosen by an id. Eras are described in the
data/multiplayer.cfg file.
-.TP
-.B --nogui
-runs the game without the GUI. Must appear before
-.B --multiplayer
-to have the desired effect.
.TP
.B --parm<number>=name:value
sets additional parameters for this side. This parameter depends on the
Modified: trunk/doc/man/wesnothd.6
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/doc/man/wesnothd.6?rev=21406&r1=21405&r2=21406&view=diff
==============================================================================
--- trunk/doc/man/wesnothd.6 (original)
+++ trunk/doc/man/wesnothd.6 Fri Nov 2 04:43:26 2007
@@ -45,13 +45,17 @@
.BI -c,\ --config \ path
tells wesnothd where to find the config file to use. See the section
.B SERVER CONFIG
-below for the syntax.
+below for the syntax. You can reload the config with sending SIGHUP to the
server process.
.TP
.B -d,\ --daemon
runs wesnothd as a daemon.
.TP
.B -h,\ --help
tells you what the command line options do.
+.TP
+.BR --log-<level>="domain1,domain2,..."
+sets the severity level of the debug domains. "all" can be used to match
+any debug domain. Available levels: error, warning, info, debug.
.TP
.BI -p,\ --port \ port
binds the server to the specified port. If no port is specified, port
Modified: trunk/src/network.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/network.cpp?rev=21406&r1=21405&r2=21406&view=diff
==============================================================================
--- trunk/src/network.cpp (original)
+++ trunk/src/network.cpp Fri Nov 2 04:43:26 2007
@@ -53,6 +53,7 @@
#define SOCKET int
#endif
+#define DBG_NW LOG_STREAM(debug, network)
#define LOG_NW LOG_STREAM(info, network)
#define WRN_NW LOG_STREAM(warn, network)
#define ERR_NW LOG_STREAM(err, network)
@@ -233,7 +234,7 @@
}
}
- LOG_NW << "server socket initialized: " << server_socket <<
"\n";
+ DBG_NW << "server socket initialized: " << server_socket <<
"\n";
free_ = true;
}
}
@@ -361,10 +362,10 @@
// No blocking operations from here on
const threading::lock l(get_mutex());
- LOG_NW << "sent handshake...\n";
+ DBG_NW << "sent handshake...\n";
if(is_aborted()) {
- LOG_NW << "connect operation aborted by calling thread\n";
+ DBG_NW << "connect operation aborted by calling thread\n";
SDLNet_TCP_Close(sock);
return;
}
@@ -425,7 +426,7 @@
const TCPsocket sock = SDLNet_TCP_Accept(server_socket);
if(sock) {
- LOG_NW << "received connection. Pending handshake...\n";
+ DBG_NW << "received connection. Pending handshake...\n";
pending_sockets.push_back(sock);
if(pending_socket_set == 0) {
pending_socket_set = SDLNet_AllocSocketSet(512);
@@ -445,7 +446,7 @@
return 0;
}
- LOG_NW << "pending socket activity...\n";
+ DBG_NW << "pending socket activity...\n";
for(std::vector<TCPsocket>::iterator i = pending_sockets.begin(); i !=
pending_sockets.end(); ++i) {
if(!SDLNet_SocketReady(*i)) {
@@ -460,7 +461,7 @@
SDLNet_TCP_DelSocket(pending_socket_set,sock);
pending_sockets.erase(i);
- LOG_NW << "receiving data from pending socket...\n";
+ DBG_NW << "receiving data from pending socket...\n";
const int len = SDLNet_TCP_Recv(sock,buf,4);
if(len != 4) {
@@ -471,7 +472,7 @@
const int handle = SDLNet_Read32(buf);
- LOG_NW << "received handshake from client: '" << handle <<
"'\n";
+ DBG_NW << "received handshake from client: '" << handle <<
"'\n";
const int res = SDLNet_TCP_AddSocket(socket_set,sock);
if(res == -1) {
@@ -540,7 +541,7 @@
remove_connection(s);
} else {
if(sockets.size() == 1) {
- LOG_NW << "valid socket: " <<
static_cast<int>(*sockets.begin()) << "\n";
+ DBG_NW << "valid socket: " <<
static_cast<int>(*sockets.begin()) << "\n";
}
}
@@ -649,21 +650,23 @@
void send_data(const config& cfg, connection connection_num)
{
- LOG_NW << "in send_data()...\n";
+ DBG_NW << "in send_data()...\n";
+
if(cfg.empty()) {
return;
}
+ LOG_NW << "SENDING to: " << connection_num << ": " << cfg.debug();
if(bad_sockets.count(connection_num) || bad_sockets.count(0)) {
return;
}
- log_scope2(network, "sending data");
+// log_scope2(network, "sending data");
if(!connection_num) {
- LOG_NW << "sockets: " << sockets.size() << "\n";
+ DBG_NW << "sockets: " << sockets.size() << "\n";
for(sockets_list::const_iterator i = sockets.begin();
i != sockets.end(); ++i) {
- LOG_NW << "server socket: " << server_socket <<
"\ncurrent socket: " << *i << "\n";
+ DBG_NW << "server socket: " << server_socket <<
"\ncurrent socket: " << *i << "\n";
send_data(cfg,*i);
}
return;
Modified: trunk/src/network_worker.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/network_worker.cpp?rev=21406&r1=21405&r2=21406&view=diff
==============================================================================
--- trunk/src/network_worker.cpp (original)
+++ trunk/src/network_worker.cpp Fri Nov 2 04:43:26 2007
@@ -69,9 +69,10 @@
# endif
#endif
-
+#define DBG_NW LOG_STREAM(debug, network)
#define LOG_NW LOG_STREAM(info, network)
#define ERR_NW LOG_STREAM(err, network)
+
namespace {
struct _TCPsocket {
int ready;
@@ -303,7 +304,7 @@
static int process_queue(void*)
{
- LOG_NW << "thread started...\n";
+ DBG_NW << "thread started...\n";
for(;;) {
//if we find a socket to send data to, sent_buf will be
non-NULL. If we find a socket
@@ -323,7 +324,7 @@
}
if(min_threads && waiting_threads >= min_threads) {
- LOG_NW << "worker thread exiting... not
enough job\n";
+ DBG_NW << "worker thread exiting... not
enough job\n";
to_clear.push_back(threading::get_current_thread_id());
return 0;
}
@@ -363,7 +364,7 @@
}
if(managed == false) {
- LOG_NW << "worker thread exiting...\n";
+ DBG_NW << "worker thread exiting...\n";
waiting_threads--;
to_clear.push_back(threading::get_current_thread_id());
return 0;
@@ -384,7 +385,7 @@
wassert(sock);
- LOG_NW << "thread found a buffer...\n";
+ DBG_NW << "thread found a buffer...\n";
SOCKET_STATE result = SOCKET_READY;
std::vector<char> buf;
@@ -457,9 +458,9 @@
cond->notify_all();
for(std::map<Uint32,threading::thread*>::const_iterator i =
threads.begin(); i != threads.end(); ++i) {
- LOG_NW << "waiting for thread " << i->first << " to
exit...\n";
+ DBG_NW << "waiting for thread " << i->first << " to
exit...\n";
delete i->second;
- LOG_NW << "thread exited...\n";
+ DBG_NW << "thread exited...\n";
}
threads.clear();
@@ -472,7 +473,7 @@
sockets_locked.clear();
transfer_stats.clear();
- LOG_NW << "exiting manager::~manager()\n";
+ DBG_NW << "exiting manager::~manager()\n";
}
}
@@ -524,7 +525,7 @@
void queue_data(TCPsocket sock,const config& buf)
{
- LOG_NW << "queuing data...\n";
+ DBG_NW << "queuing data...\n";
{
const threading::lock lock(*global_mutex);
Modified: trunk/src/server/server.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/server/server.cpp?rev=21406&r1=21405&r2=21406&view=diff
==============================================================================
--- trunk/src/server/server.cpp (original)
+++ trunk/src/server/server.cpp Fri Nov 2 04:43:26 2007
@@ -1451,11 +1451,15 @@
} else if (val == "--help" || val == "-h") {
std::cout << "usage: " << argv[0]
<< " [-dvV] [-c path] [-m n] [-p port] [-t n]\n"
- << " -c --config path Tells wesnothd
where to find the config file to use.\n"
- << " -d --daemon Runs wesnothd
as a daemon.\n"
- << " -h --help Shows this
usage message.\n"
- << " -p, --port port Binds the
server to the specified port.\n"
- << " -t, --threads n Uses n worker
threads for network I/O (default: 5).\n"
+ << " -c, --config <path> Tells wesnothd
where to find the config file to use.\n"
+ << " -d, --daemon Runs wesnothd
as a daemon.\n"
+ << " -h, --help Shows this
usage message.\n"
+ << " --log-<level>="<domain1>,<domain2>,..."
+ << " sets the
severity level of the debug domains.
+ << " \"all\" can be
used to match any debug domain.
+ << " Available
levels: error, warning, info, debug.
+ << " -p, --port <port> Binds the
server to the specified port.\n"
+ << " -t, --threads <n> Uses n worker
threads for network I/O (default: 5).\n"
<< " -v --verbose Turns on more
verbose logging.\n"
<< " -V, --version Returns the
server version.\n";
return 0;
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits