More bugfixes ... got the basic channels file transfer working.

* Create channels directory correctly.
 * added File Transfers to Config List.
 * connected statusChange() monitor callback.
 * fixed file sources in transfermodule.
 * fixed up transfer restarts / sleeps.
 * enabled opening files read only.
 * disabled some of the debug.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@799 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2008-11-13 23:03:46 +00:00
parent b0d462c93e
commit fce83cb232
16 changed files with 322 additions and 229 deletions

View file

@ -284,20 +284,6 @@ bool p3Channels::channelSubscribe(std::string cId, bool subscribe)
std::cerr << cId;
std::cerr << std::endl;
if (subscribe)
{
std::string channeldir = mChannelsDir + "/" + cId;
/* create chanDir */
if (!RsDirUtil::checkCreateDirectory(channeldir))
{
std::cerr << "p3Channels::channelSubscribe()";
std::cerr << " Failed to create Channels Directory: ";
std::cerr << channeldir;
std::cerr << std::endl;
}
}
return subscribeToGroup(cId, subscribe);
}
@ -316,6 +302,7 @@ bool p3Channels::locked_eventUpdateGroup(GroupInfo *info, bool isNew)
std::cerr << "p3Channels::locked_eventUpdateGroup() ";
std::cerr << grpId;
std::cerr << " flags:" << info->flags;
std::cerr << std::endl;
if (isNew)
@ -328,6 +315,7 @@ bool p3Channels::locked_eventUpdateGroup(GroupInfo *info, bool isNew)
}
if (info->flags & RS_DISTRIB_SUBSCRIBED)
// || (info->flags & RS_DISTRIB_SUBSCRIBED))
{
std::string channeldir = mChannelsDir + "/" + grpId;
@ -458,6 +446,34 @@ bool p3Channels::locked_eventNewMsg(GroupInfo *grp, RsDistribMsg *msg, std::stri
}
void p3Channels::locked_notifyGroupChanged(GroupInfo &grp)
{
/* create directory if needed */
if (grp.flags & RS_DISTRIB_SUBSCRIBED)
{
std::string channeldir = mChannelsDir + "/" + grp.grpId;
/* create chanDir */
if (!RsDirUtil::checkCreateDirectory(channeldir))
{
std::cerr << "p3Channels::channelSubscribe()";
std::cerr << " Failed to create Channels Directory: ";
std::cerr << channeldir;
std::cerr << std::endl;
}
else
{
std::cerr << "p3Channels::channelSubscribe()";
std::cerr << " Created: ";
std::cerr << channeldir;
std::cerr << std::endl;
}
}
return p3GroupDistrib::locked_notifyGroupChanged(grp);
}
/****************************************/

View file

@ -62,10 +62,12 @@ virtual bool channelSubscribe(std::string cId, bool subscribe);
/****************** Event Feedback (Overloaded form p3distrib) *************************/
/***************************************************************************************/
protected:
virtual bool locked_eventUpdateGroup(GroupInfo *, bool isNew);
virtual bool locked_eventNewMsg(GroupInfo *, RsDistribMsg *, std::string);
virtual bool locked_eventDuplicateMsg(GroupInfo *, RsDistribMsg *, std::string);
/****************************************/
/********* Overloaded Functions *********/
@ -75,6 +77,7 @@ virtual bool locked_checkDistribMsg(RsDistribMsg *msg);
virtual RsDistribGrp *locked_createPublicDistribGrp(GroupInfo &info);
virtual RsDistribGrp *locked_createPrivateDistribGrp(GroupInfo &info);
virtual void locked_notifyGroupChanged(GroupInfo &info);
/****************************************/

View file

@ -1299,16 +1299,7 @@ bool p3GroupDistrib::loadList(std::list<RsItem *> load)
std::string gid = newGrp -> grpId;
loadGroup(newGrp);
/* flag as SUBSCRIBER */
RsStackMutex stack(distribMtx); /******* STACK LOCKED MUTEX ***********/
std::map<std::string, GroupInfo>::iterator it;
it = mGroups.find(gid);
if (it != mGroups.end())
{
it->second.flags |= RS_DISTRIB_SUBSCRIBED;
}
subscribeToGroup(gid, true);
}
else if ((newKey = dynamic_cast<RsDistribGrpKey *>(*lit)))
{

View file

@ -347,6 +347,10 @@ virtual bool locked_choosePublishKey(GroupInfo &info);
//virtual RsDistribGrp *locked_createPublicDistribGrp(GroupInfo &info);
//virtual RsDistribGrp *locked_createPrivateDistribGrp(GroupInfo &info);
protected:
/* root version of this function must be called */
virtual void locked_notifyGroupChanged(GroupInfo &info);
/***************************************************************************************/
/***************************** Utility Functions ***************************************/
/***************************************************************************************/
@ -366,10 +370,6 @@ void printGroups(std::ostream &out);
bool groupsChanged(std::list<std::string> &groupIds);
protected:
void locked_notifyGroupChanged(GroupInfo &info);
/***************************************************************************************/
/***************************************************************************************/