nitlog: oops, didn't deal properly with posts in months that haven't
[wvapps.git] / wvsync / tests / filelister.cc
blobc8d40064f88af29e87bb24e6364ae4998a117f51
1 #include "wvsyncfilelister.h"
2 #include "wvsyncprotocol.h"
3 #include "wvtcp.h"
4 #include "wvsyncarbiter.h"
5 #include "uniconfroot.h"
6 #include "wvlog.h"
8 void gogo(WvTCPConn *tcp, WvStringParm cfgpath,
9 WvStringParm dirpath, bool server)
11 WvLog log("FileListerTests", WvLog::Info);
12 UniConfRoot cfg(cfgpath);
14 WvSyncArbiter wsa;
16 WvSyncProtocol proto(tcp, &log, wsa, cfg, server);
17 WvSyncFileLister fl(proto, dirpath, cfg);
18 proto.set_lister(&fl);
20 fl.run();
23 int main(int argc, char *argv[])
25 if (argv[1] == WvString("server"))
27 WvTCPListener l(4322);
28 while (true)
30 gogo(l.accept(), argv[2], argv[3], true);
31 return 0;
34 wvcon->print("Good day to you, my dear friend\n");
35 return 0;
37 else
39 WvTCPConn *tcp = new WvTCPConn((WvIPPortAddr)"127.0.0.1:4322");
40 gogo(tcp, argv[2], argv[3], false);
42 return 0;