tsyncd-cvs Mailing List for Tsync: (Transparent) Synchronization
Status: Beta
Brought to you by:
j_w_anderson
You can subscribe to this list here.
| 2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(59) |
Sep
(24) |
Oct
|
Nov
|
Dec
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2006 |
Jan
(21) |
Feb
|
Mar
|
Apr
|
May
(35) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2007 |
Jan
|
Feb
|
Mar
|
Apr
(7) |
May
(3) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: prashant <pra...@bl...> - 2007-05-09 14:04:20
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type"> </head> <body bgcolor="#ffffff" text="#000000"> Hi All,<br> <br> I have started tsyncd on both server and i do not receive the error anymore.<br> <br> But i am receiving the following<br> <br> root@web1:/etc/tsync# [WARNING] WARNING: signal handler already registered for 13<br> tsyncd: TcpConnection.cc:180: bool TcpConnection::connectSSL(): Assertion `0' failed.<br> <br> I did the following<br> <font color="#000000"> <pre class="screen"><b class="command">./gencert cacert > ca.pem </b><font color="#000000"><pre class="screen"><b class="command">./gencert signedcert ca.pem host1.foo.com > host1.pem ./gencert signedcert ca.pem host2.bar.com > host2.pem</b></pre></font></pre> </font><font color="#000000"> <pre class="screen"><b class="command">scp ca.pem host1.pem host1.foo.com:~/.tsync_certs scp ca.pem host2.pem host2.bar.com:~/.tsync_certs </b></pre> </font>HELP!!!!<br> <br> Thanks<br> Prashant<br> </body> </html> |
|
From: prashant <pra...@bl...> - 2007-05-09 11:46:05
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hi All,<br>
I got tsync compiled, but i am getting the following errors<br>
<br>
root@web1:/etc/tsync# /etc/rc.d/tsyncd -e tsyncd.exports -c tsync.conf
& <br>
[1] 31949<br>
root@web1:/etc/tsync# [WARNING] WARNING: signal handler already
registered for 13<br>
[WARNING] WARNING: signal handler already registered for 13<br>
[ERROR::RandTree::error] received error 1 for web2:6664<br>
[ERROR::RandTree::error] received error 1 for web2:6664<br>
<br>
root@web1:/etc/tsync# more tsync.conf <br>
email = <a class="moz-txt-link-abbreviated" href="mailto:pra...@bl...">pra...@bl...</a> <br>
servers = web1 web2 <br>
xmlrpcPort = 6666<br>
MACE_CA_FILE = /etc/tsync/ca.pem<br>
MACE_CERT_FILE = /etc/tsync/web1.pem<br>
MACE_PRIVATE_KEY_FILE = /etc/tsync/web1.pem<br>
<br>
# mace configuration options<br>
MACE_NO_VERIFY_HOSTNAMES = web1 web2 <br>
MACE_PORT = 6664<br>
MACE_LOG_AUTO_SELECTORS = ERROR<br>
# comment out the following line to log to standard out instead of a
file<br>
MACE_LOG_FILE = /tmp/tsync-server.log<br>
MACE_LOG_LEVEL = 3<br>
MACE_LOG_TIMESTAMP_HUMAN = 1<br>
MACE_PRINT_HOSTNAME_ONLY = 1<br>
<br>
<br>
<br>
root@web1:/etc/tsync# more tsyncd.exports <br>
volume1 /usr/local/apache2/htdocs/<br>
root@web1:/etc/tsync# <br>
<br>
<br>
<br>
I have 2 machines and their hostname is web1 and web2<br>
<br>
/etc/hosts<br>
192.168.1.67 web1<br>
192.168.1.73 web2<br>
<br>
Any suggestion??<br>
<br>
Thanks<br>
<div class="moz-signature">-- <br>
<meta http-equiv="Content-Type" content="text/html; ">
<title>blue barracuda</title>
<table border="0" cellpadding="0" cellspacing="0" width="589">
<tbody>
<tr>
<td
style="padding: 0pt 0pt 8px; font-family: 'Trebuchet MS',Verdana,Arial,sans-serif; font-size: 12px; line-height: 15px; color: rgb(102, 102, 102);"
width="242"><img src="cid:par...@bl..."
alt="" border="0" height="1" width="242"><br>
<strong>Prashant Ramhit</strong><br>
<em>Technical</em></td>
<td width="117"><img
src="cid:par...@bl..." alt="" border="0"
height="1" width="117"></td>
<td align="right" valign="bottom" width="230"><img
src="cid:par...@bl..." alt="" border="0"
height="35" width="230"></td>
</tr>
<tr>
<td colspan="3" align="right" width="589"><img
src="cid:par...@bl..." alt="" border="0"
height="3" width="589"></td>
</tr>
<tr>
<td
style="padding: 8px 0pt 0pt; font-family: 'Trebuchet MS',Verdana,Arial,sans-serif; font-size: 11px; line-height: 15px; color: rgb(102, 102, 102);"
valign="top" width="242"><img
src="cid:par...@bl..." alt="" border="0"
height="1" width="242"><br>
<a href="mailto:pra...@bl..." target="_blank"
style="font-family: 'Trebuchet MS',Verdana,Arial,sans-serif; font-size: 11px; color: rgb(32, 116, 187); text-decoration: none;"><strong>pra...@bl...</strong></a><br>
d: +44 (0)20 7923 6870<br>
t: +44 (0)20 7923 6840<br>
<a href="http://www.bluebarracuda.com" target="_blank"
style="font-family: 'Trebuchet MS',Verdana,Arial,sans-serif; font-size: 11px; color: rgb(32, 116, 187); text-decoration: none;">www.bluebarracuda.com</a></td>
<td
style="padding: 8px 0pt 0pt; font-family: 'Trebuchet MS',Verdana,Arial,sans-serif; font-size: 11px; line-height: 15px; color: rgb(102, 102, 102);"
valign="top" width="117"><img
src="cid:par...@bl..." alt="" border="0"
height="1" width="117"><br>
<strong>blue barracuda</strong><br>
the lightwell<br>
12-16 laystall street<br>
london<br>
ec1r 4pf</td>
<td
style="font-family: 'Trebuchet MS',Verdana,Arial,sans-serif; font-size: 11px; line-height: 15px; color: rgb(102, 102, 102);"
align="right" valign="top" width="230"><img
src="cid:par...@bl..." alt="" border="0"
height="79" width="131"><br>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>
|
|
From: prashant <pra...@bl...> - 2007-05-09 11:42:19
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type"> <title></title> </head> <body bgcolor="#ffffff" text="#000000"> Hi Guys,<br> <br> The following must be installed before tsync0.8.0<br> <pre>Dependencies need to be solved. The following packages need to be installed before installing tsyn on slackware 10.2 gcc upgraded to 3.4.6 bidon upgraded bison-2.3 boost-1.33.1-i486-1.tgz installed - obtained from <a class="moz-txt-link-freetext" href="http://www.slackware.com/~alien/slackbuilds/">http://www.slackware.com/~alien/slackbuilds/</a> Perl modules should be installed Frontier-RPC-0.07b4 HTML-Parser-3.56 HTML-Tagset-3.10 URI-1.35 libwww-perl-5.805 After much hassle, it was compiled sucessfully.</pre> Cheers,<br> Prashant<br> <br> <div class="moz-signature">-- <br> <meta http-equiv="Content-Type" content="text/html; "> <title>blue barracuda</title> <table border="0" cellpadding="0" cellspacing="0" width="589"> <tbody> <tr> <td style="padding: 0pt 0pt 8px; font-family: 'Trebuchet MS',Verdana,Arial,sans-serif; font-size: 12px; line-height: 15px; color: rgb(102, 102, 102);" width="242"><br> </td> <td width="117"><br> </td> <td align="right" valign="bottom" width="230"><br> </td> </tr> <tr> <td colspan="3" align="right" width="589"><br> </td> </tr> <tr> <td style="padding: 8px 0pt 0pt; font-family: 'Trebuchet MS',Verdana,Arial,sans-serif; font-size: 11px; line-height: 15px; color: rgb(102, 102, 102);" valign="top" width="242"><br> </td> <td style="padding: 8px 0pt 0pt; font-family: 'Trebuchet MS',Verdana,Arial,sans-serif; font-size: 11px; line-height: 15px; color: rgb(102, 102, 102);" valign="top" width="117"><br> </td> <td style="font-family: 'Trebuchet MS',Verdana,Arial,sans-serif; font-size: 11px; line-height: 15px; color: rgb(102, 102, 102);" align="right" valign="top" width="230"><br> </td> </tr> </tbody> </table> <br> </div> </body> </html> |
|
From: prashant <pra...@bl...> - 2007-04-23 10:54:22
|
Hi Again, I am using the mace which comes with the tsync-0.8.0 and the errors are root@web1:~/packages/tsync/tsync-0.8.0# make make[1]: Entering directory `/root/packages/tsync/tsync-0.8.0/rsync' make[1]: Nothing to be done for `all'. make[1]: Leaving directory `/root/packages/tsync/tsync-0.8.0/rsync' make[1]: Entering directory `/root/packages/tsync/tsync-0.8.0/mace' make[2]: Entering directory `/root/packages/tsync/tsync-0.8.0/mace/mace-extras/sha1' make[2]: Nothing to be done for `library'. make[2]: Leaving directory `/root/packages/tsync/tsync-0.8.0/mace/mace-extras/sha1' make[2]: Entering directory `/root/packages/tsync/tsync-0.8.0/mace/lib' make[2]: Nothing to be done for `library'. make[2]: Leaving directory `/root/packages/tsync/tsync-0.8.0/mace/lib' make[2]: Entering directory `/root/packages/tsync/tsync-0.8.0/mace/compiler' gcc -g -DYYDEBUG=1 -Wall -Werror -c -o mace.tab.o mace.tab.c mace.tab.c: In function `yyparse': mace.tab.c:988: warning: suggest parentheses around assignment used as truth value mace.tab.c:1005: warning: suggest parentheses around assignment used as truth value mace.tab.c:1048: warning: label `yynewerror' defined but not used mace.tab.c:1053: warning: label `yyerrlab' defined but not used mace.tab.c: At top level: mace.tab.c:2: warning: 'yysccsid' defined but not used make[2]: *** [mace.tab.o] Error 1 make[2]: Leaving directory `/root/packages/tsync/tsync-0.8.0/mace/compiler' make[1]: *** [compiler] Error 2 make[1]: Leaving directory `/root/packages/tsync/tsync-0.8.0/mace' make: *** [mace] Error 2 root@web1:~/packages/tsync/tsync-0.8.0# |
|
From: prashant <pra...@bl...> - 2007-04-23 10:37:57
|
Hi All, I am still struggling with TSYNC0.8 install , and now i have the following issues. I have gcc version 3.4.6 and boost-1.33.1-i486-1.tgz installed on my server. Below are the errors Is there any final release for the tsync.. if no when will it be available?? Many thanks Prashant root@web1:~/packages/tsync/tsync-0.8.0# make g++ -c -g -Wall -Werror -D__STDC_FORMAT_MACROS -Imace-0.9_old/ -Imace-0.9_old//lib -Imace-0.9_old//services/interfaces -Imace-0.9_old//services -Imace-0.9_old//services/interfaces -Imace-0.9_old//services/Transport -Imace-0.9_old//services/Http -Imace-0.9_old//services/RandTree -Imace-0.9_old//services/ReplayTree -Imace-0.9_old//services/RanSub -Imace-0.9_old//services/Pastry -Imace-0.9_old//services/Bamboo -Imace-0.9_old//services/Chord -Imace-0.9_old//services/GenericOverlayRoute -Imace-0.9_old//services/GenericTreeMulticast -Imace-0.9_old//services/ScribeMS -Imace-0.9_old//services/SplitStreamMS -Imace-0.9_old//application/common -Irsync -pthread -DUseinterfaces -DUseTransport -DUseHttp -DUseRandTree -DUseReplayTree -DUseRanSub -DUsePastry -DUseBamboo -DUseChord -DUseGenericOverlayRoute -DUseGenericTreeMulticast -DUseScribeMS -DUseSplitStreamMS RecoveryDownloadManager.cc -o RecoveryDownloadManager.O0.o In file included from RecoveryDownloadManager.cc:26: Server.h:104: error: `comm_type_t' has not been declared Server.h:104: error: ISO C++ forbids declaration of `commType' with no type Server.h:221: error: ISO C++ forbids declaration of `BufferedRouteServiceClass' with no type Server.h:221: error: expected `;' before '*' token Server.h:222: error: ISO C++ forbids declaration of `BufferedRouteServiceClass' with no type Server.h:222: error: expected `;' before '*' token make: *** [RecoveryDownloadManager.O0.o] Error 1 root@web1:~/packages/tsync/tsync-0.8.0# gcc -v Reading specs from /usr/lib/gcc/i486-slackware-linux/3.4.6/specs Configured with: ../gcc-3.4.6/configure --prefix=/usr --enable-shared --enable-threads=posix --enable-__cxa_atexit --disable-checking --with-gnu-ld --verbose --target=i486-slackware-linux --host=i486-slackware-linux Thread model: posix gcc version 3.4.6 root@web1:~/packages/tsync/tsync-0.8.0# |
|
From: John Fisher-O. <joh...@gm...> - 2007-04-17 15:26:32
|
What version of gcc are you using? gcc itself is the problem here so you'll either need to upgrade your compiler version or downgrade and file a bug report. \\ John On 4/17/07, prashant <pra...@bl...> wrote: > > Hi John, > > Thanking you for the hint. But Still have some errors. > > I have compiled BOOST again and now I have the following errors > > Do you have another hint please. > > Many Thanks > > Prashant > > root@node1:~/tsync-0.8.0# make > make[1]: Entering directory `/root/tsync-0.8.0/rsync' > make[1]: Nothing to be done for `all'. > make[1]: Leaving directory `/root/tsync-0.8.0/rsync' > make[1]: Entering directory `/root/tsync-0.8.0/mace' > make[2]: Entering directory `/root/tsync-0.8.0/mace/mace-extras/sha1' > g++ -Wall -Werror -I../../lib -g -pthread -D_REENTRANT -D_THREAD_SAFE > -D_PTHREAD -D__USE_UNIX98 -D_GNU_SOURCE -O2 -g -c -o HashUtil.o > HashUtil.cc > In file included from ../../lib/MaceTypes.h:39, > from ../../lib/Util.h:41, > from HashUtil.cc:23: > ../../lib/MaceKey.h:723: internal compiler error: Segmentation fault > Please submit a full bug report, > with preprocessed source if appropriate. > See <URL:http://gcc.gnu.org/bugs.html> for instructions. > make[2]: *** [HashUtil.o] Error 1 > make[2]: Leaving directory `/root/tsync-0.8.0/mace/mace-extras/sha1' > make[1]: *** [mace-extras/sha1] Error 2 > make[1]: Leaving directory `/root/tsync-0.8.0/mace' > make: *** [mace] Error 2 > root@node1:~/tsync-0.8.0# > > > |
|
From: prashant <pra...@bl...> - 2007-04-17 10:42:28
|
Hi John,
Thanking you for the hint. But Still have some errors.
I have compiled BOOST again and now I have the following errors
Do you have another hint please.
Many Thanks
Prashant
root@node1:~/tsync-0.8.0# make
make[1]: Entering directory `/root/tsync-0.8.0/rsync'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/root/tsync-0.8.0/rsync'
make[1]: Entering directory `/root/tsync-0.8.0/mace'
make[2]: Entering directory `/root/tsync-0.8.0/mace/mace-extras/sha1'
g++ -Wall -Werror -I../../lib -g -pthread -D_REENTRANT -D_THREAD_SAFE
-D_PTHREAD -D__USE_UNIX98 -D_GNU_SOURCE -O2 -g -c -o HashUtil.o
HashUtil.cc
In file included from ../../lib/MaceTypes.h:39,
from ../../lib/Util.h:41,
from HashUtil.cc:23:
../../lib/MaceKey.h:723: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
make[2]: *** [HashUtil.o] Error 1
make[2]: Leaving directory `/root/tsync-0.8.0/mace/mace-extras/sha1'
make[1]: *** [mace-extras/sha1] Error 2
make[1]: Leaving directory `/root/tsync-0.8.0/mace'
make: *** [mace] Error 2
root@node1:~/tsync-0.8.0#
|
|
From: prashant <pra...@bl...> - 2007-04-16 15:13:02
|
Hi Jon,
I have installed boost as per your recommendation. But now I have more
errors.
Any hint what is wrong this time.
Do you have a link where I can download the proper build packages
without having errors.
Many Thanks
In file included from ../../lib/MaceTypes.h:39,
from ../../lib/Util.h:41,
from HashUtil.cc:23:
../../lib/MaceKey.h:115:32: boost/shared_ptr.hpp: No such file or directory
In file included from ../../lib/MaceKey.h:120,
from ../../lib/MaceTypes.h:39,
from ../../lib/Util.h:41,
from HashUtil.cc:23:
../../lib/Serializable.h:43:34: boost/lexical_cast.hpp: No such file or
directory
In file included from ../../lib/KeyRange.h:37,
from ../../lib/MaceTypes.h:40,
from ../../lib/Util.h:41,
from HashUtil.cc:23:
../../lib/MaceKey.h:115:32: boost/shared_ptr.hpp: No such file or directory
make[1]: Leaving directory `/root/tsync-0.8.0/mace/mace-extras/sha1'
make[1]: Entering directory `/root/tsync-0.8.0/mace/mace-extras/sha1'
g++ -Wall -Werror -I../../lib -g -pthread -D_REENTRANT -D_THREAD_SAFE
-D_PTHREAD -D__USE_UNIX98 -D_GNU_SOURCE -O2 -g -c -o HashUtil.o
HashUtil.cc
In file included from ../../lib/MaceTypes.h:39,
from ../../lib/Util.h:41,
from HashUtil.cc:23:
../../lib/MaceKey.h:115:32: boost/shared_ptr.hpp: No such file or directory
In file included from ../../lib/MaceKey.h:120,
from ../../lib/MaceTypes.h:39,
from ../../lib/Util.h:41,
from HashUtil.cc:23:
../../lib/Serializable.h:43:34: boost/lexical_cast.hpp: No such file or
directory
In file included from ../../lib/MaceKey.h:120,
from ../../lib/MaceTypes.h:39,
from ../../lib/Util.h:41,
from HashUtil.cc:23:
../../lib/Serializable.h: In static member function `static void
mace::SerializationUtil::expect(std::istream&, const char*)':
../../lib/Serializable.h:130: error: `boost' undeclared (first use this
function)
../../lib/Serializable.h:130: error: (Each undeclared identifier is
reported
only once for each function it appears in.)
../../lib/Serializable.h:130: error: syntax error before `;' token
../../lib/Serializable.h: In static member function `static void
mace::SerializationUtil::expect(std::istream&, const S&)':
../../lib/Serializable.h:156: error: syntax error before `;' token
../../lib/Serializable.h:161: error: syntax error before `;' token
../../lib/Serializable.h: In static member function `static void
mace::SerializationUtil::getToken(std::istream&, S&)':
../../lib/Serializable.h:173: error: syntax error before `;' token
In file included from ../../lib/MaceTypes.h:39,
from ../../lib/Util.h:41,
from HashUtil.cc:23:
../../lib/MaceKey.h: At global scope:
../../lib/MaceKey.h:307: error: ISO C++ forbids declaration of `boost'
with no
type
../../lib/MaceKey.h:307: error: syntax error before `::' token
../../lib/MaceKey.h:309: error: 'HelperPtr' is used as a type, but is not
defined as a type.
../../lib/MaceKey.h: In member function `virtual uint
mace::MaceKey::getNthDigitSafe(int, unsigned int) const':
../../lib/MaceKey.h:314: error: `helper' undeclared (first use this
function)
../../lib/MaceKey.h: In member function `virtual void
mace::MaceKey::setNthDigit(unsigned int, int, unsigned int)':
../../lib/MaceKey.h:366: error: `HelperPtr' undeclared (first use this
function)
../../lib/MaceKey.h: In member function `virtual int
mace::MaceKey::deserialize(std::istream&)':
../../lib/MaceKey.h:390: error: `HelperPtr' undeclared (first use this
function)
../../lib/MaceKey.h:393: error: `int' is not an aggregate type
../../lib/MaceKey.h:393: error: syntax error before `;' token
../../lib/MaceKey.h:393: error: syntax error before `;' token
../../lib/MaceKey.h: In constructor `mace::MaceKey::MaceKey()':
../../lib/MaceKey.h:399: error: class `mace::MaceKey' does not have any
field
named `helper'
../../lib/MaceKey.h: In member function `virtual bool
mace::MaceKey::operator==(const mace::MaceKey&) const':
../../lib/MaceKey.h:408: error: 'const class mace::MaceKey' has no
member named
'helper'
../../lib/MaceKey.h: In member function `mace::MaceKey&
mace::MaceKey::operator=(const mace::MaceKey&)':
../../lib/MaceKey.h:451: error: 'const class mace::MaceKey' has no
member named
'helper'
../../lib/MaceKey.h: In copy constructor `mace::MaceKey::MaceKey(const
mace::MaceKey&)':
../../lib/MaceKey.h:457: error: class `mace::MaceKey' does not have any
field
named `helper'
../../lib/MaceKey.h:464: error: 'const class mace::MaceKey' has no
member named
'helper'
../../lib/MaceKey.h: In constructor `
mace::MaceKey::MaceKey(mace::MaceKey::ipv4_type)':
../../lib/MaceKey.h:861: error: class `mace::MaceKey' does not have any
field
named `helper'
../../lib/MaceKey.h: In constructor `
mace::MaceKey::MaceKey(mace::MaceKey::ipv4_type, unsigned int, short
unsigned int, unsigned int, short unsigned int)':
../../lib/MaceKey.h:862: error: class `mace::MaceKey' does not have any
field
named `helper'
../../lib/MaceKey.h: In constructor `
mace::MaceKey::MaceKey(mace::MaceKey::ipv4_type, const std::string&)':
../../lib/MaceKey.h:863: error: class `mace::MaceKey' does not have any
field
named `helper'
../../lib/MaceKey.h: In constructor `
mace::MaceKey::MaceKey(mace::MaceKey::ipv4_type, const mace::MaceAddr&)':
../../lib/MaceKey.h:864: error: class `mace::MaceKey' does not have any
field
named `helper'
../../lib/MaceKey.h: In constructor `
mace::MaceKey::MaceKey(mace::MaceKey::sha160_type)':
../../lib/MaceKey.h:867: error: class `mace::MaceKey' does not have any
field
named `helper'
../../lib/MaceKey.h: In constructor `
mace::MaceKey::MaceKey(mace::MaceKey::sha160_type, int)':
../../lib/MaceKey.h:868: error: class `mace::MaceKey' does not have any
field
named `helper'
../../lib/MaceKey.h: In constructor `
mace::MaceKey::MaceKey(mace::MaceKey::sha160_type, const uint*)':
../../lib/MaceKey.h:869: error: class `mace::MaceKey' does not have any
field
named `helper'
../../lib/MaceKey.h: In constructor `
mace::MaceKey::MaceKey(mace::MaceKey::sha160_type, const char*)':
../../lib/MaceKey.h:870: error: class `mace::MaceKey' does not have any
field
named `helper'
../../lib/MaceKey.h: In constructor `
mace::MaceKey::MaceKey(mace::MaceKey::sha160_type, const std::string&)':
../../lib/MaceKey.h:871: error: class `mace::MaceKey' does not have any
field
named `helper'
../../lib/MaceKey.h: In constructor `
mace::MaceKey::MaceKey(mace::MaceKey::sha32_type)':
../../lib/MaceKey.h:874: error: class `mace::MaceKey' does not have any
field
named `helper'
../../lib/MaceKey.h: In constructor `
mace::MaceKey::MaceKey(mace::MaceKey::sha32_type, int)':
../../lib/MaceKey.h:875: error: class `mace::MaceKey' does not have any
field
named `helper'
../../lib/MaceKey.h: In constructor `
mace::MaceKey::MaceKey(mace::MaceKey::sha32_type, const uint*)':
../../lib/MaceKey.h:876: error: class `mace::MaceKey' does not have any
field
named `helper'
../../lib/MaceKey.h: In constructor `
mace::MaceKey::MaceKey(mace::MaceKey::sha32_type, const char*)':
../../lib/MaceKey.h:877: error: class `mace::MaceKey' does not have any
field
named `helper'
../../lib/MaceKey.h: In constructor `
mace::MaceKey::MaceKey(mace::MaceKey::sha32_type, const std::string&)':
../../lib/MaceKey.h:878: error: class `mace::MaceKey' does not have any
field
named `helper'
In file included from ../../lib/KeyRange.h:37,
from ../../lib/MaceTypes.h:40,
from ../../lib/Util.h:41,
from HashUtil.cc:23:
../../lib/MaceKey.h:115:32: boost/shared_ptr.hpp: No such file or directory
HashUtil.cc:28: confused by earlier errors, bailing out
make[1]: *** [HashUtil.o] Error 1
make[1]: Leaving directory `/root/tsync-0.8.0/mace/mace-extras/sha1'
make: *** [mace-extras/sha1] Error 2
root@node1:~/tsync-0.8.0/mace#
|
|
From: John Fisher-O. <joh...@gm...> - 2007-04-13 16:34:16
|
You need to install the boost c++ library - http://www.boost.org/ \\ John On 4/13/07, prashant <pra...@bl...> wrote: > > Hi All, > Tsync is the tool i was looking, But i am having the following issues > with tsync-0.8.0 > > Any hint on what i am missing. > > Many Thanks > > Prashant > > > root@node1:~/tsync-0.8.0# ./configure --mace-path=$PWD/mace > root@node1:~/tsync-0.8.0# make > make[1]: Entering directory `/root/tsync-0.8.0/rsync' > g++ -O2 -g -I../mace -I../mace/lib -I../mace/services/interfaces > -I../mace/services -I../mace/services/interfaces > -I../mace/services/Transport -I../mace/services/Http > -I../mace/services/RandTree -I../mace/services/RanSub > -I../mace/services/GenericTreeMulticast -I../ -pthread -Wall -Werror > -c -o Matcher.o Matcher.cc > In file included from ../mace/lib/mstring.h:37, > from Delta.h:4, > from Matcher.h:5, > from Matcher.cc:31: > ../mace/lib/Serializable.h:43:34: boost/lexical_cast.hpp: No such file > or directory > In file included from ../mace/lib/mstring.h:37, > from Delta.h:4, > from Matcher.h:5, > from Matcher.cc:31: > ../mace/lib/Serializable.h: In static member function `static void > mace::SerializationUtil::expect(std::istream&, const char*)': > ../mace/lib/Serializable.h:130: error: `boost' undeclared (first use this > function) > ../mace/lib/Serializable.h:130: error: (Each undeclared identifier is > reported > only once for each function it appears in.) > ../mace/lib/Serializable.h:130: error: syntax error before `;' token > ../mace/lib/Serializable.h: In static member function `static void > mace::SerializationUtil::expect(std::istream&, const S&)': > ../mace/lib/Serializable.h:156: error: syntax error before `;' token > ../mace/lib/Serializable.h:161: error: syntax error before `;' token > ../mace/lib/Serializable.h: In static member function `static void > mace::SerializationUtil::getToken(std::istream&, S&)': > ../mace/lib/Serializable.h:173: error: syntax error before `;' token > make[1]: *** [Matcher.o] Error 1 > make[1]: Leaving directory `/root/tsync-0.8.0/rsync' > make: *** [rsync] Error 2 > root@node1:~/tsync-0.8.0# > > > > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share > your > opinions on IT & business topics through brief surveys-and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Tsyncd-cvs mailing list > Tsy...@li... > https://lists.sourceforge.net/lists/listinfo/tsyncd-cvs > |
|
From: prashant <pra...@bl...> - 2007-04-13 09:59:10
|
Hi All,
Tsync is the tool i was looking, But i am having the following issues
with tsync-0.8.0
Any hint on what i am missing.
Many Thanks
Prashant
root@node1:~/tsync-0.8.0# ./configure --mace-path=$PWD/mace
root@node1:~/tsync-0.8.0# make
make[1]: Entering directory `/root/tsync-0.8.0/rsync'
g++ -O2 -g -I../mace -I../mace/lib -I../mace/services/interfaces
-I../mace/services -I../mace/services/interfaces
-I../mace/services/Transport -I../mace/services/Http
-I../mace/services/RandTree -I../mace/services/RanSub
-I../mace/services/GenericTreeMulticast -I../ -pthread -Wall -Werror
-c -o Matcher.o Matcher.cc
In file included from ../mace/lib/mstring.h:37,
from Delta.h:4,
from Matcher.h:5,
from Matcher.cc:31:
../mace/lib/Serializable.h:43:34: boost/lexical_cast.hpp: No such file
or directory
In file included from ../mace/lib/mstring.h:37,
from Delta.h:4,
from Matcher.h:5,
from Matcher.cc:31:
../mace/lib/Serializable.h: In static member function `static void
mace::SerializationUtil::expect(std::istream&, const char*)':
../mace/lib/Serializable.h:130: error: `boost' undeclared (first use this
function)
../mace/lib/Serializable.h:130: error: (Each undeclared identifier is
reported
only once for each function it appears in.)
../mace/lib/Serializable.h:130: error: syntax error before `;' token
../mace/lib/Serializable.h: In static member function `static void
mace::SerializationUtil::expect(std::istream&, const S&)':
../mace/lib/Serializable.h:156: error: syntax error before `;' token
../mace/lib/Serializable.h:161: error: syntax error before `;' token
../mace/lib/Serializable.h: In static member function `static void
mace::SerializationUtil::getToken(std::istream&, S&)':
../mace/lib/Serializable.h:173: error: syntax error before `;' token
make[1]: *** [Matcher.o] Error 1
make[1]: Leaving directory `/root/tsync-0.8.0/rsync'
make: *** [rsync] Error 2
root@node1:~/tsync-0.8.0#
|
|
From: James W. A. <j_w...@us...> - 2006-05-04 23:34:55
|
Update of /cvsroot/tsyncd/src/mace/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4457/lib Modified Files: LoadMonitor.cc LoadMonitor.h ProcessingQueue.h Log Message: join threads properly to shutdown cleanly Index: LoadMonitor.cc =================================================================== RCS file: /cvsroot/tsyncd/src/mace/lib/LoadMonitor.cc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** LoadMonitor.cc 3 May 2006 23:21:18 -0000 1.4 --- LoadMonitor.cc 4 May 2006 23:34:51 -0000 1.5 *************** *** 68,85 **** assert(instance); uint64_t now = Util::timeu(); ! uint user; ! uint system; ! readLoad(user, system); uint64_t t = now - instance->prevTime; ! double pu = (user - instance->prevUser) * 10000.0 / t; ! double ps = (system - instance->prevSystem) * 10000.0 / t; int iu = (int)(100 * pu); int is = (int)(100 * ps); int it = iu + is; ! Log::logf("HiResLoadMonitor", "%d %d %d\n", iu, is, it); ! instance->prevUser = user; ! instance->prevSystem = system; instance->prevTime = now; --- 68,83 ---- assert(instance); uint64_t now = Util::timeu(); ! ProcStat st; ! readProcStat(st); uint64_t t = now - instance->prevTime; ! double pu = (st.utime - instance->stat.utime) * 10000.0 / t; ! double ps = (st.stime - instance->stat.stime) * 10000.0 / t; int iu = (int)(100 * pu); int is = (int)(100 * ps); int it = iu + is; ! Log::logf("HiResLoadMonitor", "%d %d %d %u %d\n", iu, is, it, st.vsize, st.rss); ! instance->stat = st; instance->prevTime = now; *************** *** 89,101 **** } // expire ! void HiResLoadMonitor::readLoad(uint& user, uint& sys) { statfile.seekg(0, ios::beg); string tmp; int i; ! statfile >> i >> tmp >> tmp >> i ! >> i >> i >> i >> i ! >> i >> i >> i >> i ! >> i >> user >> sys; ! } // readLoad void HiResLoadMonitor::start(uint64_t freq) { --- 87,121 ---- } // expire ! void HiResLoadMonitor::readProcStat(ProcStat& st) { statfile.seekg(0, ios::beg); string tmp; int i; ! uint u; ! statfile >> i // pid ! >> tmp // comm (filename of executable) ! >> tmp // state ! >> i // ppid ! >> i // pgrp ! >> i // session ! >> i // tty_nr ! >> i // tpgid ! >> i // flags ! >> i // minflt ! >> i // cminflt ! >> i // majflt ! >> i // camjflt ! >> st.utime ! >> st.stime ! >> i // cutime ! >> i // cstime ! >> i // priority ! >> i // nice ! >> i // 0 ! >> i // itrealvalue ! >> u // starttime ! >> st.vsize ! >> st.rss ! ; ! } // readProcStat void HiResLoadMonitor::start(uint64_t freq) { *************** *** 110,114 **** instance->schedule(instance->frequency); instance->prevTime = Util::timeu(); ! instance->readLoad(instance->prevUser, instance->prevSystem); } // start --- 130,134 ---- instance->schedule(instance->frequency); instance->prevTime = Util::timeu(); ! instance->readProcStat(instance->stat); } // start Index: LoadMonitor.h =================================================================== RCS file: /cvsroot/tsyncd/src/mace/lib/LoadMonitor.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** LoadMonitor.h 25 Jan 2006 03:48:16 -0000 1.4 --- LoadMonitor.h 4 May 2006 23:34:51 -0000 1.5 *************** *** 40,43 **** --- 40,52 ---- class HiResLoadMonitor : public TimerHandler { public: + class ProcStat { + public: + ProcStat() : utime(0), stime(0), vsize(0), rss(0) { } + uint utime; + uint stime; + uint vsize; + int rss; + }; // ProcStat + void expire(); static void start(uint64_t freq = DEFAULT_FREQUENCY); *************** *** 49,53 **** private: HiResLoadMonitor(uint64_t freq); ! void readLoad(uint& user, uint& sys); private: --- 58,62 ---- private: HiResLoadMonitor(uint64_t freq); ! void readProcStat(ProcStat& stat); private: *************** *** 57,62 **** uint64_t prevTime; pid_t pid; ! uint prevUser; ! uint prevSystem; std::ifstream statfile; std::string path; --- 66,70 ---- uint64_t prevTime; pid_t pid; ! ProcStat stat; std::ifstream statfile; std::string path; Index: ProcessingQueue.h =================================================================== RCS file: /cvsroot/tsyncd/src/mace/lib/ProcessingQueue.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ProcessingQueue.h 20 Sep 2005 03:03:05 -0000 1.2 --- ProcessingQueue.h 4 May 2006 23:34:51 -0000 1.3 *************** *** 86,100 **** virtual ~ProcessingQueue() { ! halt = true; ! ! signalCond(taskSignal); - int status; - assert(pthread_join(processingThread, (void **)&status) == 0); - pthread_mutex_destroy(&taskLock); pthread_mutex_destroy(&resultLock); pthread_cond_destroy(&taskSignal); } // ~ProcessingQueue void enqueue(const T& v) { --- 86,100 ---- virtual ~ProcessingQueue() { ! shutdown(); pthread_mutex_destroy(&taskLock); pthread_mutex_destroy(&resultLock); pthread_cond_destroy(&taskSignal); } // ~ProcessingQueue + + void shutdown() { + halt = true; + signalCond(taskSignal); + } void enqueue(const T& v) { *************** *** 194,198 **** if (halt) { releaseLock(taskLock); - pthread_exit((void*)0); return; } --- 194,197 ---- |
|
From: James W. A. <j_w...@us...> - 2006-05-04 23:34:55
|
Update of /cvsroot/tsyncd/src/mace/services/Http In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4457/services/Http Modified Files: XmlRpcServer.cc XmlRpcUrlHandler.cc XmlRpcUrlHandler.h Log Message: join threads properly to shutdown cleanly Index: XmlRpcUrlHandler.cc =================================================================== RCS file: /cvsroot/tsyncd/src/mace/services/Http/XmlRpcUrlHandler.cc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** XmlRpcUrlHandler.cc 25 Jan 2006 03:48:17 -0000 1.2 --- XmlRpcUrlHandler.cc 4 May 2006 23:34:51 -0000 1.3 *************** *** 56,59 **** --- 56,64 ---- } // ~XmlRpcUrlHandler + void XmlRpcUrlHandler::shutdown() { + assert(requests); + requests->shutdown(); + } // shutdown + void XmlRpcUrlHandler::registerHandler(const string& className, XmlRpcHandler* handler, Index: XmlRpcUrlHandler.h =================================================================== RCS file: /cvsroot/tsyncd/src/mace/services/Http/XmlRpcUrlHandler.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** XmlRpcUrlHandler.h 30 Aug 2005 00:39:41 -0000 1.1 --- XmlRpcUrlHandler.h 4 May 2006 23:34:51 -0000 1.2 *************** *** 77,80 **** --- 77,81 ---- int id, HttpConnection& c); virtual int execute(XmlRpcRequestState* req); + virtual void shutdown(); protected: Index: XmlRpcServer.cc =================================================================== RCS file: /cvsroot/tsyncd/src/mace/services/Http/XmlRpcServer.cc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** XmlRpcServer.cc 3 May 2006 23:21:18 -0000 1.2 --- XmlRpcServer.cc 4 May 2006 23:34:51 -0000 1.3 *************** *** 67,70 **** --- 67,71 ---- void XmlRpcServer::shutdown() { httpd->shutdown(); + xh.shutdown(); } // shutdown |
|
From: James W. A. <j_w...@us...> - 2006-05-03 23:50:36
|
Update of /cvsroot/tsyncd/src/mace/perl5/Mace/Compiler In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21673 Removed Files: ClassParserRecDescent.pm MaceHeaderRecDescent.pm MaceRecDescent.pm Log Message: remove generated files --- MaceRecDescent.pm DELETED --- --- ClassParserRecDescent.pm DELETED --- --- MaceHeaderRecDescent.pm DELETED --- |
|
From: James W. A. <j_w...@us...> - 2006-05-03 23:38:24
|
Update of /cvsroot/tsyncd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16421 Modified Files: Makefile Server.cc Server.h SyncFile.cc VolumeTree.cc tsync tsyncd.cc Log Message: tsync updates Index: tsync =================================================================== RCS file: /cvsroot/tsyncd/src/tsync,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tsync 25 Jan 2006 03:52:45 -0000 1.7 --- tsync 3 May 2006 23:38:18 -0000 1.8 *************** *** 1,7 **** ! #!/usr/bin/env perl ! # Copyright 2005 James W. Anderson. All rights reserved. ! # This program is free software; you can redistribute it and/or ! # modify it under the same terms as Perl itself. use strict; --- 1,7 ---- ! #!/usr/bin/perl -w ! # Copyright 2005-2006 James W. Anderson. All rights reserved. This ! # program is free software; you can redistribute it and/or modify it ! # under the same terms as Perl itself. use strict; *************** *** 9,14 **** --- 9,17 ---- use Sys::Hostname; use Cwd; + use Getopt::Std; # use Time::HiRes qw(gettimeofday tv_interval); + use constant CONFIG_FILE => $ENV{HOME} . "/.tsync/tsyncd.conf"; + my %RETURN_CODES = ( 0 => "SUCCESS", 1 => "PATH_NOT_FOUND", *************** *** 25,29 **** } ! my $serverURL='http://localhost:6666/xmlrpc'; my $client = Frontier::Client->new('url' => $serverURL, --- 28,42 ---- } ! my %opts = (); ! getopt('s:p:', \%opts); ! ! ! my $port = $opts{p} || readPort(); ! unless ($port) { ! die "no xmlrpcPort specified\n"; ! } ! ! my $server = $opts{s} || "localhost"; ! my $serverURL = "http://$server:$port/xmlrpc"; my $client = Frontier::Client->new('url' => $serverURL, *************** *** 116,122 **** } # getDir sub printUsage { die <<EOF; ! usage: $0 <command> [<options>] trans - list transactions begin [<path>] - begin transaction on <path> or current directory --- 129,145 ---- } # getDir + sub readPort { + if (-e CONFIG_FILE) { + my $f = `cat @{[CONFIG_FILE]}`; + if ($f =~ m|\bxmlrpcPort\s*=\s*(\d+)|) { + return $1; + } + } + return 0; + } # readPort + sub printUsage { die <<EOF; ! usage: $0 [-s <server>] [-p <xmlrpcPort>] <command> [<options>] trans - list transactions begin [<path>] - begin transaction on <path> or current directory Index: VolumeTree.cc =================================================================== RCS file: /cvsroot/tsyncd/src/VolumeTree.cc,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** VolumeTree.cc 25 Jan 2006 03:52:45 -0000 1.9 --- VolumeTree.cc 3 May 2006 23:38:18 -0000 1.10 *************** *** 739,743 **** } catch (const FileException& e) { - cerr << e << endl; Log::err() << "error polling " << childpath << ":\n" << e << Log::endl; --- 739,742 ---- *************** *** 918,922 **** } if (fchmod(fd, u.v.mode) < 0) { ! perror("chmod"); assert(0); } --- 917,921 ---- } if (fchmod(fd, u.v.mode) < 0) { ! Log::perror("chmod"); assert(0); } *************** *** 929,933 **** } if (chmod(p.c_str(), u.v.mode) < 0) { ! perror("chmod"); assert(0); } --- 928,932 ---- } if (chmod(p.c_str(), u.v.mode) < 0) { ! Log::perror("chmod"); assert(0); } *************** *** 1075,1079 **** // perror(syscall.c_str()); // cerr << syscall << " " << p << ": " << Util::getErrorString(err) << endl; ! Log::err() << syscall << " " << p << ": " << Util::getErrorString(err) << "\n"; if (err == ENOENT || err == ENOTDIR || err == EEXIST || err == EISDIR || err == ENOTEMPTY) { --- 1074,1078 ---- // perror(syscall.c_str()); // cerr << syscall << " " << p << ": " << Util::getErrorString(err) << endl; ! Log::err() << syscall << " " << p << ": " << Util::getErrorString(err) << Log::endl; if (err == ENOENT || err == ENOTDIR || err == EEXIST || err == EISDIR || err == ENOTEMPTY) { *************** *** 1094,1099 **** if (mtime != Version::NULL_MTIME) { if (utime(p.c_str(), &tb) != 0) { ! cerr << "error setting mtime to " << mtime << " for " << p << endl; ! perror("utime"); assert(0); } --- 1093,1098 ---- if (mtime != Version::NULL_MTIME) { if (utime(p.c_str(), &tb) != 0) { ! Log::err() << "error setting mtime to " << mtime << " for " << p << Log::endl; ! Log::perror("utime"); assert(0); } *************** *** 1108,1113 **** // << dirmtime << Log::endl; if (utime(dirpath.c_str(), &tb) != 0) { ! cerr << "error setting mtime to " << dirmtime << " for " << dirpath << endl; ! perror("utime"); assert(0); } --- 1107,1113 ---- // << dirmtime << Log::endl; if (utime(dirpath.c_str(), &tb) != 0) { ! Log::err() << "error setting mtime to " << dirmtime << " for " << dirpath ! << Log::endl; ! Log::perror("utime"); assert(0); } *************** *** 1227,1231 **** FileUtil::statWithErr(*i, sbuf); if (!S_ISDIR(sbuf.st_mode)) { ! cerr << *i << " is not a directory" << endl; assert(0); } --- 1227,1231 ---- FileUtil::statWithErr(*i, sbuf); if (!S_ISDIR(sbuf.st_mode)) { ! Log::err() << *i << " is not a directory" << Log::endl; assert(0); } *************** *** 1235,1240 **** << "creating directory " << *i << Log::endl; if (mkdir(i->c_str(), S_IRUSR | S_IWUSR | S_IXUSR) < 0) { ! cerr << "could not create directory " << *i << endl; ! perror("mkdir"); assert(0); } --- 1235,1240 ---- << "creating directory " << *i << Log::endl; if (mkdir(i->c_str(), S_IRUSR | S_IWUSR | S_IXUSR) < 0) { ! Log::err() << "could not create directory " << *i << Log::endl; ! Log::perror("mkdir"); assert(0); } *************** *** 1253,1257 **** if (FileUtil::fileExists(SAVE_VERSION_PATH)) { if (unlink(SAVE_VERSION_PATH.c_str()) < 0) { ! perror("unlink"); assert(0); } --- 1253,1257 ---- if (FileUtil::fileExists(SAVE_VERSION_PATH)) { if (unlink(SAVE_VERSION_PATH.c_str()) < 0) { ! Log::perror("unlink"); assert(0); } Index: Makefile =================================================================== RCS file: /cvsroot/tsyncd/src/Makefile,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Makefile 25 Jan 2006 03:52:45 -0000 1.4 --- Makefile 3 May 2006 23:38:18 -0000 1.5 *************** *** 4,8 **** EXTRA_INCLUDES = -Irsync EXTRA_LIBDIR = -Lrsync ! EXTRA_LIB = -lrsync XMLRPC = Tsync.h TsyncUI.h DIRS = rsync mace --- 4,8 ---- EXTRA_INCLUDES = -Irsync EXTRA_LIBDIR = -Lrsync ! EXTRA_MLIB = rsync XMLRPC = Tsync.h TsyncUI.h DIRS = rsync mace *************** *** 12,14 **** NOMACEDIRS = $(filter-out clean_mace, $(CLEANDIRS)) cleant: $(NOMACEDIRS) ! rm -f *.o *.d *.stripped $(APPS) $(LIB) $(DEL) $(XMLRPCHDRS) $(XMLRPCSRCHDRS) $(XMLRPCSRCS) --- 12,14 ---- NOMACEDIRS = $(filter-out clean_mace, $(CLEANDIRS)) cleant: $(NOMACEDIRS) ! rm -f *.o *.d *.stripped Makefile.xmlrpc $(APPS) $(LIB) $(DEL) $(XMLRPCHDRS) $(XMLRPCSRCHDRS) $(XMLRPCSRCS) Index: tsyncd.cc =================================================================== RCS file: /cvsroot/tsyncd/src/tsyncd.cc,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** tsyncd.cc 25 Jan 2006 03:52:45 -0000 1.8 --- tsyncd.cc 3 May 2006 23:38:18 -0000 1.9 *************** *** 49,52 **** --- 49,57 ---- using std::string; + static const string VERSION = "0.8.1"; + static const string DATE = "2005-2006"; + static const string AUTHORS = "James W. Anderson and John Fisher-Ogden"; + static const bool RUN_ACCUM = false; + Server* server; *************** *** 64,73 **** void printUsage() { ! const char* usage = "usage: tsyncd [-e exports] [-c options] [-bir] \n" ! " -e file\t: specify alternate exports file (default: tsyncd.exports)\n" ! " -c file\t: specify alternate configuration file (default: tsyncd.conf)\n" " -b\t\t: enable backup mode: only receive synchronizations (default: off)\n" " -i\t\t: clear history and resynchronize (default: off)\n" " -r\t\t: reset history and versions (default: off)\n" ; cerr << usage << endl; --- 69,80 ---- void printUsage() { ! const char* usage = "usage: tsyncd [-e exports] [-c options] [-Vdbir] \n" ! " -e file\t: specify alternate exports file (default: ~/.tsync/tsyncd.exports)\n" ! " -c file\t: specify alternate configuration file (default: ~/.tsync/tsyncd.conf)\n" ! " -d\t\t: run in daemon mode\n" " -b\t\t: enable backup mode: only receive synchronizations (default: off)\n" " -i\t\t: clear history and resynchronize (default: off)\n" " -r\t\t: reset history and versions (default: off)\n" + " -V\t\t: print version and exit\n" ; cerr << usage << endl; *************** *** 75,81 **** int main(int argc, char* argv[]) { ! string config = "tsyncd.conf"; ! string exports = "tsyncd.exports"; bool initialize = false; bool backup = false; --- 82,94 ---- int main(int argc, char* argv[]) { + char* envhome = getenv("HOME"); + string home = ""; + if (envhome != NULL) { + home = envhome; + home += "/.tsync/"; + } ! string config = home + "tsyncd.conf"; ! string exports = home + "tsyncd.exports"; bool initialize = false; bool backup = false; *************** *** 90,97 **** {"initialize", no_argument, 0, 'i'}, {"reset", no_argument, 0, 'r'}, {"help", no_argument, 0, 'h'} }; ! int c = getopt_long(argc, argv, "c:e:bihr", long_options, &index); if (c == -1) { break; --- 103,112 ---- {"initialize", no_argument, 0, 'i'}, {"reset", no_argument, 0, 'r'}, + {"daemonize", no_argument, 0, 'd'}, + {"version", no_argument, 0, 'V'}, {"help", no_argument, 0, 'h'} }; ! int c = getopt_long(argc, argv, "c:e:bihrdV", long_options, &index); if (c == -1) { break; *************** *** 114,117 **** --- 129,142 ---- reset = true; break; + case 'd': + if (daemon(0, 0) < 0) { + perror("daemon"); + exit(-1); + } + break; + case 'V': + cout << "Tsync version " << VERSION << endl; + // cout << "Copyright (C) " << DATE << " " << AUTHORS << endl; + exit(0); case 'h': printUsage(); *************** *** 154,159 **** Log::add("ERROR", stderr, LOG_TIMESTAMP_HUMAN, LOG_NAME_ENABLED, LOG_THREADID_ENABLED); - // FILE* serverLog = Log::openLogFile("/tmp/server.log", "w"); - Log::configure(p); --- 179,182 ---- *************** *** 161,196 **** // Log::autoAddAll(serverLog, LOG_TIMESTAMP_EPOCH, LOG_NAME_ENABLED); ! // Log::autoAdd("ERROR", serverLog, LOG_TIMESTAMP_HUMAN); ! // Log::autoAdd("Server", serverLog, LOG_TIMESTAMP_HUMAN); ! // Log::autoAdd("RandTree", serverLog, LOG_TIMESTAMP_HUMAN); ! // Log::autoAdd("VolumeManager", serverLog, LOG_TIMESTAMP_HUMAN); ! // Log::autoAdd("VolumeTree", serverLog, LOG_TIMESTAMP_HUMAN); ! // Log::autoAdd("UpdateManager", serverLog, LOG_TIMESTAMP_HUMAN); ! // Log::autoAdd("Http", serverLog, LOG_TIMESTAMP_HUMAN); ! // Log::autoAdd("Tcp", serverLog, LOG_TIMESTAMP_HUMAN); ! // Log::autoAdd("RecoveryDownloadManager", serverLog, LOG_TIMESTAMP_HUMAN); ! ! Log::logToFile("/tmp/tcpread.log", Accumulator::TCP_READ_SELECTOR); ! Log::logToFile("/tmp/tcpwrite.log", Accumulator::TCP_WRITE_SELECTOR); ! Log::logToFile("/tmp/httpclientread.log", Accumulator::HTTP_CLIENT_READ_SELECTOR); ! Log::logToFile("/tmp/httpclientwrite.log", Accumulator::HTTP_CLIENT_WRITE_SELECTOR); ! Log::logToFile("/tmp/httpserverread.log", Accumulator::HTTP_SERVER_READ_SELECTOR); ! Log::logToFile("/tmp/httpserverwrite.log", Accumulator::HTTP_SERVER_WRITE_SELECTOR); ! Log::logToFile("/tmp/send.log", Accumulator::TRANSPORT_SEND_SELECTOR); ! Log::logToFile("/tmp/recv.log", Accumulator::TRANSPORT_RECV_SELECTOR); ! Log::logToFile("/tmp/filewrite.log", Accumulator::FILE_WRITE_SELECTOR); ! Log::logToFile("/tmp/gossip.log", "Server::deliverGossip"); ! Log::logToFile("/tmp/timers.log", "Server::timers"); Log::logf("Server", "\n\nserver starting\n\n"); ! // HiResLoadMonitor::start(5*1000*1000); ! Accumulator::startLogging(); try { ! int xmlrpcPort = p->getInt("xmlrpcPort"); ! ! server = new Server(exports, config, xmlrpcPort, initialize, reset, backup); SysUtil::signal(SIGINT, &shutdownHandler); --- 184,212 ---- // Log::autoAddAll(serverLog, LOG_TIMESTAMP_EPOCH, LOG_NAME_ENABLED); ! if (RUN_ACCUM) { ! Log::logToFile("/tmp/tcpread.log", Accumulator::TCP_READ_SELECTOR); ! Log::logToFile("/tmp/tcpwrite.log", Accumulator::TCP_WRITE_SELECTOR); ! Log::logToFile("/tmp/httpclientread.log", Accumulator::HTTP_CLIENT_READ_SELECTOR); ! Log::logToFile("/tmp/httpclientwrite.log", Accumulator::HTTP_CLIENT_WRITE_SELECTOR); ! Log::logToFile("/tmp/httpserverread.log", Accumulator::HTTP_SERVER_READ_SELECTOR); ! Log::logToFile("/tmp/httpserverwrite.log", Accumulator::HTTP_SERVER_WRITE_SELECTOR); ! Log::logToFile("/tmp/send.log", Accumulator::TRANSPORT_SEND_SELECTOR); ! Log::logToFile("/tmp/recv.log", Accumulator::TRANSPORT_RECV_SELECTOR); ! Log::logToFile("/tmp/filewrite.log", Accumulator::FILE_WRITE_SELECTOR); ! Log::logToFile("/tmp/gossip.log", "Server::deliverGossip"); ! Log::logToFile("/tmp/timers.log", "Server::timers"); ! } Log::logf("Server", "\n\nserver starting\n\n"); ! if (RUN_ACCUM) { ! HiResLoadMonitor::start(5*1000*1000); ! Accumulator::startLogging(); ! } try { + uint16_t xmlrpcPort = p->get<uint16_t>("xmlrpcPort"); ! server = new Server(exports, config, xmlrpcPort, initialize, reset, backup); SysUtil::signal(SIGINT, &shutdownHandler); *************** *** 205,211 **** } ! Accumulator::stopLogging(); ! Log::closeLogFiles(); Scheduler::haltScheduler(); return 0; --- 221,230 ---- } ! if (RUN_ACCUM) { ! Accumulator::stopLogging(); ! } ! Scheduler::haltScheduler(); + Log::closeLogFiles(); return 0; Index: SyncFile.cc =================================================================== RCS file: /cvsroot/tsyncd/src/SyncFile.cc,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** SyncFile.cc 25 Jan 2006 03:52:45 -0000 1.5 --- SyncFile.cc 3 May 2006 23:38:18 -0000 1.6 *************** *** 28,31 **** --- 28,32 ---- #include "Log.h" #include "HashUtil.h" + #include "Util.h" #include "StrUtil.h" *************** *** 149,153 **** } catch (const FileException& e) { ! cerr << e; assert(0); } --- 150,154 ---- } catch (const FileException& e) { ! Log::err() << e << Log::endl; assert(0); } *************** *** 167,178 **** struct utimbuf tb = { now, mtime }; if (utime(sp.c_str(), &tb) != 0) { ! cerr << "error setting mtime to " << mtime << " for " << sp ! << " (" << path << ")" << endl; ! perror("utime"); assert(0); } if (rename(sp.c_str(), path.c_str()) < 0) { ! perror("rename"); assert(0); } --- 168,179 ---- struct utimbuf tb = { now, mtime }; if (utime(sp.c_str(), &tb) != 0) { ! Log::err() << "error setting mtime to " << mtime << " for " << sp ! << " (" << path << ")" << Log::endl; ! Log::perror("utime"); assert(0); } if (rename(sp.c_str(), path.c_str()) < 0) { ! Log::perror("rename"); assert(0); } Index: Server.cc =================================================================== RCS file: /cvsroot/tsyncd/src/Server.cc,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Server.cc 25 Jan 2006 04:11:39 -0000 1.13 --- Server.cc 3 May 2006 23:38:18 -0000 1.14 *************** *** 39,43 **** using mace::string; - using TcpTransport_namespace::TcpTransportService; const std::string Server::XMLRPC_URL = "/xmlrpc"; --- 39,42 ---- *************** *** 76,80 **** forceRecovery(false), isBusy(false), ! hasConflicts(false) { XMLRPC_PORT = xport; --- 75,87 ---- forceRecovery(false), isBusy(false), ! hasConflicts(false), ! router(TcpTransport_namespace::new_TcpTransport_BufferedRoute(TransportCrypto::TLS)), ! dataRouter(TcpTransport_namespace::new_TcpTransport_BufferedRoute(TransportCrypto::TLS)), ! tree(RandTree_namespace::new_RandTree_Tree(router, 4)), ! multicaster(GenericTreeMulticast_namespace::new_GenericTreeMulticast_HierarchicalMulticast(dataRouter, tree)), ! aggregator(RanSubAggregator_namespace::new_RanSubAggregator_Aggregate(tree, router, ! 5*1000*1000)), ! gossiper(RanSub_namespace::new_RanSub_Gossip(aggregator)) ! { XMLRPC_PORT = xport; *************** *** 95,124 **** xmlrpcServer->registerHandler("TsyncUI", new TsyncUIXmlRpcHandler<Server>(this)); ! TransportCrypto::type cryptoFlags = TransportCrypto::TLS; ! ! router = new TcpTransportService(cryptoFlags); ! router->maceInit(); ! ! dataRouter = new TcpTransportService(cryptoFlags); ! dataRouter->maceInit(); ! tree = new RandTree_namespace::RandTreeService(*router, 4); ! tree->maceInit(); ! tree->registerUniqueHandler((OverlayJoinHandler&)*this); ! multicaster = new ! GenericTreeMulticast_namespace::GenericTreeMulticastService(*dataRouter, *tree); ! multicaster->maceInit(); ! multicaster->registerUniqueHandler((ReceiveDataHandler&)*this); ! aggregator = new RanSubAggregator_namespace::RanSubAggregatorService(*tree, *router, ! 5*1000*1000); ! aggregator->maceInit(); ! aggregator->registerUniqueHandler(*this); ! gossiper = new RanSub_namespace::RanSubService(*aggregator); ! gossiper->maceInit(); ! gossiper->registerUniqueHandler(*this); csumRequestPool = --- 102,121 ---- xmlrpcServer->registerHandler("TsyncUI", new TsyncUIXmlRpcHandler<Server>(this)); ! // TransportCrypto::type cryptoFlags = TransportCrypto::TLS; ! router.maceInit(); ! dataRouter.maceInit(); ! tree.maceInit(); ! tree.registerUniqueHandler((OverlayJoinHandler&)*this); ! multicaster.maceInit(); ! multicaster.registerUniqueHandler((ReceiveDataHandler&)*this); ! aggregator.maceInit(); ! aggregator.registerUniqueHandler(*this); ! gossiper.maceInit(); ! gossiper.registerUniqueHandler(*this); csumRequestPool = *************** *** 132,136 **** initThreads(); - } // Server --- 129,132 ---- *************** *** 166,170 **** processUpdates(); if ((now - lastPoll) > SERVER_POLL_INTERVAL) { ! uint64_t routerbuf = dataRouter->bufferedDataSize(); if (um.hasOutgoingUpdatesWaiting() || (routerbuf > BUFFERED_DATA_AVOIDANCE_SIZE)) { if ((pollcount % 4) == 0) { --- 162,166 ---- processUpdates(); if ((now - lastPoll) > SERVER_POLL_INTERVAL) { ! uint64_t routerbuf = dataRouter.bufferedDataSize(); if (um.hasOutgoingUpdatesWaiting() || (routerbuf > BUFFERED_DATA_AVOIDANCE_SIZE)) { if ((pollcount % 4) == 0) { *************** *** 206,217 **** } // run - void Server::daemonize() { - int r = daemon(0, 0); - if (r < 0) { - Log::err() << "could not daemonize: " << Util::getErrorString(errno) << Log::endl; - ::exit(-1); - } - } // daemonize - void Server::shutdown() { Log::log("Server::shutdown") << "tsync server shutting down" << Log::endl; --- 202,205 ---- *************** *** 230,239 **** xmlrpcServer->shutdown(); ! gossiper->maceExit(); ! aggregator->maceExit(); ! multicaster->maceExit(); ! tree->maceExit(); ! dataRouter->maceExit(); ! router->maceExit(); Log::log("Server::exit") << "tsync server exiting" << Log::endl; } // exit --- 218,227 ---- xmlrpcServer->shutdown(); ! gossiper.maceExit(); ! aggregator.maceExit(); ! multicaster.maceExit(); ! tree.maceExit(); ! dataRouter.maceExit(); ! router.maceExit(); Log::log("Server::exit") << "tsync server exiting" << Log::endl; } // exit *************** *** 282,286 **** acquireLock(joinLock); ! multicaster->joinOverlay(servers); waitForCond(joinSignal, joinLock); --- 270,274 ---- acquireLock(joinLock); ! multicaster.joinOverlay(servers); waitForCond(joinSignal, joinLock); *************** *** 295,299 **** const SubVolumeList& l = vm.getSubVolumes(); for (SubVolumeList::const_iterator i = l.begin(); i != l.end(); i++) { ! aggregator->aggregateSubscribe(i->first); } } // loadVolumes --- 283,287 ---- const SubVolumeList& l = vm.getSubVolumes(); for (SubVolumeList::const_iterator i = l.begin(); i != l.end(); i++) { ! aggregator.aggregateSubscribe(i->first); } } // loadVolumes *************** *** 330,334 **** Version newRootVersion = vm.getRootVersion(sv); ! GossipMap gmap = gossiper->getGossip(sv.first); for (GossipMap::const_iterator i = gmap.begin(); i != gmap.end(); i++) { --- 318,322 ---- Version newRootVersion = vm.getRootVersion(sv); ! GossipMap gmap = gossiper.getGossip(sv.first); for (GossipMap::const_iterator i = gmap.begin(); i != gmap.end(); i++) { *************** *** 343,347 **** } ! um.completePoll(newRootVersion, oldRootVersion, gossiper->getGossip(sv.first)); // um.verifyQueues(true); --- 331,335 ---- } ! um.completePoll(newRootVersion, oldRootVersion, gossiper.getGossip(sv.first)); // um.verifyQueues(true); *************** *** 361,366 **** maceout << "publishing " << um.getVersionsForGossip(sv.first).get("/") << " on gossip channel " << sv.first << Log::endl; ! gossiper->subscribeGossip(sv.first); ! gossiper->publishGossip(sv.first, s); } --- 349,354 ---- maceout << "publishing " << um.getVersionsForGossip(sv.first).get("/") << " on gossip channel " << sv.first << Log::endl; ! gossiper.subscribeGossip(sv.first); ! gossiper.publishGossip(sv.first, s); } *************** *** 377,381 **** const SubVolumeList& svl = vm.getSubVolumes(); bool skip = false; ! uint64_t routerbuf = dataRouter->bufferedDataSize(); for (SubVolumeList::const_iterator svli = svl.begin(); svli != svl.end(); svli++) { const SubVolumeId& sv = *svli; --- 365,369 ---- const SubVolumeList& svl = vm.getSubVolumes(); bool skip = false; ! uint64_t routerbuf = dataRouter.bufferedDataSize(); for (SubVolumeList::const_iterator svli = svl.begin(); svli != svl.end(); svli++) { const SubVolumeId& sv = *svli; *************** *** 402,406 **** << " force=" << forceRecovery << Log::endl; ! GossipMap gmap = gossiper->getGossip(sv.first); // log << "heard gossip from " << gmap.size() << " peers for volume" << vid // << Log::endl; --- 390,394 ---- << " force=" << forceRecovery << Log::endl; ! GossipMap gmap = gossiper.getGossip(sv.first); // log << "heard gossip from " << gmap.size() << " peers for volume" << vid // << Log::endl; *************** *** 471,476 **** hasConflicts = true; maceout << "revoking gossip for " << sv.first << Log::endl; ! gossiper->revokeGossip(sv.first); ! gossiper->unsubscribeGossip(sv.first); // leave isRecovering = true so that we do not respond to // recovery requests --- 459,464 ---- hasConflicts = true; maceout << "revoking gossip for " << sv.first << Log::endl; ! gossiper.revokeGossip(sv.first); ! gossiper.unsubscribeGossip(sv.first); // leave isRecovering = true so that we do not respond to // recovery requests *************** *** 853,857 **** log << "multicasting checksum request, waiting for checksums" << Log::endl; string s = Update::serializeUpdate(*u); ! multicaster->multicast(DATA_UPDATE_CHANNEL, s); um.waitForChecksumsPeers(u); } --- 841,845 ---- log << "multicasting checksum request, waiting for checksums" << Log::endl; string s = Update::serializeUpdate(*u); ! multicaster.multicast(DATA_UPDATE_CHANNEL, s); um.waitForChecksumsPeers(u); } *************** *** 945,949 **** string s; ub.serialize(s); ! multicaster->multicast(META_UPDATE_CHANNEL, s); // continue; --- 933,937 ---- string s; ub.serialize(s); ! multicaster.multicast(META_UPDATE_CHANNEL, s); // continue; *************** *** 1002,1006 **** ADD_SELECTORS("Server::multicastDataUpdate"); if (s.size() < MIN_CHUNK_SIZE) { ! multicaster->multicast(DATA_UPDATE_CHANNEL, s); } else { --- 990,994 ---- ADD_SELECTORS("Server::multicastDataUpdate"); if (s.size() < MIN_CHUNK_SIZE) { ! multicaster.multicast(DATA_UPDATE_CHANNEL, s); } else { *************** *** 1011,1019 **** off += DATA_CHUNK_SIZE; // macedbg(1) << "sending header with size=" << sz << Log::endl; ! multicaster->multicast(DATA_CHUNK_HEADER_CHANNEL, d); while (off < sz) { size_t cs = std::min(DATA_CHUNK_SIZE, sz - off); ! multicaster->multicast(DATA_CHUNK_CHANNEL, std::string(s.data() + off, cs)); off += DATA_CHUNK_SIZE; } --- 999,1007 ---- off += DATA_CHUNK_SIZE; // macedbg(1) << "sending header with size=" << sz << Log::endl; ! multicaster.multicast(DATA_CHUNK_HEADER_CHANNEL, d); while (off < sz) { size_t cs = std::min(DATA_CHUNK_SIZE, sz - off); ! multicaster.multicast(DATA_CHUNK_CHANNEL, std::string(s.data() + off, cs)); off += DATA_CHUNK_SIZE; } *************** *** 1036,1040 **** pthread_mutex_init(&conflictsLock, 0); runNewThread(&networkThread, Server::startNetworkThread, this, 0); ! Scheduler::Instance().shutdownJoinThread(networkThread); } // initThreads --- 1024,1028 ---- pthread_mutex_init(&conflictsLock, 0); runNewThread(&networkThread, Server::startNetworkThread, this, 0); ! // Scheduler::Instance().shutdownJoinThread(networkThread); } // initThreads *************** *** 1101,1105 **** maceout << "multicasting " << u << Log::endl; string s = Update::serializeUpdate(u); ! multicaster->multicast(CONFLICT_UPDATE_CHANNEL, s); return TsyncResult::SUCCESS; } // distributeConflictResolution --- 1089,1093 ---- maceout << "multicasting " << u << Log::endl; string s = Update::serializeUpdate(u); ! multicaster.multicast(CONFLICT_UPDATE_CHANNEL, s); return TsyncResult::SUCCESS; } // distributeConflictResolution *************** *** 1145,1149 **** for (SubVolumeList::const_iterator i = svl.begin(); i != svl.end(); i++) { SubVolumeId sv = *i; ! GossipMap gmap = gossiper->getGossip(sv.first); for (GossipMap::const_iterator i = gmap.begin(); i != gmap.end(); i++) { --- 1133,1137 ---- for (SubVolumeList::const_iterator i = svl.begin(); i != svl.end(); i++) { SubVolumeId sv = *i; ! GossipMap gmap = gossiper.getGossip(sv.first); for (GossipMap::const_iterator i = gmap.begin(); i != gmap.end(); i++) { *************** *** 1162,1166 **** TsyncUI::StringStringMap r; volume_id_t vid = VolumeTree::computeVolumeId(volumeName); ! GossipMap gmap = gossiper->getGossip(vid); for (GossipMap::const_iterator i = gmap.begin(); i != gmap.end(); i++) { mace::string h = i->first.toString(); --- 1150,1154 ---- TsyncUI::StringStringMap r; volume_id_t vid = VolumeTree::computeVolumeId(volumeName); ! GossipMap gmap = gossiper.getGossip(vid); for (GossipMap::const_iterator i = gmap.begin(); i != gmap.end(); i++) { mace::string h = i->first.toString(); *************** *** 1318,1325 **** void Server::deliver(const MaceKey& src, const MaceKey& dest, const std::string& s, ! comm_type_t commtype, registration_uid_t rid) { ADD_SELECTORS("Server::deliver"); ! if (src == multicaster->getLocalAddress()) { return; } --- 1306,1313 ---- void Server::deliver(const MaceKey& src, const MaceKey& dest, const std::string& s, ! registration_uid_t rid) { ADD_SELECTORS("Server::deliver"); ! if (src == multicaster.getLocalAddress()) { return; } *************** *** 1330,1405 **** } ! if (commtype == COMM_TYPE_MULTICAST) { ! if (dest == CONFLICT_UPDATE_CHANNEL) { ! UpdatePtr u = Update::deserializeUpdate(s); ! ResolveUpdatePtr ru = dynamic_pointer_cast<ResolveUpdate>(u); ! // XXX ! assert(ru); ! maceout << "received multicast conflict update from " << src << " " << *ru ! << Log::endl; ! resolveConflict(src, ru); ! } ! else if (hasConflicts) { ! maceout << "hasConflicts, discarding updates from " << src << Log::endl; ! return; ! } ! else if (dest == DATA_UPDATE_CHANNEL) { ! UpdatePtr u = Update::deserializeUpdate(s); ! macedbg(1) << "received multicast update " << *u << Log::endl; ! um.enqueueIncomingUpdate(u, src, isRecovering); ! } ! else if (dest == META_UPDATE_CHANNEL) { ! UpdateBag ub; ! istringstream is(s); ! ub.deserialize(is); ! maceout << "received " << ub.size() << " meta updates\n"; ! const MetaUpdateList& ul = ub.getMetaUpdates(); ! for (MetaUpdateList::const_iterator i = ul.begin(); i != ul.end(); i++) { ! macedbg(1) << "enqueueing " << **i << "\n"; ! um.enqueueIncomingUpdate(*i, src, isRecovering); ! } ! maceout << Log::endl; } ! else if (dest == DATA_CHUNK_HEADER_CHANNEL) { // size_t sz = (size_t)s.substr(0, sizeof(sz)).data(); ! size_t sz = 0; ! memcpy(&sz, s.data(), sizeof(sz)); // maceout << "read header size=" << sz << Log::endl; ! ChunkedData& chunk = partialChunks[src]; ! chunk.data = s.substr(sizeof(sz)); ! chunk.data.reserve(sz); ! chunk.size = sz; } ! else if (dest == DATA_CHUNK_CHANNEL) { ! ChunkedData& chunk = partialChunks[src]; ! if (chunk.size == 0) { ! macedbg(1) << "ignoring chunk with missing header from " << src << Log::endl; ! } ! else { ! chunk.data.append(s); ! if (chunk.data.size() == chunk.size) { ! UpdatePtr u = Update::deserializeUpdate(chunk.data); ! macedbg(1) << "received multicast chunked update " << *u << Log::endl; ! um.enqueueIncomingUpdate(u, src, isRecovering); ! chunk.data.clear(); ! chunk.size = 0; ! } } } - else { - assert(0); - } } else { assert(0); } - // else if (commtype == COMM_TYPE_UNICAST) { - - // } - // else { - // assert(0); - // } } // deliver --- 1318,1382 ---- } ! if (dest == CONFLICT_UPDATE_CHANNEL) { ! UpdatePtr u = Update::deserializeUpdate(s); ! ResolveUpdatePtr ru = dynamic_pointer_cast<ResolveUpdate>(u); ! // XXX ! assert(ru); ! maceout << "received multicast conflict update from " << src << " " << *ru ! << Log::endl; ! resolveConflict(src, ru); ! } ! else if (hasConflicts) { ! maceout << "hasConflicts, discarding updates from " << src << Log::endl; ! return; ! } ! else if (dest == DATA_UPDATE_CHANNEL) { ! UpdatePtr u = Update::deserializeUpdate(s); ! macedbg(1) << "received multicast update " << *u << Log::endl; ! um.enqueueIncomingUpdate(u, src, isRecovering); ! } ! else if (dest == META_UPDATE_CHANNEL) { ! UpdateBag ub; ! istringstream is(s); ! ub.deserialize(is); ! maceout << "received " << ub.size() << " meta updates\n"; ! const MetaUpdateList& ul = ub.getMetaUpdates(); ! for (MetaUpdateList::const_iterator i = ul.begin(); i != ul.end(); i++) { ! macedbg(1) << "enqueueing " << **i << "\n"; ! um.enqueueIncomingUpdate(*i, src, isRecovering); } ! maceout << Log::endl; ! } ! else if (dest == DATA_CHUNK_HEADER_CHANNEL) { // size_t sz = (size_t)s.substr(0, sizeof(sz)).data(); ! size_t sz = 0; ! memcpy(&sz, s.data(), sizeof(sz)); // maceout << "read header size=" << sz << Log::endl; ! ChunkedData& chunk = partialChunks[src]; ! chunk.data = s.substr(sizeof(sz)); ! chunk.data.reserve(sz); ! chunk.size = sz; ! } ! else if (dest == DATA_CHUNK_CHANNEL) { ! ChunkedData& chunk = partialChunks[src]; ! if (chunk.size == 0) { ! macedbg(1) << "ignoring chunk with missing header from " << src << Log::endl; } ! else { ! chunk.data.append(s); ! if (chunk.data.size() == chunk.size) { ! UpdatePtr u = Update::deserializeUpdate(chunk.data); ! macedbg(1) << "received multicast chunked update " << *u << Log::endl; ! um.enqueueIncomingUpdate(u, src, isRecovering); ! chunk.data.clear(); ! chunk.size = 0; } } } else { assert(0); } } // deliver Index: Server.h =================================================================== RCS file: /cvsroot/tsyncd/src/Server.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Server.h 25 Jan 2006 03:52:45 -0000 1.10 --- Server.h 3 May 2006 23:38:18 -0000 1.11 *************** *** 40,44 **** #include <sstream> - #include "RandTree.h" #include "AggregateServiceClass.h" #include "GossipServiceClass.h" --- 40,43 ---- *************** *** 46,53 **** #include "RouteServiceClass.h" #include "TreeServiceClass.h" ! #include "TcpTransport.h" ! #include "GenericTreeMulticast.h" ! #include "RanSub.h" ! #include "RanSubAggregator.h" #include "XmlRpcServer.h" --- 45,53 ---- #include "RouteServiceClass.h" #include "TreeServiceClass.h" ! #include "RandTree-init.h" ! #include "TcpTransport-init.h" ! #include "GenericTreeMulticast-init.h" ! #include "RanSub-init.h" ! #include "RanSubAggregator-init.h" #include "XmlRpcServer.h" *************** *** 102,106 **** // receive data handler void deliver(const MaceKey& source, const MaceKey& destination, ! const std::string& s, comm_type_t commType, registration_uid_t rid); // aggregate handler --- 102,106 ---- // receive data handler void deliver(const MaceKey& source, const MaceKey& destination, ! const std::string& s, registration_uid_t rid); // aggregate handler *************** *** 137,141 **** private: - void daemonize(); void loadVolumes(); void initThreads(); --- 137,140 ---- *************** *** 215,224 **** ChunkedDataMap partialChunks; ! TreeServiceClass* tree; ! AggregateServiceClass* aggregator; ! GossipServiceClass* gossiper; ! HierarchicalMulticastServiceClass* multicaster; ! BufferedRouteServiceClass* router; ! BufferedRouteServiceClass* dataRouter; static const time_t SERVER_RECOVERY_INTERVAL; --- 214,223 ---- ChunkedDataMap partialChunks; ! BufferedRouteServiceClass& router; ! BufferedRouteServiceClass& dataRouter; ! TreeServiceClass& tree; ! HierarchicalMulticastServiceClass& multicaster; ! AggregateServiceClass& aggregator; ! GossipServiceClass& gossiper; static const time_t SERVER_RECOVERY_INTERVAL; |
|
From: James W. A. <j_w...@us...> - 2006-05-03 23:38:21
|
Update of /cvsroot/tsyncd/src/rsync In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16421/rsync Modified Files: SyncFileIO.cc Log Message: tsync updates Index: SyncFileIO.cc =================================================================== RCS file: /cvsroot/tsyncd/src/rsync/SyncFileIO.cc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SyncFileIO.cc 15 Jul 2005 21:30:33 -0000 1.2 --- SyncFileIO.cc 3 May 2006 23:38:18 -0000 1.3 *************** *** 37,40 **** --- 37,41 ---- #include "SyncFileIO.h" #include "FileUtil.h" + #include "Log.h" using std::min; *************** *** 48,52 **** } catch (const FileException& e) { ! cerr << e; assert(0); } --- 49,53 ---- } catch (const FileException& e) { ! Log::err() << e << Log::endl; assert(0); } *************** *** 54,58 **** int fd = open(path.c_str(), O_RDONLY); if (fd < 0) { ! perror("open"); assert(0); } --- 55,59 ---- int fd = open(path.c_str(), O_RDONLY); if (fd < 0) { ! Log::perror("open"); assert(0); } |
|
From: James W. A. <j_w...@us...> - 2006-05-03 23:36:43
|
Update of /cvsroot/tsyncd/src/mace In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15655a Modified Files: Makefile Log Message: fix make dirs Index: Makefile =================================================================== RCS file: /cvsroot/tsyncd/src/mace/Makefile,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Makefile 3 May 2006 23:21:17 -0000 1.5 --- Makefile 3 May 2006 23:36:40 -0000 1.6 *************** *** 1,4 **** ! #DIRS=lib compiler services application ! DIRS=perl5 lib services application # MACEPATH = . --- 1,3 ---- ! DIRS=perl5 lib services # MACEPATH = . |
|
From: James W. A. <j_w...@us...> - 2006-05-03 23:34:04
|
Update of /cvsroot/tsyncd/src/mace/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14535 Added Files: MaceTime.h Log Message: missing file --- NEW FILE: MaceTime.h --- #ifndef _MACE_TIME_H #define _MACE_TIME_H #include "Util.h" #include "Printable.h" #include "Serializable.h" #include "hash_string.h" #include "Traits.h" class Sim; namespace mace { typedef uint64_t MonotoneTime; class MaceTime : public PrintPrintable, public Serializable { friend class ::Sim; friend class mace::KeyTraits<MaceTime>; public: MaceTime() : realtime(0), tainted(true) { } MaceTime(uint64_t offset) : realtime(offset), tainted(true) { } MaceTime(const MaceTime& other) : realtime(other.realtime), tainted(other.tainted) { } MaceTime& operator=(const MaceTime& other) { realtime = other.realtime; tainted = other.tainted; return *this; } MaceTime& operator=(uint64_t offset) { realtime = offset; tainted = true; return *this; } MaceTime operator+(const MaceTime& other) const { return plus(other); } MaceTime operator-(const MaceTime& other) const { return minus(other); } bool operator==(const MaceTime& other) const { return realtime == other.realtime; } bool operator==(const uint64_t& other) const { return realtime == other; } bool operator!=(const MaceTime& other) const { return realtime != other.realtime; } bool operator!=(const uint64_t& other) const { return realtime != other; } // operator bool() const { // return realtime != 0; // } bool lessThan(const MaceTime& other, uint trueWeight = 1, uint falseWeight = 1) const { if (simulated && (tainted || other.tainted)) { return Util::randInt(2, falseWeight, trueWeight); } else { return realtime < other.realtime; } } bool greaterThan(const MaceTime& other, uint trueWeight = 1, uint falseWeight = 1) const { return !lessThanOrEqual(other, falseWeight, trueWeight); } bool lessThanOrEqual(const MaceTime& other, uint trueWeight = 1, uint falseWeight = 1) const { if (simulated && (tainted || other.tainted)) { return Util::randInt(2, falseWeight, trueWeight); } else { return realtime <= other.realtime; } } bool greaterThanOrEqual(const MaceTime& other, uint trueWeight = 1, uint falseWeight = 1) const { return !lessThan(other, falseWeight, trueWeight); } bool equals(const MaceTime& other, uint trueWeight = 1, uint falseWeight = 1) const { if (simulated && (tainted || other.tainted)) { return Util::randInt(2, falseWeight, trueWeight); } else { return realtime == other.realtime; } } bool notEquals(const MaceTime& other, uint trueWeight = 1, uint falseWeight = 1) const { return !equals(other, falseWeight, trueWeight); } MaceTime plus(const MaceTime& other) const { MaceTime t(*this); t.realtime += other.realtime; t.tainted |= other.tainted; return t; } MaceTime minus(const MaceTime& other) const { MaceTime t(*this); t.realtime -= other.realtime; t.tainted |= other.tainted; return t; } MaceTime scaleBy(uint amount) const { MaceTime t(*this); t.realtime *= amount; // clear tainted if amount == 0 ? return t; } MaceTime scaleBy(double amount) const { MaceTime t(*this); t.realtime = (uint64_t)((double)t.realtime * amount); // clear tainted if amount == 0 ? return t; } void serialize(std::string& s) const { mace::serialize(s, &realtime, realtime); } int deserialize(istream& in) throw(SerializationException) { int off = 0; off += mace::deserialize(in, &realtime, realtime); tainted = true; return off; } void print(std::ostream& out) const { out << realtime; } void printState(std::ostream& out) const { if(simulated && tainted) { out << "NON-DET"; } else { out << realtime; } } size_t hashOf() const { static const hash_bytes<uint64_t> h = hash_bytes<uint64_t>(); return h(realtime); } uint64_t time() const { return realtime; } bool isZero() const { return realtime == 0; } static const MaceTime& min(const MaceTime& l, const MaceTime& r) { if (l.realtime < r.realtime) { return l; } return r; } static MaceTime currentTime() { MaceTime t(Util::timeu()); t.tainted = true; return t; } // static uint64_t timeu() { // // if (simulated) { // // timeofday += 1000; // // return timeofday; // // } // return Util::timeu(); // } private: uint64_t realtime; bool tainted; static bool simulated; // static uint64_t timeofday; }; // MaceTime class MaceTimeComparitor { public: bool operator()(const MaceTime& l, const MaceTime& r) const { return l.time() < r.time(); } }; class MaceTimeEquality { public: bool operator()(const MaceTime& l, const MaceTime& r) const { return l.time() == r.time(); } }; class MaceTimeHash { public: size_t operator()(const MaceTime& x) const { return x.hashOf(); } }; template<> class KeyTraits<MaceTime> : public KeyTraits<unsigned long long> { public: static void append(std::string& str, const MaceTime& key) { char buf[30]; sprintf(buf, "%llu", key.time()); str += buf; } static bool isDeterministic() { return !MaceTime::simulated; } static MaceTime extract(std::istream& in) throw(SerializationException) { std::string token = SerializationUtil::get(in, '<'); return strtoull(token.c_str(), NULL, 10); } }; }; // mace namespace __gnu_cxx { template<> struct hash<mace::MaceTime> { size_t operator()(const mace::MaceTime& x) const { return x.hashOf(); } }; } #endif // _MACE_TIME_H |
|
From: James W. A. <j_w...@us...> - 2006-05-03 23:33:36
|
Update of /cvsroot/tsyncd/src/mace/services/Transport In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14449 Added Files: TcpTransport-init.h UdpTransport-init.h Log Message: missing files --- NEW FILE: TcpTransport-init.h --- #ifndef TcpTransport_init_h #define TcpTransport_init_h #include "TcpTransport.h" namespace TcpTransport_namespace { RouteServiceClass& new_TcpTransport_Route( TransportCrypto::type cryptoFlags = TransportCrypto::NONE, bool upcallMessageErrors = false, size_t queueSize = UINT_MAX, size_t threshold = UINT_MAX, MaceAddr addr = SockUtil::NULL_MACEADDR, int bl = SOMAXCONN); BufferedRouteServiceClass& new_TcpTransport_BufferedRoute( TransportCrypto::type cryptoFlags = TransportCrypto::NONE, bool upcallMessageErrors = false, size_t queueSize = UINT_MAX, size_t threshold = UINT_MAX, MaceAddr addr = SockUtil::NULL_MACEADDR, int bl = SOMAXCONN); } #endif --- NEW FILE: UdpTransport-init.h --- #ifndef UdpTransport_init_h #define UdpTransport_init_h namespace UdpTransport_namespace { RouteServiceClass& new_UdpTransport_Route(); } #endif |
|
From: James W. A. <j_w...@us...> - 2006-05-03 23:26:04
|
Update of /cvsroot/tsyncd/src/mace In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11001 Added Files: extradefaults.mk Log Message: missing makefile --- NEW FILE: extradefaults.mk --- include $(MACEPATH)/extradefaults-gen.mk GEN_EXTRADEFAULTS=$(MACEPATH)/perl5/gen-extradefaults.pl $(APPS) : % : %.$(DEFAULT_VERSION) ln -sfv $< $@ $(MACEPATH)/extradefaults-gen.mk : $(MACEPATH)/Makefile.vars $(GEN_EXTRADEFAULTS) @$(GEN_EXTRADEFAULTS) $(COMPILE_VERSIONS) > $@ |
|
From: James W. A. <j_w...@us...> - 2006-05-03 23:25:32
|
Update of /cvsroot/tsyncd/src/mace/perl5/Mace/Compiler In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10883/Mace/Compiler Added Files: Makefile Log Message: missing makefile --- NEW FILE: Makefile --- MACEPATH=../../.. PARSERS=MaceHeaderRecDescent.pm MaceRecDescent.pm ClassParserRecDescent.pm .PHONY: .cvsignore all: $(PARSERS) include $(MACEPATH)/Makefile.vars ifneq (clean,$(MAKECMDGOALS)) ifneq (cleaner,$(MAKECMDGOALS)) include $(PERLMAKE) endif endif MaceHeaderRecDescent.pm: $(Mace_Compiler_MHGrammar_dep) MaceRecDescent.pm: $(Mace_Compiler_MaceGrammar_dep) ClassParserRecDescent.pm: $(Mace_Compiler_ClassGrammar_dep) $(PARSERS): $(compilergen_dep) $(compilergen) $@ cleaner: clean clean: rm -f $(PARSERS) svnignore: .cvsignore if [ -f .cvsignore ]; then svn propset svn:ignore -F .cvsignore .; fi .cvsignore: rm -f .cvsignore for i in .cvsignore $(PARSERS); do echo $$i >> $@; done |
|
From: James W. A. <j_w...@us...> - 2006-05-03 23:24:45
|
Update of /cvsroot/tsyncd/src/mace/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10525 Added Files: MaceBasics.h Log Message: missing files --- NEW FILE: MaceBasics.h --- #ifndef MACE_BASICS_H #define MACE_BASICS_H /** * NOTICE: This file shall ONLY be used for things which have to do with * simple constants and types. Including this file MUST NOT require * inclusion of any STL or other mace headers. */ #include <stdint.h> #include <sys/types.h> namespace mace { const int8_t UNDEFINED_ADDRESS = 0; const int8_t IPV4 = 1; const int8_t NUM_ADDRESSES = 2; const int8_t SHA160 = 2; const int8_t SHA32 = 3; } typedef int channel_id_t; typedef int registration_uid_t; using mace::UNDEFINED_ADDRESS; using mace::IPV4; using mace::SHA160; using mace::SHA32; #endif |
|
From: James W. A. <j_w...@us...> - 2006-05-03 23:24:17
|
Update of /cvsroot/tsyncd/src/mace/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10351 Added Files: LogIdSet.h StrUtilNamespace.h mlist.h Log Message: missing files --- NEW FILE: StrUtilNamespace.h --- #ifndef STR_UTIL_NAMESPACE_H #define STR_UTIL_NAMESPACE_H #include <deque> #include <string> namespace StrUtilNamespace { typedef std::deque<std::string> StdStringList; StdStringList getTypeFromTemplate(const std::string& fn, const char* typeVar[]); } #endif --- NEW FILE: LogIdSet.h --- #ifndef LOGIDSET_H #define LOGIDSET_H #include "Log.h" class LogIdSet { public: const log_id_t log; const log_id_t warn; const log_id_t error; const log_id_t debug; const log_id_t compiler; LogIdSet() : log(Log::NULL_ID), warn(Log::NULL_ID), error(Log::NULL_ID), debug(Log::NULL_ID), compiler(Log::NULL_ID) {} LogIdSet(const std::string& base) : log(Log::getId(base)), warn(Log::getId("WARNING::" + base)), error(Log::getId("ERROR::" + base)), debug(Log::getId("DEBUG::" + base)), compiler(Log::getId("COMPILER::" + base)) { } // void setLogIds(const std::string& base) { // log = Log::getId(base); // warn = Log::getId("WARNING::" + base); // error = Log::getId("ERROR::" + base); // debug = Log::getId("DEBUG::" + base); // compiler = Log::getId("COMPILER::" + base); // } }; #endif --- NEW FILE: mlist.h --- /* * mlist.h : part of the Mace toolkit for building distributed systems * * Copyright (c) 2005, Charles Killian, Dejan Kostic, Ryan Braud, James W. Anderson, John Fisher-Ogden, Calvin Hubble, Duy Nguyen, Justin Burke, Amin Vahdat, Adolfo Rodriguez, Sooraj Bhat * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * Neither the names of Duke University nor The University of * California, San Diego, nor the names of the authors or contributors * may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ----END-OF-LEGAL-STUFF---- */ #include <list> #include <iostream> #include "Serializable.h" #include "XmlRpcCollection.h" #include "StrUtil.h" #include "mace_constants.h" #ifndef _MACE_LIST_H #define _MACE_LIST_H namespace mace { template<class T, class Alloc = std::allocator<T> > class list : public std::list<T, Alloc>, public Serializable, public PrintPrintable { public: typedef typename std::list<T, Alloc> baseType; typedef typename baseType::iterator iterator; typedef typename baseType::const_iterator const_iterator; typedef typename baseType::size_type size_type; list() : baseType() { } list(size_type n) : baseType(n) { } list(size_type n, const T& t) : baseType(n, t) { } list(const std::list<T, Alloc>& v) : baseType(v) { } virtual ~list() { } int deserialize(std::istream& in) throw(SerializationException) { size_type sz; int bytes = sizeof(sz); mace::deserialize(in, &sz, sz); this->resize(sz); for(iterator i=this->begin(); i!=this->end(); i++) { bytes += mace::deserialize(in, &(*i), (*i)); } return bytes; } int deserializeXML_RPC(std::istream& in) throw(SerializationException) { return XmlRpcArrayDeserialize<list<T, Alloc>, T>(in, *this); } void serialize(std::string& str) const { size_type sz = this->size(); //SerializableTraits<uint32_t>::serialize(str, sz); mace::serialize(str, &sz, sz); for(const_iterator i=this->begin(); i!=this->end(); i++) { //SerializableTraits<T>::serialize(str, *i); mace::serialize(str, &(*i), *i); } } void serializeXML_RPC(std::string& str) const throw(SerializationException) { XmlRpcArraySerialize(str, this->begin(), this->end()); } const std::string& getTypeName() const { const char* types[] = { "T", "Alloc", 0 }; static const StrUtilNamespace::StdStringList myTypes = StrUtilNamespace::getTypeFromTemplate(__PRETTY_FUNCTION__, types); return myTypes[0]; } void print(std::ostream& out) const { if(mace::PRINT_TYPE_NAMES) { out << "list<"<< this->getTypeName() <<">"; } printList(out, this->begin(), this->end()); } void printState(std::ostream& out) const { if(mace::PRINT_TYPE_NAMES) { out << "list<"<<this->getTypeName() <<">"; } printListState(out, this->begin(), this->end()); } }; } #endif // _MACE_LIST_H |
|
From: James W. A. <j_w...@us...> - 2006-05-03 23:23:04
|
Update of /cvsroot/tsyncd/src/mace In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9776 Added Files: commondirs.mk Log Message: missing file --- NEW FILE: commondirs.mk --- .PHONY: $(DIRS) cvsignore svnignore CLEANDIRS=$(addprefix clean_,$(DIRS)) CLEANERDIRS=$(addprefix cleaner_,$(DIRS)) SLASHDIRS=$(addsuffix /,$(DIRS)) dirs : $(DIRS) cleandirs : $(CLEANDIRS) cleanerdirs : $(CLEANERDIRS) ifeq (,$(findstring wipe,$(MAKECMDGOALS))) $(DIRS) : @$(MAKE) DIR=$@ -C $@ $(DIRRULE) $(CLEANDIRS) : clean_% : @$(MAKE) DIR=$* -C $* clean $(CLEANERDIRS) : cleaner_% : @$(MAKE) DIR=$* -C $* cleaner else wipe : $(DIRS) : @$(MAKE) DIR=$@ -C $@ clean endif svnignore : .cvsignore for i in $(DIRS); do $(MAKE) DIR=$$i -C $$i svnignore; done if [ -f .cvsignore ]; then svn propset svn:ignore -F .cvsignore .; fi $(SLASHDIRS) : %/ : % |
|
From: James W. A. <j_w...@us...> - 2006-05-03 23:21:56
|
Update of /cvsroot/tsyncd/src/mace/services/RanSub In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9062/services/RanSub Modified Files: RanSub.m RanSubAggregator.m Log Message: update to latest version of mace Index: RanSub.m =================================================================== RCS file: /cvsroot/tsyncd/src/mace/services/RanSub/RanSub.m,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** RanSub.m 25 Jan 2006 03:48:17 -0000 1.3 --- RanSub.m 3 May 2006 23:21:19 -0000 1.4 *************** *** 47,53 **** using mace::hash_set; provides Gossip; ! trace=low; constants { --- 47,56 ---- using mace::hash_set; + service RanSub; + provides Gossip; ! trace=med; ! // trace=low; constants { *************** *** 119,123 **** } // init API init ! scheduler (state == joined) expire(timer printer) { // maceLog("Have state for:\n"); // for(int i = 0; i < curset.number_candidates; i++) { --- 122,126 ---- } // init API init ! scheduler (state == joined) printer() { // maceLog("Have state for:\n"); // for(int i = 0; i < curset.number_candidates; i++) { *************** *** 204,208 **** } ! maceLog("In distributeAggregateData channel %d numHandlers %d\n", channelId, lastDistribute[channelId].size()); ChildDistributeMap tosend; --- 207,211 ---- } ! maceLog("In distributeAggregateData channel %d numHandlers %zu\n", channelId, lastDistribute[channelId].size()); ChildDistributeMap tosend; *************** *** 216,220 **** } ! maceLog("number of kids %d\n", child_map.size()); for(AggregateNodeBlobMap::iterator iter = child_map.begin(); iter != child_map.end(); iter++) { --- 219,223 ---- } ! maceLog("number of kids %zu\n", child_map.size()); for(AggregateNodeBlobMap::iterator iter = child_map.begin(); iter != child_map.end(); iter++) { *************** *** 250,259 **** } ! downcall publishGossip(channel_id_t channelId, const mace::string& data, registration_uid_t rid) { downcall_aggregateSubscribe(channelId, ag_); currentGossip[channelId][rid] = data; ! maceLog("publishing gossip for channel %d of size %d for " "registration id %d\n", channelId, data.size(), rid); } --- 253,262 ---- } ! downcall (true) publishGossip(channel_id_t channelId, const mace::string& data, registration_uid_t rid) { downcall_aggregateSubscribe(channelId, ag_); currentGossip[channelId][rid] = data; ! maceLog("publishing gossip for channel %d of size %zu for " "registration id %d\n", channelId, data.size(), rid); } Index: RanSubAggregator.m =================================================================== RCS file: /cvsroot/tsyncd/src/mace/services/RanSub/RanSubAggregator.m,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** RanSubAggregator.m 25 Jan 2006 03:48:17 -0000 1.3 --- RanSubAggregator.m 3 May 2006 23:21:19 -0000 1.4 *************** *** 54,58 **** // trace=med; ! trace=low; constructor_parameters { --- 54,58 ---- // trace=med; ! trace=med; constructor_parameters { *************** *** 119,123 **** implements { upcalls { ! deliver(const MaceKey&, const MaceKey&, const Message& <- const std::string&, comm_type_t); } } --- 119,123 ---- implements { upcalls { ! deliver(const MaceKey&, const MaceKey&, const Message& <- const std::string&); } } *************** *** 125,148 **** messages { ! collectMsg [downcall_route(const MaceKey&, const Message&, registration_uid_t regId = route_); ] { //Note: This message is keyed for the Aggregation Service, not the Gossip Service int sequence; int descendants; //To be used only for total count. HandlerHandlerDataMap handlerCollects; } ! distributeMsg [downcall_route(const MaceKey&, const Message&, registration_uid_t regId = route_); ] { //Note: This message is keyed for the Aggregation Service, not the Gossip Service int sequence; int population; //To be used only for total count. HandlerHandlerDataMap handlerDistributes; } - // PRIORITY_HIGHEST collect { - // int sequence; - // int descendants; - // candidate_set<monitor_data> summary_map; - // } - // PRIORITY_HIGHEST distribute { - // int sequence; - // int population; - // candidate_set<monitor_data> summary_map; - // } } --- 125,138 ---- messages { ! collectMsg { //Note: This message is keyed for the Aggregation Service, not the Gossip Service int sequence; int descendants; //To be used only for total count. HandlerHandlerDataMap handlerCollects; } ! distributeMsg { //Note: This message is keyed for the Aggregation Service, not the Gossip Service int sequence; int population; //To be used only for total count. HandlerHandlerDataMap handlerDistributes; } } *************** *** 179,189 **** if (downcall_isJoinedOverlay()) { state_change(joined); ! timer_resched(printer, PRINTER_INTERVAL); if (downcall_isRoot(RANSUB_MESSAGE_GROUP, tree_)) { ! Log::logf("ransub_aggregator", "Hey! I'm root!\n"); ! timer_resched(collect, DELAYED_START); } else { ! Log::logf("ransub_aggregator", "I'm not root!\n"); } me = downcall_getLocalAddress(tree_); --- 169,179 ---- if (downcall_isJoinedOverlay()) { state_change(joined); ! printer.reschedule(PRINTER_INTERVAL); if (downcall_isRoot(RANSUB_MESSAGE_GROUP, tree_)) { ! maceout << "Hey! I'm root!" << Log::endl; ! collect.reschedule(DELAYED_START); } else { ! maceout << "I'm not root!" << Log::endl; } me = downcall_getLocalAddress(tree_); *************** *** 217,225 **** if(status == 0/*success*/) { state_change(joined); ! timer_resched(printer, PRINTER_INTERVAL); if (downcall_isRoot(RANSUB_MESSAGE_GROUP, tree_)) { Log::logf("ransub_aggregator", "Hey! I'm root!\n"); ! timer_resched(collect, DELAYED_START); } else { Log::logf("ransub_aggregator", "I'm not root!\n"); --- 207,215 ---- if(status == 0/*success*/) { state_change(joined); ! printer.reschedule(PRINTER_INTERVAL); if (downcall_isRoot(RANSUB_MESSAGE_GROUP, tree_)) { Log::logf("ransub_aggregator", "Hey! I'm root!\n"); ! collect.reschedule(DELAYED_START); } else { Log::logf("ransub_aggregator", "I'm not root!\n"); *************** *** 237,241 **** } ! scheduler (state == joined) expire(timer printer) { // Log::logf("ransub_aggregator", "Have state for:\n"); // for(int i = 0; i < curset.number_candidates; i++) { --- 227,231 ---- } ! scheduler (state == joined) printer() { // Log::logf("ransub_aggregator", "Have state for:\n"); // for(int i = 0; i < curset.number_candidates; i++) { *************** *** 244,248 **** } // joined timer printer ! scheduler (state == joined) expire(timer collect) { // This code times out collect, for failure detection if (collect_missing) { --- 234,238 ---- } // joined timer printer ! scheduler (state == joined) collect() { // This code times out collect, for failure detection if (collect_missing) { *************** *** 279,293 **** send_distribute(); ! // timer_resched(collect, AGGREGATION_INTERVAL); } //TODO: Which timer setting do we want? Root only, or all nodes? Should nodes adjust timer period based on height? ! timer_resched(collect, AGGREGATION_INTERVAL); } // joined timer ransub upcall (state == joined) deliver(const MaceKey& source, const MaceKey& destination, ! const distributeMsg& msg, ! comm_type_t communicationType) { #ifdef PIP_MESSAGING ANNOTATE_START_TASK(selector.c_str(), 0, "recv distribute"); --- 269,282 ---- send_distribute(); ! // collect.reschedule(AGGREGATION_INTERVAL); } //TODO: Which timer setting do we want? Root only, or all nodes? Should nodes adjust timer period based on height? ! collect.reschedule(AGGREGATION_INTERVAL); } // joined timer ransub upcall (state == joined) deliver(const MaceKey& source, const MaceKey& destination, ! const distributeMsg& msg) { #ifdef PIP_MESSAGING ANNOTATE_START_TASK(selector.c_str(), 0, "recv distribute"); *************** *** 330,335 **** upcall (state == joined) deliver(const MaceKey& source, const MaceKey& destination, ! const collectMsg& msg, ! comm_type_t communicationType) { #ifdef PIP_MESSAGING ANNOTATE_NOTICE(selector.c_str(), 1, "RanSub: got coll seq %d(%d desc.) from %x", msg.sequence, msg.descendants, source.getMaceAddr().local.addr); --- 319,323 ---- upcall (state == joined) deliver(const MaceKey& source, const MaceKey& destination, ! const collectMsg& msg) { #ifdef PIP_MESSAGING ANNOTATE_NOTICE(selector.c_str(), 1, "RanSub: got coll seq %d(%d desc.) from %x", msg.sequence, msg.descendants, source.getMaceAddr().local.addr); *************** *** 483,487 **** #endif // foreach_neighbor(neighbor_ransub_children *, kid, mychildren) {} ! maceLog("Checking %d kids\n", lastCollect.size()); for(CollectMap::iterator i = lastCollect.begin(); i != lastCollect.end(); i++) { maceout << "Kid " << i->first << " seq " << i->second.sequence --- 471,475 ---- #endif // foreach_neighbor(neighbor_ransub_children *, kid, mychildren) {} ! maceLog("Checking %zu kids\n", lastCollect.size()); for(CollectMap::iterator i = lastCollect.begin(); i != lastCollect.end(); i++) { maceout << "Kid " << i->first << " seq " << i->second.sequence *************** *** 540,544 **** // HandlerHandlerDataMap collectData = HandlerHandlerDataMap(); //iterate over handler ids ! maceLog("collectData.size() %d\n", collectData.size()); for(SubscriptionMap::iterator handlerIter = handlers_and_channels.begin(); handlerIter != handlers_and_channels.end(); handlerIter++) { --- 528,532 ---- // HandlerHandlerDataMap collectData = HandlerHandlerDataMap(); //iterate over handler ids ! maceLog("collectData.size() %zu\n", collectData.size()); for(SubscriptionMap::iterator handlerIter = handlers_and_channels.begin(); handlerIter != handlers_and_channels.end(); handlerIter++) { *************** *** 603,607 **** getExistingChannels(handlers_and_channels); ! maceLog("In send_distribute num_handlers %d\n", handlers_and_channels.size()); //iterate over handlerIds --- 591,596 ---- getExistingChannels(handlers_and_channels); ! maceLog("In send_distribute num_handlers %zu\n", ! handlers_and_channels.size()); //iterate over handlerIds *************** *** 609,613 **** handlerIter != handlers_and_channels.end(); handlerIter++) { //iterate over children ! maceLog("num_children %d\n", lastCollect.size()); for(CollectMap::iterator childIter = lastCollect.begin(); childIter != lastCollect.end(); childIter++) { --- 598,602 ---- handlerIter != handlers_and_channels.end(); handlerIter++) { //iterate over children ! maceLog("num_children %zu\n", lastCollect.size()); for(CollectMap::iterator childIter = lastCollect.begin(); childIter != lastCollect.end(); childIter++) { *************** *** 621,625 **** //iterate over channelIds (on lastDistribute.channels) //TODO: Double check -- should this be an iterator over the handler_and_channels? ! maceLog("num_channels %d for handler %d\n", handlerIter->second.size(), handlerIter->first); for(ChannelSet::iterator channelIter = handlerIter->second.begin(); --- 610,614 ---- //iterate over channelIds (on lastDistribute.channels) //TODO: Double check -- should this be an iterator over the handler_and_channels? ! maceLog("num_channels %zu for handler %d\n", handlerIter->second.size(), handlerIter->first); for(ChannelSet::iterator channelIter = handlerIter->second.begin(); *************** *** 657,661 **** //NOTE: On the root, the data it returned in "collect" is what it'll use as input for distribute. maceLog("Calling upcall_distribute channel %d " ! "registration id %d data size %d\n", *channelIter, handlerIter->first, distribute_data.size()); // dump_hex(distribute_data.data(), distribute_data.size()); --- 646,650 ---- //NOTE: On the root, the data it returned in "collect" is what it'll use as input for distribute. maceLog("Calling upcall_distribute channel %d " ! "registration id %d data size %zu\n", *channelIter, handlerIter->first, distribute_data.size()); // dump_hex(distribute_data.data(), distribute_data.size()); |
Update of /cvsroot/tsyncd/src/mace/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9062/lib Modified Files: Accumulator.cc Accumulator.h CircularQueueList.h Exception.h FIFOLinkedList.h FileUtil.cc HashUtil.h KeyRange.h LRUCache.h LoadMonitor.cc Log.cc Log.h LogSelector.cc LogSelector.h MaceKey.cc MaceKey.h MaceTypes.h Makefile NodeCollection.h NumberGen.h Params.cc Params.h PipedSignal.h Printable.cc Printable.h RandomUtil.cc RandomUtil.h Scheduler.cc Scheduler.h ScopedLock.h ScopedLog.h SockUtil.cc StrUtil.cc StrUtil.h SysUtil.cc SysUtil.h ThreadCreate.cc ThreadCreate.h ThreadPool.h Traits.h Util.cc Util.h m_map.h mace-macros.h mace.cc mace.h mace_constants.h marray.h mdeque.h mhash_map.h mhash_set.h mmultimap.h mpair.h mset.h msparse_array.h mstring.h mvector.h Removed Files: Crypto.h TransportError.h tcp_auto_ext.h Log Message: update to latest version of mace Index: Traits.h =================================================================== RCS file: /cvsroot/tsyncd/src/mace/lib/Traits.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Traits.h 30 Aug 2005 00:39:41 -0000 1.1 --- Traits.h 3 May 2006 23:21:18 -0000 1.2 *************** *** 42,45 **** --- 42,46 ---- class string; + class MaceTime; template<class T> *************** *** 52,55 **** --- 53,59 ---- return false; } + static bool isDeterministic() { + return true; + } static void append(std::string& str, const T& key) { } *************** *** 68,71 **** --- 72,78 ---- return false; } + static bool isDeterministic() { + return true; + } static void append(std::string& str, const std::string& key) { str.append(key); *************** *** 89,92 **** --- 96,102 ---- return true; } + static bool isDeterministic() { + return true; + } static void append(std::string& str, const long long& key) { char buf[30]; Index: mace_constants.h =================================================================== RCS file: /cvsroot/tsyncd/src/mace/lib/mace_constants.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** mace_constants.h 30 Aug 2005 00:39:41 -0000 1.1 --- mace_constants.h 3 May 2006 23:21:18 -0000 1.2 *************** *** 31,74 **** * * ----END-OF-LEGAL-STUFF---- */ ! #include "Params.h" ! #include "Scheduler.h" #ifndef mace_constants_h #define mace_constants_h ! // Defines standard types of neighbors ! #define NBR_TYPE_PARENT 1 ! #define NBR_TYPE_CHILDREN 2 ! #define NBR_TYPE_PEER 3 ! #define NBR_TYPE_TREE 4 ! // Defines communication semantics ! typedef int comm_type_t; ! const comm_type_t COMM_TYPE_UNICAST=1; ! const comm_type_t COMM_TYPE_MULTICAST=2; ! const comm_type_t COMM_TYPE_ANYCAST=3; ! const comm_type_t COMM_TYPE_COLLECT=4; ! const comm_type_t COMM_TYPE_DISTRIBUTE=5; ! typedef int join_status_t; ! const join_status_t JOIN_ACCEPTED = 0; ! const join_status_t JOIN_UNREACHABLE = 1; ! const join_status_t JOIN_UNAUTHORIZED = 2; ! const join_status_t JOIN_UNJOINED = 3; ! // Defines transport priority (0 - 10) ! #define PRIORITY_HIGHEST 10 ! #define PRIORITY_HIGH 8 ! #define PRIORITY_MED 6 ! #define PRIORITY_LOW 4 ! #define PRIORITY_BEST_EFFORT 0 ! // Definitions of status codes passed into status_changed ! #define STATUS_READY 0 ! #define STATUS_UNREADY 1 ! // Defines standard error codes ! #define ERROR_NEIGHBOR_FAILURE 10 ! #define ERROR_JOIN 11 #endif --- 31,66 ---- * * ----END-OF-LEGAL-STUFF---- */ ! // #include "Params.h" ! // // #include "Scheduler.h" #ifndef mace_constants_h #define mace_constants_h ! namespace mace { ! const bool PRINT_TYPE_NAMES = false; ! } ! // // Defines standard types of neighbors ! // #define NBR_TYPE_PARENT 1 ! // #define NBR_TYPE_CHILDREN 2 ! // #define NBR_TYPE_PEER 3 ! // #define NBR_TYPE_TREE 4 ! // // Defines communication semantics ! // // Defines transport priority (0 - 10) ! // #define PRIORITY_HIGHEST 10 ! // #define PRIORITY_HIGH 8 ! // #define PRIORITY_MED 6 ! // #define PRIORITY_LOW 4 ! // #define PRIORITY_BEST_EFFORT 0 ! // // Definitions of status codes passed into status_changed ! // #define STATUS_READY 0 ! // #define STATUS_UNREADY 1 ! // // Defines standard error codes ! // #define ERROR_NEIGHBOR_FAILURE 10 ! // #define ERROR_JOIN 11 #endif Index: Params.cc =================================================================== RCS file: /cvsroot/tsyncd/src/mace/lib/Params.cc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Params.cc 25 Jan 2006 03:48:16 -0000 1.2 --- Params.cc 3 May 2006 23:21:18 -0000 1.3 *************** *** 38,41 **** --- 38,44 ---- #include <string.h> #include <stdlib.h> + #include <sys/types.h> + #include <sys/stat.h> + #include <unistd.h> using namespace std; *************** *** 57,60 **** --- 60,64 ---- const string Params::MACE_LOG_APPEND = "MACE_LOG_APPEND"; const string Params::MACE_LOAD_MONITOR_FREQUENCY_MS = "MACE_LOAD_MONITOR_FREQUENCY_MS"; + const string Params::MACE_SWAP_MONITOR_FREQUENCY_MS = "MACE_SWAP_MONITOR_FREQUENCY_MS"; int param::getint() { *************** *** 121,124 **** --- 125,138 ---- } + void Params::setAppend(const string& key, const string& value) { + param* found = find(key); + if (found) { + found->append(value); + } + else { + set(key, value); + } + } // setAppend + void Params::addRequired(const string& name, const string& desc) { required[name] = desc; *************** *** 139,153 **** } // verifyRequired ! int Params::loadparams(int argc, char** argv) { int startarg = 1; if(argc==1 || argv[1][0] == '-') { ! printf("REPLAY PARAMETER FILE: params.default\n"); ! fflush(stdout); loadfile("params.default"); } else if (argc > 1) { startarg = 2; ! printf("REPLAY PARAMETER FILE: %s\n",argv[1]); ! fflush(stdout); ! loadfile(argv[1]); } else { --- 153,179 ---- } // verifyRequired ! int Params::loadparams(int& argc, char**& argv, bool requireFile) { ! // printf("loading params, argc=%d\n", argc); ! // for (int i = 0; i < argc; i++) { ! // printf("%s ", argv[i]); ! // } ! // printf("\n"); ! int startarg = 1; if(argc==1 || argv[1][0] == '-') { ! // printf("REPLAY PARAMETER FILE: params.default\n"); loadfile("params.default"); } else if (argc > 1) { startarg = 2; ! // printf("REPLAY PARAMETER FILE: %s\n",argv[1]); ! struct stat sbuf; ! if (stat(argv[1], &sbuf) == 0) { ! loadfile(argv[1]); ! argv[1] = 0; ! } ! else if (requireFile) { ! std::cerr << "could not open params file " << argv[1] << std::endl; ! exit(-1); ! } } else { *************** *** 156,169 **** for(int i = startarg; i<argc; i++) { char* arg = *(argv+i); - //printf("arg:%s\n",arg); if(arg[0] != '-' || strlen(arg) < 2) continue; arg++; ! if(arg[0] == '-') arg++; ! printf("Node REPLAY_PARM: %s %s\n",argv[i],argv[i+1]); //NOTE: For now assuming no '=' if(i <= argc-1) { set(arg,argv[i+1]); } else { set(arg, ""); --- 182,200 ---- for(int i = startarg; i<argc; i++) { + if (!argv[i]) { + continue; + } char* arg = *(argv+i); if(arg[0] != '-' || strlen(arg) < 2) continue; arg++; ! if(arg[0] == '-') { arg++; ! } ! // printf("Node REPLAY_PARM: %s %s\n",argv[i],argv[i+1]); //NOTE: For now assuming no '=' if(i <= argc-1) { set(arg,argv[i+1]); + argv[i] = 0; + argv[i+1] = 0; } else { set(arg, ""); *************** *** 171,174 **** --- 202,225 ---- } + int found = 0; + for (int i = 1; i < argc; i++) { + if (!argv[i]) { + found++; + for (int j = i + 1; j < argc; j++) { + if (argv[j]) { + argv[i] = argv[j]; + break; + } + } + } + } + argc -= found; + + // printf("done loading params, argc=%d\n", argc); + // for (int i = 0; i < argc; i++) { + // printf("%s ", argv[i]); + // } + // printf("\n"); + verifyRequired(); return 0; *************** *** 239,243 **** } ! set(key, value); } f.close(); --- 290,294 ---- } ! setAppend(key, value); } f.close(); Index: Printable.h =================================================================== RCS file: /cvsroot/tsyncd/src/mace/lib/Printable.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Printable.h 25 Jan 2006 03:48:16 -0000 1.4 --- Printable.h 3 May 2006 23:21:18 -0000 1.5 *************** *** 31,40 **** * * ----END-OF-LEGAL-STUFF---- */ #include <string> #include <sstream> #include <iomanip> ! #ifndef __PRINTABLE_H ! #define __PRINTABLE_H namespace mace { --- 31,45 ---- * * ----END-OF-LEGAL-STUFF---- */ + #ifndef __PRINTABLE_H + #define __PRINTABLE_H + #include <string> #include <sstream> #include <iomanip> + #include <ctype.h> + #include <boost/shared_ptr.hpp> ! #include "hash_string.h" ! #include "Base64.h" namespace mace { *************** *** 43,47 **** public: virtual std::string toString() const = 0; ! virtual void print(std::ostream& printer) const =0; virtual ~Printable() {} }; --- 48,54 ---- public: virtual std::string toString() const = 0; ! virtual std::string toStateString() const = 0; ! virtual void print(std::ostream& printer) const = 0; ! virtual void printState(std::ostream& printer) const = 0; virtual ~Printable() {} }; *************** *** 54,57 **** --- 61,72 ---- return out.str(); } + std::string toStateString() const { + std::ostringstream out; + printState(out); + return out.str(); + } + virtual void printState(std::ostream& printer) const { + print(printer); + } virtual ~PrintPrintable() {} }; *************** *** 59,65 **** class ToStringPrintable : virtual public Printable { public: ! virtual void print(std::ostream& printer) const { printer << toString(); } virtual ~ToStringPrintable() {} }; --- 74,86 ---- class ToStringPrintable : virtual public Printable { public: ! void print(std::ostream& printer) const { printer << toString(); } + void printState(std::ostream& printer) const { + printer << toStateString(); + } + virtual std::string toStateString() const { + return toString(); + } virtual ~ToStringPrintable() {} }; *************** *** 71,75 **** void printItem(std::ostream& out, const void* pitem, const S& item) { // out << "[NON-PRINTABLE: address=" << std::hex << (int)pitem << " size=" << sizeof(S) << /*" typeid=" << typeid(S) << " hex=" << toHex(std::string((const char*)pitem, sizeof(S))) << */ "]"; ! out << "[NON-PRINTABLE: ptr=" << std::hex << pitem << " func=" << __PRETTY_FUNCTION__ << "]" << std::dec; } --- 92,99 ---- void printItem(std::ostream& out, const void* pitem, const S& item) { // out << "[NON-PRINTABLE: address=" << std::hex << (int)pitem << " size=" << sizeof(S) << /*" typeid=" << typeid(S) << " hex=" << toHex(std::string((const char*)pitem, sizeof(S))) << */ "]"; ! std::ios::fmtflags f(out.flags()); ! out << std::hex; ! out << "[NON-PRINTABLE: ptr=" << pitem << " func=" << __PRETTY_FUNCTION__ << "]"; ! out.flags(f); } *************** *** 96,99 **** --- 120,131 ---- template<typename S> void printItem(std::ostream& out, const char* pitem, const S& item) { + out << (int)item; + if(isprint(item)) { + out << " '" << item << "'"; + } + } + + template<typename S> + void printItem(std::ostream& out, const uint8_t* pitem, const S& item) { out << item; } *************** *** 121,124 **** --- 153,170 ---- template<typename S> void printItem(std::ostream& out, const std::string* pitem, const S& item) { + if (Base64::isPrintable(item)) { + out << item; + } else { + static const hash_string hasher = hash_string(); + //if(longStrings) { + // out << Log::toHex(item); + //} else { + out << hasher(item); + //} + } + } + + template<typename S> + void printItem(std::ostream& out, const char** pitem, const S& item) { out << item; } *************** *** 129,132 **** --- 175,191 ---- } + template<typename S> + void printItem(std::ostream& out, const Printable** pitem, const S& item) { + // warning --- if pitem is an array, then only the first element will get printed + item->print(out); + } + + template<typename S> + void printItem(std::ostream& out, const boost::shared_ptr<S>* pitem, const boost::shared_ptr<S>& item) { + out << "shared_ptr("; + mace::printItem(out, item.get(), *item); + out << ")"; + } + template<typename S> std::string mapToString(const S& m, bool newlines = false) { *************** *** 146,149 **** --- 205,210 ---- template<typename S> void printMap(std::ostream& os, const S& b, const S& e, bool newlines = false) { + os << "["; + if(newlines) { os << std::endl; } else { os << " "; } for (S i = b; i != e; i++) { os << "( "; *************** *** 159,163 **** } } ! } // listToString template<typename S> --- 220,251 ---- } } ! os << "]"; ! if (newlines) { ! os << std::endl; ! } ! } ! ! template<typename S> ! void printMapState(std::ostream& os, const S& b, const S& e, bool newlines = false) { ! os << "["; ! if(newlines) { os << std::endl; } else { os << " "; } ! for (S i = b; i != e; i++) { ! os << "( "; ! printState(os, &(i->first), i->first); ! os << " -> "; ! printState(os, &(i->second), i->second); ! os << " )"; ! if (newlines) { ! os << std::endl; ! } ! else { ! os << " "; ! } ! } ! os << "]"; ! if (newlines) { ! os << std::endl; ! } ! } template<typename S> *************** *** 193,196 **** --- 281,286 ---- template<typename S> void printList(std::ostream& os, const S& b, const S& e, bool newlines = false) { + os << "["; + if(newlines) { os << std::endl; } else { os << " "; } for (S i = b; i != e; i++) { printItem(os, &(*i), *i); *************** *** 202,205 **** --- 292,299 ---- } } + os << "]"; + if (newlines) { + os << std::endl; + } } // listToString *************** *** 226,229 **** --- 320,359 ---- } + template<typename S> + void printState(std::ostream& out, const void* pitem, const S& item) { + mace::printItem(out, &item, item); + } + + template<typename S> + void printState(std::ostream& out, const Printable* pitem, const S& item) { + item.printState(out); + } + + template<typename S> + void printState(std::ostream& out, const boost::shared_ptr<S>* pitem, const boost::shared_ptr<S>& item) { + out << "shared_ptr("; + mace::printState(out, item.get(), *item); + out << ")"; + } + + template<typename S> + void printListState(std::ostream& os, const S& b, const S& e, bool newlines = false) { + os << "["; + if(newlines) { os << std::endl; } else { os << " "; } + for (S i = b; i != e; i++) { + printState(os, &(*i), *i); + if (newlines) { + os << std::endl; + } + else { + os << " "; + } + } + os << "]"; + if (newlines) { + os << std::endl; + } + } + } // namespace mace --- TransportError.h DELETED --- Index: Makefile =================================================================== RCS file: /cvsroot/tsyncd/src/mace/lib/Makefile,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Makefile 1 Sep 2005 21:33:24 -0000 1.2 --- Makefile 3 May 2006 23:21:18 -0000 1.3 *************** *** 1,11 **** ! .PHONY: library include ../Makefile.vars ! library: libmace.a ! #remove -shared when not compiling .so library. ! #CXXFLAGS= -I../ -g -shared -pthread -D_REENTRANT -D_THREAD_SAFE -D_PTHREAD -O2 -D__USE_UNIX98 -D_GNU_SOURCE #-DTRANSPORT_MASSIVE_TRACE #-D_SOLARIS -O2 ! CXXFLAGS= $(GLOBAL_FLAGS) -I../ -D_REENTRANT -D_THREAD_SAFE -D_PTHREAD -D__USE_UNIX98 -D_GNU_SOURCE -Wall -Werror -pthread ifeq "$(MACE_EXTRAS_SHA1)" "1" --- 1,12 ---- ! .PHONY: library .cvsignore + MACEPATH=../ include ../Makefile.vars ! LIBNAME=mace ! all: library ! ! CXXFLAGS= $(GLOBAL_FLAGS) -I../ -D_REENTRANT -D_THREAD_SAFE -D_PTHREAD -D__USE_UNIX98 -D_GNU_SOURCE -pthread ifeq "$(MACE_EXTRAS_SHA1)" "1" *************** *** 17,28 **** endif CSRCS = $(wildcard *.c) ! OBJS = $(SRCS:.cc=.o) $(CSRCS:.c=.o) - ifeq "$(MAKECMDGOALS)" "clean" - else %.d: %.cc ! @set -e; rm -f $@; $(CXX) -MM $(CXXFLAGS) $< > $@.$$$$; sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; rm -f $@.$$$$ %.d: %.c ! @set -e; rm -f $@; $(CC) -MM $(CXXFLAGS) $< > $@.$$$$; sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; rm -f $@.$$$$ ifeq "$(SRCS)" "" else --- 18,31 ---- endif CSRCS = $(wildcard *.c) ! BASE_OBJS = $(SRCS:.cc=.o) $(CSRCS:.c=.o) %.d: %.cc ! $(DEPENDCCRULE) %.d: %.c ! $(DEPENDCRULE) ! ifeq "$(MAKECMDGOALS)" "clean" ! else ! ifeq "$(MAKECMDGOALS)" "cleaner" ! else ifeq "$(SRCS)" "" else *************** *** 30,41 **** endif endif ! libmace.a: $(OBJS) ! ar rc libmace.a $(OBJS) ! libmace.so: $(OBJS) ! ld -G $(OBJS) -o libmace.so clean: ! rm -f *.o *.d ! rm -f libmace.a --- 33,57 ---- endif endif + endif ! include $(MACEPATH)/extradefaults.mk ! #libmace.so: $(OBJS) ! # ld -G $(OBJS) -o libmace.so clean: ! @echo "Removing dependency files" ! @rm -f *.d *.d.* ! @echo "Removing object and library files of compile type $(TYPES)" ! @rm -f $(ALL_OBJS) $(ALL_LIBS) ! cleaner: ! @echo "Removing all dependency files, and object and library files of compile type $(COMPILE_VERSIONS)" ! @rm -f *.d *.d.* $(CLEAN_OBJS) $(CLEAN_LIBS) ! ! svnignore: .cvsignore ! if [ -f .cvsignore ]; then svn propset svn:ignore -F .cvsignore .; fi ! .cvsignore: ! rm -f .cvsignore ! for i in .cvsignore $(CLEAN_LIBS); do echo $$i >> $@; done ! ! library: $(ALL_LIBS) --- Crypto.h DELETED --- Index: Exception.h =================================================================== RCS file: /cvsroot/tsyncd/src/mace/lib/Exception.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Exception.h 20 Sep 2005 03:03:05 -0000 1.2 --- Exception.h 3 May 2006 23:21:18 -0000 1.3 *************** *** 45,49 **** --- 45,51 ---- virtual const char* what() const throw() { return message.c_str(); } virtual void print(std::ostream& o) const { o << message; } + virtual void printState(std::ostream& o) const { print(o); } virtual std::string toString() const { return message; } + virtual std::string toStateString() const { return toString(); } virtual void rethrow() const { throw *this; } Index: m_map.h =================================================================== RCS file: /cvsroot/tsyncd/src/mace/lib/m_map.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** m_map.h 30 Aug 2005 00:39:41 -0000 1.1 --- m_map.h 3 May 2006 23:21:18 -0000 1.2 *************** *** 35,38 **** --- 35,40 ---- #include "Serializable.h" #include "RandomUtil.h" + #include "mace_constants.h" + #include "StrUtilNamespace.h" #ifndef _MACE_MAP_H *************** *** 70,74 **** return i->second; } ! assert(0); // return defaultValue; } // get --- 72,76 ---- return i->second; } ! ASSERT(0); // return defaultValue; } // get *************** *** 108,115 **** } void print(std::ostream& out) const { ! out << "mace::Map{ "; mace::printMap(out, this->begin(), this->end()); ! out << " }"; } --- 110,131 ---- } + const std::string& getTypeName() const { + const char* types[] = { "Key", "Data", "Compare", "Alloc", 0 }; + static const StrUtilNamespace::StdStringList myTypes = StrUtilNamespace::getTypeFromTemplate(__PRETTY_FUNCTION__, types); + static string ret = myTypes[0]+"->"+myTypes[1]; + return ret; + } + void print(std::ostream& out) const { ! if(mace::PRINT_TYPE_NAMES) { ! out << "mace::Map<" << getTypeName() << ">"; ! } mace::printMap(out, this->begin(), this->end()); ! } ! void printState(std::ostream& out) const { ! if(mace::PRINT_TYPE_NAMES) { ! out << "mace::Map<" << getTypeName() << ">"; ! } ! mace::printMapState(out, this->begin(), this->end()); } Index: mace.cc =================================================================== RCS file: /cvsroot/tsyncd/src/mace/lib/mace.cc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** mace.cc 20 Sep 2005 03:03:05 -0000 1.2 --- mace.cc 3 May 2006 23:21:18 -0000 1.3 *************** *** 46,49 **** --- 46,50 ---- int BaseMaceService::locked_for_writing; pthread_t BaseMaceService::lock_owner = (pthread_t)0; + bool BaseMaceService::_printLower = false; BaseMaceService::BaseMaceService() *************** *** 63,66 **** --- 64,69 ---- // } + + #ifndef __CYGWIN__ if(sysconf(_SC_THREADS)==-1){ *************** *** 68,71 **** --- 71,75 ---- exit(69); } + #endif time_booted= Util::timeu(); Index: NodeCollection.h =================================================================== RCS file: /cvsroot/tsyncd/src/mace/lib/NodeCollection.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** NodeCollection.h 25 Jan 2006 03:48:16 -0000 1.3 --- NodeCollection.h 3 May 2006 23:21:18 -0000 1.4 *************** *** 43,46 **** --- 43,48 ---- #include "MaceTypes.h" #include "RandomUtil.h" + #include "StrUtil.h" + #include "Traits.h" #ifndef _NEIGHBOR_SET_H *************** *** 81,84 **** --- 83,88 ---- using mapType::end; using mapType::find; + using mapType::lower_bound; + using mapType::upper_bound; inline size_t maxSize() const { *************** *** 97,100 **** --- 101,107 ---- return myNodeSet.contains(who); } + bool containsKey(const MaceKey& who) const { + return this->contains(who); + } using mapType::size; *************** *** 124,128 **** } else if (i == end()) { ! assert(false); } else { --- 131,135 ---- } else if (i == end()) { ! assert(false && size() < MaxSize); } else { *************** *** 138,142 **** } else if (i == end()) { ! assert(false); } else { --- 145,149 ---- } else if (i == end()) { ! assert(false && size() < MaxSize); // die } else { *************** *** 196,199 **** --- 203,209 ---- template<typename ScoreType> NodeType& leastScore(ScoreType (NodeType::*sc)(void) const = &NodeType::getScore) { + if(!mace::KeyTraits<ScoreType>::isDeterministic()) { + return random(); + } ScoreType bestScore = ScoreType(); NodeType *best_entry = NULL; *************** *** 218,223 **** --- 228,339 ---- } + template<typename ScoreType, typename Compare> + NodeType& leastScore(const Compare& c, ScoreType (NodeType::*sc)(void) const = &NodeType::getScore) { + if(!mace::KeyTraits<ScoreType>::isDeterministic()) { + return random(); + } + ScoreType bestScore = ScoreType(); + NodeType *best_entry = NULL; + assert(!empty()); + bestScore = (begin()->second.*sc)(); + best_entry = &(begin()->second); + // printf("In leastScore\n"); + // fflush(NULL); + for(iterator i=begin(); i!=end(); i++) { + // printf("Considering %.8x %f\n", i->first, (i->second.*sc)()); + // fflush(NULL); + if (c((i->second.*sc)(),bestScore)) { + // printf("picking better score!\n"); + // fflush(NULL); + bestScore = (i->second.*sc)(); + best_entry = &(i->second); + } + } + // printf("returning %x\n", best_entry); + // fflush(NULL); + return *best_entry; + } + + template<typename ScoreType> + const NodeType& leastScore(ScoreType (NodeType::*sc)(void) const = &NodeType::getScore) const { + if(!mace::KeyTraits<ScoreType>::isDeterministic()) { + return random(); + } + ScoreType bestScore = ScoreType(); + const NodeType *best_entry = NULL; + assert(!empty()); + bestScore = (begin()->second.*sc)(); + best_entry = &(begin()->second); + // printf("In leastScore\n"); + // fflush(NULL); + for(const_iterator i=begin(); i!=end(); i++) { + // printf("Considering %.8x %f\n", i->first, (i->second.*sc)()); + // fflush(NULL); + if ((i->second.*sc)() < bestScore) { + // printf("picking better score!\n"); + // fflush(NULL); + bestScore = (i->second.*sc)(); + best_entry = &(i->second); + } + } + // printf("returning %x\n", best_entry); + // fflush(NULL); + return *best_entry; + } + + template<typename ScoreType, typename Compare> + const NodeType& leastScore(const Compare& c, ScoreType (NodeType::*sc)(void) const = &NodeType::getScore) const { + if(!mace::KeyTraits<ScoreType>::isDeterministic()) { + return random(); + } + ScoreType bestScore = ScoreType(); + const NodeType *best_entry = NULL; + assert(!empty()); + bestScore = (begin()->second.*sc)(); + best_entry = &(begin()->second); + // printf("In leastScore\n"); + // fflush(NULL); + for(const_iterator i=begin(); i!=end(); i++) { + // printf("Considering %.8x %f\n", i->first, (i->second.*sc)()); + // fflush(NULL); + if (c((i->second.*sc)(), bestScore)) { + // printf("picking better score!\n"); + // fflush(NULL); + bestScore = (i->second.*sc)(); + best_entry = &(i->second); + } + } + // printf("returning %x\n", best_entry); + // fflush(NULL); + return *best_entry; + } + template<typename ScoreType> NodeType& greatestScore(ScoreType (NodeType::*sc)(void) const = &NodeType::getScore) { + if(!mace::KeyTraits<ScoreType>::isDeterministic()) { + return random(); + } + ScoreType worstScore = ScoreType(); + NodeType *worst_entry = NULL; + + assert(!empty()); + worstScore = (begin()->second.*sc)(); + worst_entry = &(begin()->second); + + for(iterator i=begin(); i!=end(); i++) { + if ((i->second.*sc)() > worstScore) + { + worstScore = (i->second.*sc)(); + worst_entry = &(i->second); + } + } + return *worst_entry; + } + + template<typename ScoreType, typename Compare> + NodeType& greatestScore(const Compare& c, ScoreType (NodeType::*sc)(void) const = &NodeType::getScore) { + if(!mace::KeyTraits<ScoreType>::isDeterministic()) { + return random(); + } ScoreType worstScore = ScoreType(); NodeType *worst_entry = NULL; *************** *** 228,231 **** --- 344,369 ---- for(iterator i=begin(); i!=end(); i++) { + if (c(worstScore, (i->second.*sc)())) + { + worstScore = (i->second.*sc)(); + worst_entry = &(i->second); + } + } + return *worst_entry; + } + + template<typename ScoreType> + const NodeType& greatestScore(ScoreType (NodeType::*sc)(void) const = &NodeType::getScore) const { + if(!mace::KeyTraits<ScoreType>::isDeterministic()) { + return random(); + } + ScoreType worstScore = ScoreType(); + const NodeType *worst_entry = NULL; + + assert(!empty()); + worstScore = (begin()->second.*sc)(); + worst_entry = &(begin()->second); + + for(const_iterator i=begin(); i!=end(); i++) { if ((i->second.*sc)() > worstScore) { *************** *** 237,240 **** --- 375,400 ---- } + template<typename ScoreType, typename Compare> + const NodeType& greatestScore(const Compare& c, ScoreType (NodeType::*sc)(void) const = &NodeType::getScore) const { + if(!mace::KeyTraits<ScoreType>::isDeterministic()) { + return random(); + } + ScoreType worstScore = ScoreType(); + const NodeType *worst_entry = NULL; + + assert(!empty()); + worstScore = (begin()->second.*sc)(); + worst_entry = &(begin()->second); + + for(const_iterator i=begin(); i!=end(); i++) { + if (c(worstScore, (i->second.*sc)())) + { + worstScore = (i->second.*sc)(); + worst_entry = &(i->second); + } + } + return *worst_entry; + } + NodeType& random() { assert(!empty()); *************** *** 347,355 **** } void print(std::ostream& out) const { ! out << "NodeCollection<" << "???"/*typeid(NodeType)*/ << "," << MaxSize << "> {"; ! out << " cursize=" << size() << " elements:"; printList(out, setBegin(), setEnd()); ! out << " }"; } --- 507,530 ---- } + const std::string& getTypeName() const { + const char* types[] = { "NodeType", "unsigned int MaxSize", 0 }; + static const StrUtilNamespace::StdStringList myTypes = StrUtilNamespace::getTypeFromTemplate(__PRETTY_FUNCTION__, types); + return myTypes[0]; + } + void print(std::ostream& out) const { ! if(mace::PRINT_TYPE_NAMES) { ! out << "NodeCollection<" << this->getTypeName() << "," << MaxSize << "> ["; ! out << " cursize=" << size() << "]"; ! } printList(out, setBegin(), setEnd()); ! } ! ! void printState(std::ostream& out) const { ! if(mace::PRINT_TYPE_NAMES) { ! out << "NodeCollection<" << this->getTypeName() << "," << MaxSize << "> ["; ! out << " cursize=" << size() << "]"; ! } ! printListState(out, setBegin(), setEnd()); } Index: mstring.h =================================================================== RCS file: /cvsroot/tsyncd/src/mace/lib/mstring.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** mstring.h 25 Jan 2006 03:48:16 -0000 1.2 --- mstring.h 3 May 2006 23:21:18 -0000 1.3 *************** *** 60,63 **** --- 60,64 ---- virtual ~string() { } + int deserialize(std::istream& in) throw(SerializationException){ size_type sz; *************** *** 227,236 **** } // namespace mace ! namespace __gnu_cxx ! { template<> struct hash<mace::string> { size_t operator()(const mace::string& x) const { ! static hash_string h; return h(x); } --- 228,236 ---- } // namespace mace ! namespace __gnu_cxx { template<> struct hash<mace::string> { size_t operator()(const mace::string& x) const { ! static const hash_string h = hash_string(); return h(x); } *************** *** 243,247 **** // }; ! } #endif // _MACE_STRING_H --- 243,249 ---- // }; ! } // namespace __gnu_cxx ! ! std::ostream& operator<<(std::ostream& o, const mace::string& s); #endif // _MACE_STRING_H Index: MaceTypes.h =================================================================== RCS file: /cvsroot/tsyncd/src/mace/lib/MaceTypes.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MaceTypes.h 20 Sep 2005 03:03:05 -0000 1.2 --- MaceTypes.h 3 May 2006 23:21:18 -0000 1.3 *************** *** 34,39 **** #define _MACE_TYPES_H ! #include <stdint.h> ! // #include <string> #include "MaceKey.h" --- 34,38 ---- #define _MACE_TYPES_H ! #include "MaceBasics.h" #include "MaceKey.h" *************** *** 50,60 **** using mace::sha160; using mace::KeyRange; - using mace::UNDEFINED_ADDRESS; - using mace::IPV4; - using mace::SHA160; - using mace::SHA32; - typedef int registration_uid_t; - typedef int channel_id_t; // typedef mace::hash_set<MaceKey> NodeSet; typedef mace::set<MaceKey> NodeSet; --- 49,53 ---- Index: ThreadCreate.cc =================================================================== RCS file: /cvsroot/tsyncd/src/mace/lib/ThreadCreate.cc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ThreadCreate.cc 25 Jan 2006 03:48:16 -0000 1.2 --- ThreadCreate.cc 3 May 2006 23:21:18 -0000 1.3 *************** *** 31,40 **** * * ----END-OF-LEGAL-STUFF---- */ - // #include <sys/types.h> - // #include <linux/unistd.h> // #include <errno.h> #include <sys/types.h> ! #include <linux/unistd.h> #include "ThreadCreate.h" #include "Log.h" --- 31,38 ---- * * ----END-OF-LEGAL-STUFF---- */ // #include <errno.h> #include <sys/types.h> ! #include <unistd.h> #include "ThreadCreate.h" #include "Log.h" *************** *** 42,45 **** --- 40,44 ---- #include "pip_includer.h" #include "Util.h" + #include "Scheduler.h" // _syscall0(pid_t,gettid) *************** *** 52,61 **** pthread_t pp; std::string fname; ! FuncArg(func tf, RunThreadClass* tc, classfunc tcf, void* targ, pthread_t tpp, const char* fname) : f(tf), c(tc), cf(tcf), arg(targ), pp(tpp), fname(fname) {} }; void logThread(pthread_t p, const std::string& fname, bool ending) { // Log::logf("logThread", "%s :: pid = %u :: ppid = %u :: pthread_id = %u :: tid = %u :: parent_pthread_id = %u %s\n", fname.c_str(), getpid(), getppid(), pthread_self(), gettid(), p, ending ? "ending" : "starting"); ! Log::logf("logThread", "%s :: pid = %u :: ppid = %u :: pthread_id = %u :: parent_pthread_id = %u %s\n", fname.c_str(), getpid(), getppid(), pthread_self(), p, ending ? "ending" : "starting"); } --- 51,65 ---- pthread_t pp; std::string fname; ! bool joinThread; ! FuncArg(func tf, RunThreadClass* tc, classfunc tcf, void* targ, ! pthread_t tpp, const char* fname, bool join) : f(tf), c(tc), cf(tcf), ! arg(targ), pp(tpp), ! fname(fname), ! joinThread(join) {} }; void logThread(pthread_t p, const std::string& fname, bool ending) { // Log::logf("logThread", "%s :: pid = %u :: ppid = %u :: pthread_id = %u :: tid = %u :: parent_pthread_id = %u %s\n", fname.c_str(), getpid(), getppid(), pthread_self(), gettid(), p, ending ? "ending" : "starting"); ! Log::logf("logThread", "%s :: pid = %u :: ppid = %u :: pthread_id = %lu :: parent_pthread_id = %lu %s\n", fname.c_str(), getpid(), getppid(), pthread_self(), p, ending ? "ending" : "starting"); } *************** *** 76,86 **** logThread(fa->pp, fa->fname, true); delete fa; ! return NULL; } ! void _runNewThread(pthread_t* t, func f, void* arg, pthread_attr_t* attr, const char* fname) { int ret; ! FuncArg *fa = new FuncArg(f,NULL,NULL,arg,pthread_self(), fname); if((ret = pthread_create(t, attr, threadStart, fa)) != 0) { perror("pthread_create"); --- 80,97 ---- logThread(fa->pp, fa->fname, true); + if (fa->joinThread) { + Scheduler::Instance().joinThread(pthread_self()); + } + delete fa; ! ! return 0; } ! void _runNewThread(pthread_t* t, func f, void* arg, pthread_attr_t* attr, ! const char* fname, bool joinThread) { int ret; ! FuncArg *fa = new FuncArg(f, NULL, NULL, arg, pthread_self(), fname, ! joinThread); if((ret = pthread_create(t, attr, threadStart, fa)) != 0) { perror("pthread_create"); *************** *** 88,96 **** abort(); } } ! void _runNewThreadClass(pthread_t* t, RunThreadClass* c, classfunc f, void* arg, pthread_attr_t* attr, const char* fname) { int ret; ! FuncArg *fa = new FuncArg(NULL,c,f,arg,pthread_self(), fname); if((ret = pthread_create(t, attr, threadStart, fa)) != 0) { perror("pthread_create"); --- 99,113 ---- abort(); } + if (joinThread) { + Scheduler::Instance().shutdownJoinThread(*t); + } } ! void _runNewThreadClass(pthread_t* t, RunThreadClass* c, classfunc f, ! void* arg, pthread_attr_t* attr, const char* fname, ! bool joinThread) { int ret; ! FuncArg *fa = new FuncArg(NULL, c, f, arg, pthread_self(), fname, ! joinThread); if((ret = pthread_create(t, attr, threadStart, fa)) != 0) { perror("pthread_create"); *************** *** 98,100 **** --- 115,120 ---- abort(); } + if (joinThread) { + Scheduler::Instance().shutdownJoinThread(*t); + } } Index: StrUtil.cc =================================================================== RCS file: /cvsroot/tsyncd/src/mace/lib/StrUtil.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** StrUtil.cc 25 Jan 2006 03:48:16 -0000 1.3 --- StrUtil.cc 3 May 2006 23:21:18 -0000 1.4 *************** *** 287,288 **** --- 287,329 ---- } } // spaces + + namespace StrUtilNamespace { + StdStringList getTypeFromTemplate(const std::string& fn, const char* typeVar[]) { + StdStringList ret; + string find = "[with "; + find += typeVar[0]; + find += " = "; + size_t start = std::string::npos; + size_t end = std::string::npos; + + start = fn.find(find); + if(start == std::string::npos) { + ASSERT(0); + } + start = start + 6 + strlen(typeVar[0]) + 3; + + int i = 0; + //iterate over typevar + while(typeVar[i+1] != 0) { + //look for ", $next = " + find = ", " + std::string(typeVar[i+1]) + " = "; + end = fn.find(find); + if(end == std::string::npos) { + ASSERT(0); + } + ret.push_back(fn.substr(start, end-start)); + start = end + 2 + strlen(typeVar[i+1]) + 3; + i++; + } + //else look for "]" + find = "]"; + end = fn.find(find); + if(end == std::string::npos) { + ASSERT(0); + } + ret.push_back(fn.substr(start, end-start)); + + return ret; + } + } + Index: Accumulator.h =================================================================== RCS file: /cvsroot/tsyncd/src/mace/lib/Accumulator.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Accumulator.h 25 Jan 2006 03:48:16 -0000 1.3 --- Accumulator.h 3 May 2006 23:21:18 -0000 1.4 *************** *** 40,51 **** --- 40,60 ---- // #include "SysUtil.h" #include "Util.h" + #include "ScopedLock.h" //NOTE: This could build off of the statistical filter, and compute a wide variety of statistics. class Accumulator { public: + static const std::string NETWORK_READ; + static const std::string NETWORK_READ_SELECTOR; + static const std::string NETWORK_WRITE; + static const std::string NETWORK_WRITE_SELECTOR; static const std::string TCP_READ; static const std::string TCP_READ_SELECTOR; static const std::string TCP_WRITE; static const std::string TCP_WRITE_SELECTOR; + static const std::string UDP_READ; + static const std::string UDP_READ_SELECTOR; + static const std::string UDP_WRITE; + static const std::string UDP_WRITE_SELECTOR; static const std::string HTTP_CLIENT_READ; static const std::string HTTP_CLIENT_READ_SELECTOR; *************** *** 69,73 **** public: static Accumulator* Instance(const std::string& counter) { ! lock(); Accumulator* r = 0; AccumulatorMap::iterator i = instances.find(counter); --- 78,82 ---- public: static Accumulator* Instance(const std::string& counter) { ! ScopedLock sl(alock); Accumulator* r = 0; AccumulatorMap::iterator i = instances.find(counter); *************** *** 80,84 **** r = i->second; } - unlock(); return r; } --- 89,92 ---- *************** *** 92,98 **** void accumulate(uint amount) { ! lock(); accumulateUnlocked(amount); - unlock(); } --- 100,105 ---- void accumulate(uint amount) { ! ScopedLock sl(alock); accumulateUnlocked(amount); } Index: LogSelector.h =================================================================== RCS file: /cvsroot/tsyncd/src/mace/lib/LogSelector.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** LogSelector.h 20 Sep 2005 03:03:05 -0000 1.2 --- LogSelector.h 3 May 2006 23:21:18 -0000 1.3 *************** *** 45,49 **** --- 45,53 ---- enum LogSelectorOutput { LOG_FPRINTF, LOG_PIP }; + class Sim; + class LogSelector { + friend class Sim; + public: LogSelector(const std::string& name, *************** *** 71,76 **** LogSelectorOutput logOutput; ! typedef mace::hash_map<pthread_t, int> ThreadIdMap; static ThreadIdMap threadIds; }; --- 75,81 ---- LogSelectorOutput logOutput; ! typedef mace::hash_map<unsigned long, int> ThreadIdMap; static ThreadIdMap threadIds; + static const std::string* prefix; }; Index: mhash_set.h =================================================================== RCS file: /cvsroot/tsyncd/src/mace/lib/mhash_set.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** mhash_set.h 30 Aug 2005 00:39:41 -0000 1.1 --- mhash_set.h 3 May 2006 23:21:18 -0000 1.2 *************** *** 42,45 **** --- 42,47 ---- #include "XmlRpcCollection.h" #include "RandomUtil.h" + #include "mace_constants.h" + #include "StrUtilNamespace.h" namespace mace { *************** *** 105,112 **** } void print(std::ostream& out) const { ! out << "mace::HashSet{ "; mace::printList(out, this->begin(), this->end()); ! out << " }"; } }; --- 107,127 ---- } + const std::string& getTypeName() const { + const char* types[] = { "Key", "HashFcn", "EqualKey", "Alloc", 0 }; + static const StrUtilNamespace::StdStringList myTypes = StrUtilNamespace::getTypeFromTemplate(__PRETTY_FUNCTION__, types); + return myTypes[0]; + } + void print(std::ostream& out) const { ! if(mace::PRINT_TYPE_NAMES) { ! out << "mace::HashSet<" << getTypeName() << ">"; ! } mace::printList(out, this->begin(), this->end()); ! } ! void printState(std::ostream& out) const { ! if(mace::PRINT_TYPE_NAMES) { ! out << "mace::HashSet<" << getTypeName() << ">"; ! } ! mace::printListState(out, this->begin(), this->end()); } }; Index: RandomUtil.cc =================================================================== RCS file: /cvsroot/tsyncd/src/mace/lib/RandomUtil.cc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RandomUtil.cc 30 Aug 2005 00:39:41 -0000 1.1 --- RandomUtil.cc 3 May 2006 23:21:18 -0000 1.2 *************** *** 33,36 **** --- 33,37 ---- #include <stdlib.h> #include <math.h> + #include <stdio.h> #include "RandomUtil.h" #include "Util.h" *************** *** 62,65 **** --- 63,88 ---- } // randInt + unsigned RandomUtil::randIntImpl(unsigned max, unsigned first, va_list ap) { + va_list copy; + va_copy(copy, ap); + + unsigned newMax = first; + for (size_t i = 0; i < max - 1; i++) { + unsigned t = va_arg(ap, unsigned); + newMax += t; + } + + unsigned rand = randIntImpl(newMax); + unsigned r = 0; + while (r < max - 1 && rand >= first) { + r++; + first += va_arg(copy, unsigned); + } + va_end(copy); + + return r; + } + + RandomUtil* RandomUtil::_inst = NULL; bool RandomUtil::srandInit = false; Index: FIFOLinkedList.h =================================================================== RCS file: /cvsroot/tsyncd/src/mace/lib/FIFOLinkedList.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** FIFOLinkedList.h 25 Jan 2006 03:48:16 -0000 1.1 --- FIFOLinkedList.h 3 May 2006 23:21:18 -0000 1.2 *************** *** 33,37 **** virtual uint64_t size() const { ! return last - first; } // size --- 33,37 ---- virtual uint64_t size() const { ! return 1 + last - first; } // size Index: ThreadPool.h =================================================================== RCS file: /cvsroot/tsyncd/src/mace/lib/ThreadPool.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ThreadPool.h 25 Jan 2006 03:48:16 -0000 1.2 --- ThreadPool.h 3 May 2006 23:21:18 -0000 1.3 *************** *** 92,96 **** runNewThread(&t, ThreadPool::startThread, ta, 0); threads.push_back(t); - Scheduler::Instance().shutdownJoinThread(threads[i]); } assert(threadCount == threads.size()); --- 92,95 ---- Index: Params.h =================================================================== RCS file: /cvsroot/tsyncd/src/mace/lib/Params.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Params.h 25 Jan 2006 03:48:16 -0000 1.3 --- Params.h 3 May 2006 23:21:18 -0000 1.4 *************** *** 52,64 **** public: ! param(std::string value) : strvalue(value), intvalue(0), doublevalue(0) { } param() : intvalue(0), doublevalue(0) { } ~param() { } ! const char* set(std::string value) { const char* old = strvalue.c_str(); delete intvalue; intvalue=0; delete doublevalue; doublevalue=0; strvalue = value; return old; } int getint(); double getdouble(); const char* getstr() { return strvalue.c_str(); } const std::string& getStr() { return strvalue; } // int print(FILE* ostream); }; --- 52,68 ---- public: ! param(const std::string& value) : strvalue(value), intvalue(0), doublevalue(0) { } param() : intvalue(0), doublevalue(0) { } ~param() { } ! const char* set(const std::string& value) { const char* old = strvalue.c_str(); delete intvalue; intvalue=0; delete doublevalue; doublevalue=0; strvalue = value; return old; } int getint(); double getdouble(); const char* getstr() { return strvalue.c_str(); } const std::string& getStr() { return strvalue; } + void append(const std::string& value) { + strvalue.append("\n"); + strvalue.append(value); + } // int print(FILE* ostream); }; *************** *** 84,87 **** --- 88,92 ---- static const std::string MACE_LOG_APPEND; static const std::string MACE_LOAD_MONITOR_FREQUENCY_MS; + static const std::string MACE_SWAP_MONITOR_FREQUENCY_MS; public: *************** *** 93,96 **** --- 98,102 ---- //returns the old value of the param. const char* set(const std::string& key, const std::string& value); + void setAppend(const std::string& key, const std::string& value); template <typename T> *************** *** 105,108 **** --- 111,125 ---- } + template <typename T> + T get(const std::string& key, const T& def) { + param* p = find(key); + if (p != NULL) { + return boost::lexical_cast<T>(p->getStr()); + } + else { + return def; + } + } + /** * Loads the parameters as though from the command line. Follows this method: *************** *** 113,117 **** * 5 - Returns the number of parameters set. */ ! int loadparams(int argc, char** argv); /** --- 130,134 ---- * 5 - Returns the number of parameters set. */ ! int loadparams(int& argc, char**& argv, bool requireFile = false); /** Index: mmultimap.h =================================================================== RCS file: /cvsroot/tsyncd/src/mace/lib/mmultimap.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** mmultimap.h 30 Aug 2005 00:39:41 -0000 1.1 --- mmultimap.h 3 May 2006 23:21:18 -0000 1.2 *************** *** 37,40 **** --- 37,42 ---- #include "Serializable.h" #include "RandomUtil.h" + #include "mace_constants.h" + #include "StrUtil.h" #ifndef _MACE_MULTIMAP_H *************** *** 120,127 **** } void print(std::ostream& out) const { ! out << "mace::MultiMap{ "; mace::printMap(out, this->begin(), this->end()); ! out << " }"; } --- 122,143 ---- } + const std::string& getTypeName() const { + const char* types[] = { "Key", "Data", "Compare", "Alloc", 0 }; + static const StrUtilNamespace::StdStringList myTypes = StrUtilNamespace::getTypeFromTemplate(__PRETTY_FUNCTION__, types); + static string ret = myTypes[0]+"->"+myTypes[1]; + return ret; + } + void print(std::ostream& out) const { ! if(mace::PRINT_TYPE_NAMES) { ! out << "mace::MultiMap<" << getTypeName() << ">"; ! } mace::printMap(out, this->begin(), this->end()); ! } ! void printState(std::ostream& out) const { ! if(mace::PRINT_TYPE_NAMES) { ! out << "mace::MultiMap<" << getTypeName() << ">"; ! } ! mace::printMapState(out, this->begin(), this->end()); } Index: SysUtil.h =================================================================== RCS file: /cvsroot/tsyncd/src/mace/lib/SysUtil.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SysUtil.h 30 Aug 2005 00:39:41 -0000 1.1 --- SysUtil.h 3 May 2006 23:21:18 -0000 1.2 *************** *** 46,59 **** #define SYS_UTIL_H class SysUtil { public: static int select(int max = 0, fd_set* rfs = 0, fd_set* wfs = 0, fd_set* efs = 0, struct timeval* timeout = 0); static sighandler_t signal(int signum, sighandler_t handler, bool warn = true); ! static void sleep(time_t sec = 0, suseconds_t usec = 0); static void sleepu(uint64_t usec); ! static void sleepm(suseconds_t msec) { sleep(0, msec * 1000); } }; // SysUtil --- 46,63 ---- #define SYS_UTIL_H + // sighandler_t is a GNU extension, define here for Cygwin + typedef void (*sighandler_t)(int); + class SysUtil { public: static int select(int max = 0, fd_set* rfs = 0, fd_set* wfs = 0, fd_set* efs = 0, struct timeval* timeout = 0); + static int select(int max, fd_set* rfs, fd_set* wfs, fd_set* efs, uint64_t timeout); static sighandler_t signal(int signum, sighandler_t handler, bool warn = true); ! static void sleep(time_t sec = 0, useconds_t usec = 0); static void sleepu(uint64_t usec); ! static void sleepm(useconds_t msec) { sleep(0, msec * 1000); } }; // SysUtil Index: MaceKey.h =================================================================== RCS file: /cvsroot/tsyncd/src/mace/lib/MaceKey.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** MaceKey.h 25 Jan 2006 03:48:16 -0000 1.3 --- MaceKey.h 3 May 2006 23:21:18 -0000 1.4 *************** *** 122,125 **** --- 122,126 ---- #include "HashUtil.h" #include "Log.h" + #include "MaceBasics.h" #ifndef __MACEKEY_H *************** *** 239,248 **** namespace mace { - const int8_t UNDEFINED_ADDRESS = 0; - const int8_t IPV4 = 1; - const int8_t NUM_ADDRESSES = 2; - const int8_t SHA160 = 2; - const int8_t SHA32 = 3; - class InvalidMaceKeyException : public SerializationException { public: --- 240,243 ---- *************** *** 397,401 **** } ! MaceKey() : helper(), address_family() {} virtual ~MaceKey() { #ifndef MACE_KEY_USE_SHARED_PTR --- 392,396 ---- } ! MaceKey() : helper(HelperPtr()), address_family(UNDEFINED_ADDRESS) {} virtual ~MaceKey() { #ifndef MACE_KEY_USE_SHARED_PTR *************** *** 656,662 **** bool isNullAddress() const { return null; } void printHex(std::ostream& out) const { for(int i=0; i<SIZE; i++) { ! out << std::setw(sizeof(uint)*2) << std::setfill('0') << std::hex << data[i]; } } std::string toHex() const { --- 651,660 ---- bool isNullAddress() const { return null; } void printHex(std::ostream& out) const { + std::ios::fmtflags f(out.flags()); + out << std::hex << std::setfill('0'); for(int i=0; i<SIZE; i++) { ! out << std::setw(sizeof(uint)*2) << data[i]; } + out.flags(f); } std::string toHex() const { *************** *** 704,713 **** exceptDivides32(digitBits); if(null) { return 0; } ! int common = 0; ! uint myBitLength = bitLength(); ! uint hisBitLength = key.bitLength(); ! for(uint myDigit = getNthDigitSafe(common, digitBits), hisDigit = key.getNthDigitSafe(common, digitBits); ! myDigit == hisDigit && myBitLength > 0 && hisBitLength > 0; ! common++, myDigit = getNthDigitSafe(common, digitBits), hisDigit = key.getNthDigitSafe(common, digitBits), myBitLength -= digitBits, hisBitLength -= digitBits) {} return common; } --- 702,712 ---- exceptDivides32(digitBits); if(null) { return 0; } ! int common; ! unsigned myBitLength, hisBitLength; ! for(common = 0, myBitLength = this->bitLength(), hisBitLength = key.bitLength(); ! myBitLength > 0 && hisBitLength > 0 && ! getNthDigitSafe(common, digitBits) == key.getNthDigitSafe(common, digitBits); ! common++, myBitLength -= digitBits, hisBitLength -= digitBits ! ); return common; } Index: LogSelector.cc =================================================================== RCS file: /cvsroot/tsyncd/src/mace/lib/LogSelector.cc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** LogSelector.cc 20 Sep 2005 03:03:05 -0000 1.2 --- LogSelector.cc 3 May 2006 23:21:18 -0000 1.3 *************** *** 41,44 **** --- 41,45 ---- LogSelector::ThreadIdMap LogSelector::threadIds; + const std::string* LogSelector::prefix = NULL; LogSelector::LogSelector(const string& n, *************** *** 65,69 **** string LogSelector::getSelectorHeader() const { // static int count = 0; ! string r = ""; if (logTimestamp != LOG_TIMESTAMP_DISABLED) { --- 66,70 ---- string LogSelector::getSelectorHeader() const { // static int count = 0; ! string r = (prefix && (logTimestamp != LOG_TIMESTAMP_DISABLED||logThreadId == LOG_THREADID_ENABLED||logName == LOG_NAME_ENABLED))?*prefix:""; if (logTimestamp != LOG_TIMESTAMP_DISABLED) { *************** *** 87,93 **** } - unsigned int tid = Log::ThreadSpecific::getVtid(); if (logThreadId == LOG_THREADID_ENABLED) { // unsigned int tid = Log::ThreadSpecific::getVid(); // ThreadIdMap::iterator i = threadIds.find(selftid); --- 88,94 ---- } if (logThreadId == LOG_THREADID_ENABLED) { + unsigned int tid = Log::ThreadSpecific::getVtid(); // unsigned int tid = Log::ThreadSpecific::getVid(); // ThreadIdMap::iterator i = threadIds.find(selftid); Index: mset.h =================================================================== RCS file: /cvsroot/tsyncd/src/mace/lib/mset.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** mset.h 30 Aug 2005 00:39:41 -0000 1.1 --- mset.h 3 May 2006 23:21:18 -0000 1.2 *************** *** 38,42 **** #include "XmlRpcCollection.h" #include "RandomUtil.h" ! namespace mace { --- 38,43 ---- #include "XmlRpcCollection.h" #include "RandomUtil.h" ! #include "mace_constants.h" ! #include "StrUtilNamespace.h" namespace mace { *************** *** 55,58 **** --- 56,62 ---- return find(k) != this->end(); } + bool containsKey(const Key& k) const { + return contains(k); + } int deserialize(std::istream& in) throw(SerializationException) { *************** *** 101,108 **** } void print(std::ostream& out) const { ! out << "mace::Set{ "; mace::printList(out, this->begin(), this->end()); ! out << " }"; } }; --- 105,125 ---- } + const std::string& getTypeName() const { + const char* types[] = { "Key", "LessFcn", "Alloc", 0 }; + static const StrUtilNamespace::StdStringList myTypes = StrUtilNamespace::getTypeFromTemplate(__PRETTY_FUNCTION__, types); + return myTypes[0]; + } + void print(std::ostream& out) const { ! if(mace::PRINT_TYPE_NAMES) { ! out << "mace::Set<" << getTypeName() << ">"; ! } mace::printList(out, this->begin(), this->end()); ! } ! void printState(std::ostream& out) const { ! if(mace::PRINT_TYPE_NAMES) { ! out << "mace::Set<" << getTypeName() << ">"; ! } ! mace::printListState(out, this->begin(), this->end()); } }; Index: ThreadCreate.h =================================================================== RCS file: /cvsroot/tsyncd/src/mace/lib/ThreadCreate.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ThreadCreate.h 20 Sep 2005 03:03:05 -0000 1.2 --- ThreadCreate.h 3 May 2006 23:21:18 -0000 1.3 *************** *** 45,50 **** #define runNewThreadClass(a, cl, b, c, f) _runNewThreadClass(a, cl, b, c, f, #b) ! void _runNewThread(pthread_t* t, func f, void* arg, pthread_attr_t* attr, const char* fname); ! void _runNewThreadClass(pthread_t* t, RunThreadClass* c, classfunc f, void* arg, pthread_attr_t* attr, const char* fname); void logThread(pthread_t pp, const std::string& fname, bool ending = false); --- 45,53 ---- #define runNewThreadClass(a, cl, b, c, f) _runNewThreadClass(a, cl, b, c, f, #b) ! void _runNewThread(pthread_t* t, func f, void* arg, pthread_attr_t* attr, ! const char* fname, bool joinThread = true); ! void _runNewThreadClass(pthread_t* t, RunThreadClass* c, classfunc f, ! void* arg, pthread_attr_t* attr, const char* fname, ! bool joinThread = true); void logThread(pthread_t pp, const std::string& fname, bool ending = false); Index: mdeque.h =================================================================== RCS file: /cvsroot/tsyncd/src/mace/lib/mdeque.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** mdeque.h 30 Aug 2005 00:39:41 -0000 1.1 --- mdeque.h 3 May 2006 23:21:18 -0000 1.2 *************** *** 35,38 **** --- 35,40 ---- #include "XmlRpcCollection.h" #include "Serializable.h" + #include "mace_constants.h" + #include "StrUtilNamespace.h" #ifndef _MACE_DEQUE_H *************** *** 123,130 **** } void print(std::ostream& out) const { ! out << "deque<??? >{"; printList(out, this->begin(), this->end()); ! out << "}"; } }; --- 125,145 ---- } + const std::string& getTypeName() const { + const char* types[] = { "T", "Alloc", 0 }; + static const StrUtilNamespace::StdStringList myTypes = StrUtilNamespace::getTypeFromTemplate(__PRETTY_FUNCTION__, types); + return myTypes[0]; + } + void print(std::ostream& out) const { ! if(mace::PRINT_TYPE_NAMES) { ! out << "deque<"<< this->getTypeName() << ">"; ! } printList(out, this->begin(), this->end()); ! } ! void printState(std::ostream& out) const { ! if(mace::PRINT_TYPE_NAMES) { ! out << "deque<"<< this->getTypeName() << ">"; ! } ! printListState(out, this->begin(), this->end()); } }; Index: Log.cc =================================================================== RCS file: /cvsroot/tsyncd/src/mace/lib/Log.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Log.cc 25 Jan 2006 03:48:16 -0000 1.3 --- Log.cc 3 May 2006 23:21:18 -0000 1.4 *************** *** 33,36 **** --- 33,37 ---- #include "Log.h" #include "StrUtil.h" + #include "Util.h" #include "pip_includer.h" #include "Params.h" *************** *** 348,352 **** if (f == 0) { fprintf(stderr, "could not open log file %s, aborting\n", path.c_str()); ! perror("open"); exit(-1); } --- 349,353 ---- if (f == 0) { fprintf(stderr, "could not open log file %s, aborting\n", path.c_str()); ! ::perror("open"); exit(-1); } *************** *** 495,500 **** FILE* fp = stdout; if (p->containsKey(Params::MACE_LOG_FILE)) { ! string path = p->getStr(Params::MACE_LOG_FILE); ! fp = openLogFile(path, filemode.c_str()); } --- 496,516 ---- FILE* fp = stdout; if (p->containsKey(Params::MACE_LOG_FILE)) { ! StringList s = StrUtil::split("\n", p->getStr(Params::MACE_LOG_FILE)); ! for (StringList::const_iterator i = s.begin(); i != s.end(); i++) { ! StringList l = StrUtil::split(" ", *i); ! if (l.size() == 1) { ! // cerr << "logging auto selectors to " << l[0] << std::endl; ! fp = openLogFile(l[0], filemode.c_str()); ! } ! else { ! string path = l.front(); ! l.pop_front(); ! for (StringList::const_iterator li = l.begin(); li != l.end(); li++) { ! // cerr << "logging " << *li << " to " << path << std::endl; ! logToFile(path, *li, filemode.c_str(), lts); ! } ! } ! } ! } *************** *** 514,517 **** --- 530,537 ---- } // configure + void Log::perror(const char* s) { + err() << s << ": " << Util::getErrorString(errno) << Log::endl; + } // Log::perror + void Log::lock() { assert(pthread_mutex_lock(&llock) == 0); Index: RandomUtil.h =================================================================== RCS file: /cvsroot/tsyncd/src/mace/lib/RandomUtil.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RandomUtil.h 30 Aug 2005 00:39:41 -0000 1.1 --- RandomUtil.h 3 May 2... [truncated message content] |