Oops, my fix to subdir.mk didn't work with existing symlinks. Fixed.
[wvapps.git] / wvsync / wvsynclister.cc
blobadbe5d4fb40dfe709b871a413631b8a59a3f77cd
1 /*
2 * Worldvisions Weaver Software:
3 * Copyright (C) 1997-2004 Net Integration Technologies, Inc.
5 * See wvsynclister.h for details.
7 */
9 #include "wvsynclister.h"
10 #include "wvsyncobj.h"
11 #include "wvsyncprotocol.h"
13 WvSyncLister::WvSyncLister(WvSyncProtocol &_prot)
14 : prot(_prot), log("Lister", WvLog::Debug1), err(log.split(WvLog::Error))
16 donetbl.zap();
20 void WvSyncLister::run()
22 WvSyncObj *newobj = NULL;
24 while (prot.isok())
26 if (prot.want_more() && prot.num_in_flight() < WVSYNC_MAX_IN_FLIGHT)
28 // sync the thing we found before we sent the yourturn
29 WvSyncObj *oldobj = NULL;
30 if (newobj)
31 oldobj = newobj;
33 newobj = next();
35 if (oldobj && isdone(oldobj->name) == false)
36 prot.do_ihave(oldobj);
38 if (newobj)
40 // might not be my turn anymore!
41 if (prot.want_more())
43 if (isdone(newobj->name) == false)
45 prot.do_ihave(newobj);
46 newobj = NULL;
50 else
52 if (prot.want_more())
53 prot.do_yourturn();
55 prot.do_done();
59 if (prot.isreadable())
60 prot.callback();
65 void WvSyncLister::do_chdir(WvStringParm dir)
67 prot.do_chdir(dir);
68 cleardone();
71 void WvSyncLister::markdone(WvStringParm name)
73 donetbl.add(new WvString(name), true);
76 bool WvSyncLister::isdone(WvStringParm name)
78 return donetbl[name];
81 void WvSyncLister::cleardone()
83 donetbl.zap();