Hi!
I've not give any news since we openened a branch on the SVN, but things
are going well!
First of all peercast is - at least! - in debian:
http://packages.debian.org/peercast
I've splited it in lib, lib-dev, servent and handlers packages so that
it is possible to install
a relay on one host - the gateway for instance - and then use the
handlers in all the other hosts of the LAN..
I've written handlers scripts and protocol support for konqueror/kde,
firefox and gconf, but the firefox stuff
is distro dependant, so it might only work on debian and debian based
even though it is a couple of text files..
On the same idea I've made a package for staticaly built peercast under
the famous openwrt, that allows
peercast to be run on a small wrt54g gateway, and again use handlers on
the LAN!
The autoconf support is ready and functional, the debian package is made
with it. I would like to emphatise the
fact that it is definitly the way to go to work around arch/unixes fix,
as for x86_64 - typedef long long int_64 was wrong,
I've a fix for this in autoconf, even if it could only be commented out
in this case, but there might be others.. -.
Then, I've had some mail talk -
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=334051 - with the gnome
peercast frontend upstream, because its sources include an internal copy
of peercast.. This is not normal
for an app that is supposed to be only an UI, and that was why I
splitted into lib,
and learnt autoconf to do it well.. Hard work then..
But this dev doesn't want to collaborate with I so that I should myself
work on this integration... Sad but true.
There comes my important question: are you aware of the peercast-jp fork
- http://sourceforge.jp/projects/peercast-jp/ ?
In fact gnome peercast is not truly a peercast frontend, because it
includes patches from this project.
As gnome peercast author refuses to answer my questions, I cannot really
appreciate what those patches are doing
and if they are of a deep impact on peercast... I even had to extract
them myself, and I send you the diff for core/common.
Peercast-jp project itself seems to be dead if we look at their last
release, so I still don't understand why gnome-peercast's
author still wants to include them in its so called front-end...
Could tell me your feelings about it and if I should or not include them
in my branch/libraries...?
Also, I'm wondering wether there has been some important changes on
peercast trunk recently,
the logs stop at r300, last august, but revision is 317 or so..
Romain
diff -urN peercast-svn/core/common/channel.cpp gnome-peercast-0.4.1/peercast/core/common/channel.cpp
--- peercast-svn/core/common/channel.cpp 2005-07-04 12:35:56.000000000 +0200
+++ gnome-peercast-0.4.1/peercast/core/common/channel.cpp 2005-09-07 05:05:00.000000000 +0200
@@ -181,6 +181,7 @@
icyMetaInterval = 0;
streamPos = 0;
+ skipCount = 0; //JP-EX
insertMeta.init();
@@ -608,6 +609,17 @@
if (error)
throw StreamException("Handshake error");
+ if (servMgr->autoMaxRelaySetting) //JP-EX
+ {
+ double setMaxRelays = ch->info.bitrate?servMgr->maxBitrateOut/(ch->info.bitrate*1.3):0;
+ if ((unsigned int)setMaxRelays == 0)
+ servMgr->maxRelays = 1;
+ else if ((unsigned int)setMaxRelays > servMgr->autoMaxRelaySetting)
+ servMgr->maxRelays = servMgr->autoMaxRelaySetting;
+ else
+ servMgr->maxRelays = (unsigned int)setMaxRelays;
+ }
+
ch->sourceStream = ch->createSource();
error = ch->readStream(*ch->sock,ch->sourceStream);
@@ -623,6 +635,11 @@
{
ch->setStatus(Channel::S_ERROR);
LOG_ERROR("Channel to %s %s : %s",ipstr,type,e.msg);
+ if (!servMgr->allowConnectPCST) //JP-EX
+ {
+ if (ch->info.srcProtocol == ChanInfo::SP_PEERCAST)
+ ch->thread.active = false;
+ }
if (!ch->sourceHost.tracker || ((error != 503) && ch->sourceHost.tracker))
chanMgr->deadHit(ch->sourceHost);
}
@@ -677,6 +694,7 @@
ch->lastIdleTime = sys->getTime();
ch->setStatus(Channel::S_IDLE);
+ ch->skipCount = 0; //JP-EX
while ((ch->checkIdle()) && (ch->thread.active))
{
sys->sleepIdle();
@@ -873,11 +891,10 @@
int numListeners = totalListeners();
int numRelays = totalRelays();
+ unsigned int oldp = rawData.getOldestPos();
+ unsigned int newp = rawData.getLatestPos();
- unsigned int oldp = rawData.getOldestPos();
- unsigned int newp = rawData.getLatestPos();
-
- hit.initLocal(numListeners,numRelays,info.numSkips,info.getUptime(),isPlaying(),oldp,newp);
+ hit.initLocal(numListeners,numRelays,info.numSkips,info.getUptime(),isPlaying(), oldp, newp);
hit.tracker = true;
atom.writeParent(PCP_BCST,7);
@@ -983,7 +1000,10 @@
if (info.srcProtocol == ChanInfo::SP_PEERCAST)
{
LOG_CHANNEL("Channel is Peercast");
- source = new PeercastStream();
+ if (servMgr->allowConnectPCST) //JP-EX
+ source = new PeercastStream();
+ else
+ throw StreamException("PCST is not allowed");
}
else if (info.srcProtocol == ChanInfo::SP_PCP)
{
@@ -1074,12 +1094,25 @@
ChanHit hit;
- unsigned int oldp = ch->rawData.getOldestPos();
- unsigned int newp = ch->rawData.getLatestPos();
-
- hit.initLocal(numListeners,numRelays,ch->info.numSkips,ch->info.getUptime(),isPlaying,oldp,newp);
+ unsigned int oldp = ch->rawData.getOldestPos();
+ unsigned int newp = ch->rawData.getLatestPos();
+
+ hit.initLocal(numListeners,numRelays,ch->info.numSkips,ch->info.getUptime(),isPlaying, oldp, newp);
hit.tracker = ch->isBroadcasting();
+ if ((numRelays) && ((servMgr->getFirewall() == ServMgr::FW_OFF) && (servMgr->autoRelayKeep!=0))) { //JP-EX
+ ch->stayConnected = true;
+ LOG_DEBUG("Channel Auto keeped");
+ } else
+ LOG_DEBUG("Channel numRelays: %d, FW: %s, autoKeep: %d",
+ numRelays + numListeners, (servMgr->getFirewall() == ServMgr::FW_OFF) ? "OFF" : "ON",
+ servMgr->autoRelayKeep);
+
+ if ((!numRelays && !numListeners) && (servMgr->autoRelayKeep==2)) { //JP-EX
+ ch->stayConnected = false;
+ LOG_DEBUG("Channel Disabled keep");
+ }
+
MemoryStream pmem(pack.data,sizeof(pack.data));
AtomStream atom(pmem);
@@ -1909,7 +1942,16 @@
sprintf(buf,"%s",ChanInfo::getTypeStr(info.contentType));
else if (var == "ext")
sprintf(buf,"%s",ChanInfo::getTypeExt(info.contentType));
-
+ else if (var == "proto") {
+ switch(info.contentType) {
+ case ChanInfo::T_WMA:
+ case ChanInfo::T_WMV:
+ sprintf(buf, "mms://");
+ break;
+ default:
+ sprintf(buf, "http://");
+ }
+ }
else if (var == "localRelays")
sprintf(buf,"%d",localRelays());
else if (var == "localListeners")
@@ -1969,7 +2011,9 @@
if (chl)
numHits = chl->numHits();
sprintf(buf,"%d",numHits);
- }else
+ } else if (var == "isBroadcast")
+ strcpy(buf, (type == T_BROADCAST) ? "1":"0");
+ else
return false;
out.writeString(buf);
@@ -2454,7 +2498,7 @@
type = PlayList::T_ASX;
// WMP seems to have a bug where it doesn`t re-read asx files if they have the same name
// so we prepend the channel id to make it unique - NOTE: should be deleted afterwards.
- sprintf(fname,"%s/%s.asx",peercastApp->getPath(),idStr);
+ sprintf(fname,"%s/%s.asx",peercastApp->getPath(),idStr);
}else if (info.contentType == ChanInfo::T_OGM)
{
type = PlayList::T_RAM;
@@ -2536,12 +2580,12 @@
sessionID.clear();
chanID.clear();
-
- oldestPos = newestPos = 0;
+
+ oldestPos = newestPos = 0;
}
// -----------------------------------
-void ChanHit::initLocal(int numl,int numr,int,int uptm,bool connected,unsigned int oldp,unsigned int newp)
+void ChanHit::initLocal(int numl,int numr,int,int uptm,bool connected, unsigned int oldp, unsigned int newp)
{
init();
firewalled = (servMgr->getFirewall() != ServMgr::FW_OFF);
@@ -2565,10 +2609,9 @@
if (firewalled)
rhost[0].port = 0;
-
- oldestPos = oldp;
- newestPos = newp;
-
+
+ oldestPos = oldp;
+ newestPos = newp;
}
// -----------------------------------
@@ -2598,8 +2641,8 @@
atom.writeInt(PCP_HOST_UPTIME,upTime);
atom.writeInt(PCP_HOST_VERSION,version);
atom.writeChar(PCP_HOST_FLAGS1,fl1);
- atom.writeInt(PCP_HOST_OLDPOS,oldestPos);
- atom.writeInt(PCP_HOST_NEWPOS,newestPos);
+ atom.writeInt(PCP_HOST_OLDPOS,oldestPos);
+ atom.writeInt(PCP_HOST_NEWPOS,newestPos);
}
// -----------------------------------
@@ -2608,7 +2651,32 @@
char buf[1024];
if (var == "rhost0")
- rhost[0].toStr(buf);
+ {
+ if (servMgr->enableGetName) //JP-EX s
+ {
+ char buf2[256];
+ if (firewalled)
{
+ if (numRelays==0)
+ strcpy(buf,"<font color=red>");
+ else
+ strcpy(buf,"<font color=orange>");
+ }
+ else
+ strcpy(buf,"<font color=green>");
+
+ rhost[0].toStr(buf2);
+ strcat(buf,buf2);
+ char h_name[128];
+ if (ClientSocket::getHostname(h_name,rhost[0].ip))
{
+ strcat(buf,"[");
+ strcat(buf,h_name);
+ strcat(buf,"]");
+ }
+ strcat(buf,"</font>");
+ } //JP-EX e
+ else
+ rhost[0].toStr(buf);
+ }
else if (var == "rhost1")
rhost[1].toStr(buf);
else if (var == "numHops")
@@ -3274,6 +3342,12 @@
changed = true;
}
+ if (!desc.isSame(info.desc)) //JP-EX
+ {
+ desc = info.desc;
+ changed = true;
+ }
+
if (!name.isSame(info.name))
{
name = info.name;
diff -urN peercast-svn/core/common/channel.h gnome-peercast-0.4.1/peercast/core/common/channel.h
--- peercast-svn/core/common/channel.h 2005-07-04 12:35:56.000000000 +0200
+++ gnome-peercast-0.4.1/peercast/core/common/channel.h 2005-09-07 05:05:00.000000000 +0200
@@ -176,7 +176,7 @@
{
public:
void init();
- void initLocal(int numl,int numr,int nums,int uptm,bool,unsigned int,unsigned int);
+ void initLocal(int numl,int numr,int nums,int uptm,bool,unsigned int, unsigned int);
XML::Node *createXML();
void writeAtoms(AtomStream &,GnuID &);
@@ -191,7 +191,7 @@
unsigned int hitID;
GnuID sessionID,chanID;
unsigned int version;
- unsigned int oldestPos,newestPos;
+ unsigned int oldestPos,newestPos;
bool firewalled:1,stable:1,tracker:1,recv:1,yp:1,dead:1,direct:1,relay:1,cin:1;
@@ -479,6 +479,7 @@
bool bump,stayConnected;
int icyMetaInterval;
unsigned int streamPos;
+ unsigned int skipCount; //Jp-EX
bool readDelay;
TYPE type;
diff -urN peercast-svn/core/common/gnutella.cpp gnome-peercast-0.4.1/peercast/core/common/gnutella.cpp
--- peercast-svn/core/common/gnutella.cpp 2005-06-22 14:08:59.000000000 +0200
+++ gnome-peercast-0.4.1/peercast/core/common/gnutella.cpp 2005-09-07 05:05:00.000000000 +0200
@@ -86,17 +86,17 @@
len = 14;
id = ping.id;
- MemoryStream data(data,len);
+ MemoryStream mem(data,len);
- data.writeShort(h.port); // port
- data.writeLong(SWAP4(h.ip)); // ip
+ mem.writeShort(h.port); // port
+ mem.writeLong(SWAP4(h.ip)); // ip
if (ownPong)
{
- data.writeLong(chanMgr->numChannels()); // cnt
- data.writeLong(servMgr->totalOutput(false)); // total
+ mem.writeLong(chanMgr->numChannels()); // cnt
+ mem.writeLong(servMgr->totalOutput(false)); // total
}else{
- data.writeLong(0); // cnt
- data.writeLong(0); // total
+ mem.writeLong(0); // cnt
+ mem.writeLong(0); // total
}
diff -urN peercast-svn/core/common/ogg.cpp gnome-peercast-0.4.1/peercast/core/common/ogg.cpp
--- peercast-svn/core/common/ogg.cpp 2004-07-16 09:44:56.000000000 +0200
+++ gnome-peercast-0.4.1/peercast/core/common/ogg.cpp 2005-09-07 05:08:04.000000000 +0200
@@ -16,6 +16,7 @@
// GNU General Public License for more details.
// ------------------------------------------------
+#include "inttypes.h"
#include "channel.h"
#include "ogg.h"
diff -urN peercast-svn/core/common/pcp.cpp gnome-peercast-0.4.1/peercast/core/common/pcp.cpp
--- peercast-svn/core/common/pcp.cpp 2005-07-04 12:35:56.000000000 +0200
+++ gnome-peercast-0.4.1/peercast/core/common/pcp.cpp 2005-09-07 05:05:00.000000000 +0200
@@ -332,8 +332,19 @@
int diff = pack.pos - ch->streamPos;
if (diff)
+ {
LOG_DEBUG("PCP skipping %s%d (%d -> %d)",(diff>0)?"+":"",diff,ch->streamPos,pack.pos);
+ ch->skipCount++; //JP-EX
+ }
+ if (servMgr->autoBumpSkipCount) //JP-EX
+ {
+ if (ch->skipCount > servMgr->autoBumpSkipCount)
+ {
+ LOG_DEBUG("Auto bump");
+ ch->bump = true;
+ }
+ }
if (pack.type == ChanPacket::T_HEAD)
{
@@ -399,10 +410,10 @@
hit.numRelays = atom.readInt();
else if (id == PCP_HOST_UPTIME)
hit.upTime = atom.readInt();
- else if (id == PCP_HOST_OLDPOS)
- hit.oldestPos = atom.readInt();
- else if (id == PCP_HOST_NEWPOS)
- hit.newestPos = atom.readInt();
+ else if (id == PCP_HOST_OLDPOS)
+ hit.oldestPos = atom.readInt();
+ else if (id == PCP_HOST_NEWPOS)
+ hit.newestPos = atom.readInt();
else if (id == PCP_HOST_VERSION)
hit.version = atom.readInt();
else if (id == PCP_HOST_FLAGS1)
diff -urN peercast-svn/core/common/pcp.h gnome-peercast-0.4.1/peercast/core/common/pcp.h
--- peercast-svn/core/common/pcp.h 2005-07-04 12:35:56.000000000 +0200
+++ gnome-peercast-0.4.1/peercast/core/common/pcp.h 2005-09-07 05:05:00.000000000 +0200
@@ -84,8 +84,7 @@
static const ID4 PCP_HOST_FLAGS1 = "flg1";
static const ID4 PCP_HOST_OLDPOS = "oldp";
static const ID4 PCP_HOST_NEWPOS = "newp";
-
-
+
static const ID4 PCP_QUIT = "quit";
static const ID4 PCP_CHAN = "chan";
diff -urN peercast-svn/core/common/peercast.h gnome-peercast-0.4.1/peercast/core/common/peercast.h
--- peercast-svn/core/common/peercast.h 2004-04-09 13:15:22.000000000 +0200
+++ gnome-peercast-0.4.1/peercast/core/common/peercast.h 2005-09-07 05:05:00.000000000 +0200
@@ -65,6 +65,7 @@
public:
virtual const char * APICALL getPath() {return "./";}
+ virtual const char * APICALL getHTMLPath() {return "./";}
virtual const char * APICALL getIniFilename() {return "peercast.ini";}
virtual void APICALL printLog(LogBuffer::TYPE, const char *) {}
virtual void APICALL addChannel(ChanInfo *) {}
diff -urN peercast-svn/core/common/servent.cpp gnome-peercast-0.4.1/peercast/core/common/servent.cpp
--- peercast-svn/core/common/servent.cpp 2005-06-24 11:47:19.000000000 +0200
+++ gnome-peercast-0.4.1/peercast/core/common/servent.cpp 2005-09-07 05:05:00.000000000 +0200
@@ -826,6 +826,16 @@
}
chanReady = canStream(ch);
+ //JP-Patch add-s
+ if (servMgr->isCheckPushStream())
+ {
+ if (chanReady == true)
{
Host h = getHost();
+ if (!h.isLocalhost())
{
do
{
+ if (strstr(agent.cstr(),"PeerCast/0.119") != NULL)
{
char strip[256];
h.toStr(strip);
+ LOG_ERROR("Block v0.119 Servent : %s (%s)",strip,agent.cstr());
chanReady = false;
break;
}
+
+ ChanHitList *chl = chanMgr->hitlist;
while (chl) {
if (! chl->isUsed()) {
chl = chl->next;
continue;
}
ChanHit *hit = chl->hit;
while (hit) {
if (hit->host.isValid() && (h.ip == hit->host.ip) &&
hit->firewalled && hit->numRelays == 0) {
char strip[256];
h.toStr(strip);
+ LOG_ERROR("Block firewalled Servent : %s",strip);
chanReady = false;
break;
}
hit = hit->next;
}
if (chanReady == false)
break;
chl = chl->next;
}
} while (0);
}
}
}
//JP-Patch add-e
}
ChanHitList *chl = chanMgr->findHitList(chanInfo);
@@ -2733,7 +2743,41 @@
else if (var == "status")
strcpy(buf,getStatusStr());
else if (var == "address")
- getHost().toStr(buf);
+ {
+ if (servMgr->enableGetName) //JP-EX s
+ {
+ getHost().toStr(buf);
char h_ip[64];
Host h = getHost();
h.toStr(h_ip);
bool isfw = false;
+ int numRelay = 0;
+ bool ishit = false;
+
+ ChanHitList *chl = chanMgr->hitlist;
+ while (chl) {
+ if (! chl->isUsed()) {
chl = chl->next;
continue;
}
ChanHit *hit = chl->hit;
+ while (hit) {
+ if (hit->host.isValid() && (h.ip == hit->host.ip)) {
if (hit->firewalled)
+ isfw = true;
+ numRelay += hit->numRelays;
+ ishit = true;
+ }
+ hit = hit->next;
+ }
+ chl = chl->next;
+ }
strcpy(buf,"");
+ if (ishit == true)
{
+ if (isfw == true)
{
+ if (numRelay== 0)
strcat(buf,"<font color=red>");
+ else
strcat(buf,"<font color=orange>");
}
else
strcat(buf,"<font color=green>");
+ }
+ strcat(buf,h_ip);
+ char h_name[128];
+ if (ClientSocket::getHostname(h_name,h.ip))
{
+ strcat(buf,"[");
+ strcat(buf,h_name);
strcat(buf,"]");
+ }
+ if (ishit == true)
{
strcat(buf,"</font>");
}
} //JP-EX e
+ else
+ getHost().toStr(buf);
+ }
else if (var == "agent")
strcpy(buf,agent.cstr());
else if (var == "bitrate")
diff -urN peercast-svn/core/common/servent.h gnome-peercast-0.4.1/peercast/core/common/servent.h
--- peercast-svn/core/common/servent.h 2005-06-17 07:16:59.000000000 +0200
+++ gnome-peercast-0.4.1/peercast/core/common/servent.h 2005-09-07 05:05:00.000000000 +0200
@@ -147,6 +147,7 @@
static bool pingHost(Host &,GnuID &);
bool getLocalURL(char *);
+ bool getLocalTypeURL(char *, ChanInfo::TYPE);
// various types of handshaking are needed
void handshakePLS(ChanHitList **, int, bool);
diff -urN peercast-svn/core/common/servhs.cpp gnome-peercast-0.4.1/peercast/core/common/servhs.cpp
--- peercast-svn/core/common/servhs.cpp 2005-06-22 18:16:51.000000000 +0200
+++ gnome-peercast-0.4.1/peercast/core/common/servhs.cpp 2005-09-07 05:05:00.000000000 +0200
@@ -447,7 +447,7 @@
while (sock->readLine(in,128));
- if (getLocalURL(url))
+ if (getLocalTypeURL(url,info.contentType))
{
PlayList::TYPE type;
@@ -522,6 +522,35 @@
}
// -----------------------------------
+bool Servent::getLocalTypeURL(char *str, ChanInfo::TYPE type)
+{
+ if (!sock)
+ throw StreamException("Not connected");
+
+
+ char ipStr[64];
+
+ Host h;
+
+ if (sock->host.localIP())
+ h = sock->getLocalHost();
+ else
+ h = servMgr->serverHost;
+
+ h.port = servMgr->serverHost.port;
+
+ h.toStr(ipStr);
+ switch(type) {
+ case ChanInfo::T_WMA:
+ case ChanInfo::T_WMV:
+ sprintf(str,"mms://%s",ipStr);
+ break;
+ default:
+ sprintf(str,"http://%s",ipStr);
+ }
+ return true;
+}
+// -----------------------------------
// Warning: testing RTSP/RTP stuff below.
// .. moved over to seperate app now.
// -----------------------------------
@@ -638,7 +667,7 @@
void Servent::handshakeCMD(char *cmd)
{
char result[256];
- char arg[512];
+ char arg[1024]; //JP-EX 512->1024
char curr[256];
char jumpStr[128];
@@ -774,6 +803,8 @@
int allowServer1=0;
int allowServer2=0;
int newPort=servMgr->serverHost.port;
+ int enableGetName = 0;
+ int allowConnectPCST = 0;
char *cp = cmd;
while (cp=nextCGIarg(cp,curr,arg))
@@ -916,7 +947,21 @@
allowServer2 |= atoi(arg)?(ALLOW_HTML):0;
else if (strcmp(curr,"allowBroadcast2")==0)
allowServer2 |= atoi(arg)?(ALLOW_BROADCAST):0;
-
+ // JP-EX
+ else if (strcmp(curr, "autoRelayKeep") ==0)
+ servMgr->autoRelayKeep = getCGIargINT(arg);
+ else if (strcmp(curr, "autoMaxRelaySetting") ==0)
+ servMgr->autoMaxRelaySetting = getCGIargINT(arg);
+ else if (strcmp(curr, "autoBumpSkipCount") ==0)
+ servMgr->autoBumpSkipCount = getCGIargINT(arg);
+ else if (strcmp(curr, "kickPushStartRelays") ==0)
+ servMgr->kickPushStartRelays = getCGIargINT(arg);
+ else if (strcmp(curr, "kickPushInterval") ==0)
+ servMgr->kickPushInterval = getCGIargINT(arg);
+ else if (strcmp(curr, "allowConnectPCST") ==0)
+ allowConnectPCST = atoi(arg) ? 1 : 0;
+ else if (strcmp(curr, "enableGetName") ==0)
+ enableGetName = atoi(arg)? 1 : 0;
}
@@ -924,6 +969,8 @@
servMgr->showLog = showLog;
servMgr->allowServer1 = allowServer1;
servMgr->allowServer2 = allowServer2;
+ servMgr->enableGetName = enableGetName;
+ servMgr->allowConnectPCST = allowConnectPCST;
if (servMgr->serverHost.port != newPort)
{
@@ -1170,7 +1217,16 @@
Channel *c = chanMgr->findChannelByID(id);
if (c)
- c->stayConnected = true;
+ { //JP-Patch
+ //c->stayConnected = true;
+ if (!c->stayConnected)
+ {
+ //if (servMgr->getFirewall() == ServMgr::FW_OFF)
+ c->stayConnected = true;
+ }
+ else
+ c->stayConnected = false;
+ } //JP-Patch
sprintf(jumpStr,"/%s/relays.html",servMgr->htmlPath);
jumpArg = jumpStr;
@@ -1250,6 +1306,62 @@
http.writeLineF("Location: /%s/index.html",servMgr->htmlPath);
http.writeLine("");
+ }else if (cmpCGIarg(cmd,"cmd=","setmeta"))
+ {
+ char *cp = cmd;
+ while (cp=nextCGIarg(cp,curr,arg))
+ {
+ if (strcmp(curr,"name")==0)
+ {
+ String chname;
+ chname.set(arg,String::T_ESC);
+ chname.convertTo(String::T_ASCII);
+ Channel *c = chanMgr->channel;
+ while (c)
+ {
+ if ((c->isActive()) && (c->status == Channel::S_BROADCASTING) && (strcmp(c->info.name.cstr(),chname.cstr())==0))
+ {
+ ChanInfo newInfo = c->info;
+
+ while (cmd=nextCGIarg(cmd,curr,arg))
+ {
+ String chmeta;
+ chmeta.set(arg,String::T_ESC);
+ chmeta.convertTo(String::T_ASCII);
+ if (strcmp(curr,"desc")==0)
+ newInfo.desc = chmeta.cstr();
+ else if (strcmp(curr,"url")==0)
+ newInfo.url = chmeta.cstr();
+ else if (strcmp(curr,"genre")==0)
+ newInfo.genre = chmeta.cstr();
+ else if (strcmp(curr,"comment")==0)
+ newInfo.comment = chmeta.cstr();
+ else if (strcmp(curr,"t_contact")==0)
+ newInfo.track.contact = chmeta.cstr();
+ else if (strcmp(curr,"t_title")==0)
+ newInfo.track.title = chmeta.cstr();
+ else if (strcmp(curr,"t_artist")==0)
+ newInfo.track.artist = chmeta.cstr();
+ else if (strcmp(curr,"t_album")==0)
+ newInfo.track.album = chmeta.cstr();
+ else if (strcmp(curr,"t_genre")==0)
+ newInfo.track.genre = chmeta.cstr();
+ }
+ c->updateInfo(newInfo);
+ char idstr[64];
+ newInfo.id.toStr(idstr);
+ sprintf(jumpStr,"/%s/relayinfo.html?id=%s",servMgr->htmlPath,idstr);
+ jumpArg = jumpStr;
+ break;
+ }
+ c = c->next;
+ }
+ }
+ }
+ if (!jumpArg)
+ {
+ jumpArg = "/";
+ }
}else{
sprintf(jumpStr,"/%s/index.html",servMgr->htmlPath);
@@ -1543,7 +1655,7 @@
HTTP http(*sock);
String fileName;
- fileName = peercastApp->getPath();
+ fileName = peercastApp->getHTMLPath();
fileName.append(fn);
diff -urN peercast-svn/core/common/servmgr.cpp gnome-peercast-0.4.1/peercast/core/common/servmgr.cpp
--- peercast-svn/core/common/servmgr.cpp 2005-07-02 18:53:08.000000000 +0200
+++ gnome-peercast-0.4.1/peercast/core/common/servmgr.cpp 2005-09-07 05:05:00.000000000 +0200
@@ -57,8 +57,8 @@
lastIncoming = 0;
- maxBitrateOut = 0;
- maxRelays = MIN_RELAYS;
+ maxBitrateOut = 540; //JP-Patch 0-> 540
+ maxRelays = 1;
maxDirect = 0;
refreshHTML = 5;
@@ -111,6 +111,16 @@
servents = NULL;
+ modulePath[0] = 0; //JP-EX
+ kickPushStartRelays = 0; //JP-EX
+ kickPushInterval = 0; //JP-EX
+ kickPushTime = 0; //JP-EX
+ autoRelayKeep = 2; //JP-EX
+ autoMaxRelaySetting = 10; //JP-EX
+ autoBumpSkipCount = 50; //JP-EX
+ enableGetName = 0; //JP-EX
+ allowConnectPCST = 0; //JP-EX
+
chanLog="";
}
// -----------------------------------
@@ -951,7 +961,16 @@
iniFile.writeStrValue("password",servMgr->password);
iniFile.writeIntValue("maxUptime",chanMgr->maxUptime);
-
+ //JP-EX
+ iniFile.writeSection("Extend");
+ iniFile.writeIntValue("autoRelayKeep",servMgr->autoRelayKeep);
+ iniFile.writeIntValue("autoMaxRelaySetting",servMgr->autoMaxRelaySetting);
+ iniFile.writeIntValue("autoBumpSkipCount",servMgr->autoBumpSkipCount);
+ iniFile.writeIntValue("kickPushStartRelays",servMgr->kickPushStartRelays);
+ iniFile.writeIntValue("kickPushInterval",servMgr->kickPushInterval);
+ iniFile.writeIntValue("allowConnectPCST",servMgr->allowConnectPCST);
+ iniFile.writeIntValue("enableGetName",servMgr->enableGetName);
+
int i;
for(i=0; i<servMgr->numFilters; i++)
@@ -1258,6 +1277,26 @@
servMgr->queryTTL = iniFile.getIntValue();
}
+ //JP-Extend
+ else if (iniFile.isName("autoRelayKeep"))
+ servMgr->autoRelayKeep = iniFile.getIntValue();
+ else if (iniFile.isName("autoMaxRelaySetting"))
+ servMgr->autoMaxRelaySetting = iniFile.getIntValue();
+ else if (iniFile.isName("autoBumpSkipCount"))
+ servMgr->autoBumpSkipCount = iniFile.getIntValue();
+ else if (iniFile.isName("kickPushStartRelays"))
+ servMgr->kickPushStartRelays = iniFile.getIntValue();
+ else if (iniFile.isName("kickPushInterval"))
+ {
+ servMgr->kickPushInterval = iniFile.getIntValue();
+ if (servMgr->kickPushInterval < 60)
+ servMgr->kickPushInterval = 0;
+ }
+ else if (iniFile.isName("allowConnectPCST"))
+ servMgr->allowConnectPCST = iniFile.getIntValue();
+ else if (iniFile.isName("enableGetName"))
+ servMgr->enableGetName = iniFile.getIntValue();
+
// debug
else if (iniFile.isName("logDebug"))
showLog |= iniFile.getBoolValue() ? 1<<LogBuffer::T_DEBUG:0;
@@ -1865,6 +1904,11 @@
// clear dead hits
chanMgr->clearDeadHits(true);
+ if (servMgr->kickPushStartRelays && servMgr->kickPushInterval) //JP-EX
+ {
+ servMgr->banFirewalledHost();
+ }
+
if (servMgr->shutdownTimer)
{
if (--servMgr->shutdownTimer <= 0)
@@ -1971,8 +2015,8 @@
// -----------------------------------
void ServMgr::setMaxRelays(int max)
{
- if (max < MIN_RELAYS)
- max = MIN_RELAYS;
+ if (max <= 0)
+ max = 1;
maxRelays = max;
}
@@ -2059,7 +2103,6 @@
return true;
}
-
// --------------------------------------------------
bool ServMgr::writeVariable(Stream &out, const String &var)
{
@@ -2211,10 +2254,73 @@
out.writeChar('c');
out.writeChar('d');
return true;
-
- }else
+ }
+ // JP-EX
+ else if (var.startsWith("autoRelayKeep")) {
+ if (var == "autoRelayKeep.0")
+ strcpy(buf, (autoRelayKeep == 0) ? "1":"0");
+ else if (var == "autoRelayKeep.1")
+ strcpy(buf, (autoRelayKeep == 1) ? "1":"0");
+ else if (var == "autoRelayKeep.2")
+ strcpy(buf, (autoRelayKeep == 2) ? "1":"0");
+ } else if (var == "autoMaxRelaySetting")
+ sprintf(buf,"%d",autoMaxRelaySetting);
+ else if (var == "autoBumpSkipCount")
+ sprintf(buf,"%d",autoBumpSkipCount);
+ else if (var == "kickPushStartRelays")
+ sprintf(buf,"%d",kickPushStartRelays);
+ else if (var == "kickPushInterval")
+ sprintf(buf,"%d",kickPushInterval);
+ else if (var == "allowConnectPCST")
+ strcpy(buf, (allowConnectPCST == 1) ? "1":"0");
+ else if (var == "enableGetName")
+ strcpy(buf, (enableGetName == 1)? "1":"0");
+ else
return false;
out.writeString(buf);
return true;
}
+
+// --------------------------------------------------
+//JP-EX
+bool ServMgr::isCheckPushStream()
+{
+ if (servMgr->kickPushStartRelays)
+ if (servMgr->numStreams(Servent::T_RELAY,false)>=(servMgr->kickPushStartRelays-1))
+ return true;
+
+ return false;
+}
+// --------------------------------------------------
+//JP-EX
+void ServMgr::banFirewalledHost()
+{
+ unsigned int kickpushtime = sys->getTime();
+
+ if ((kickpushtime - servMgr->kickPushTime) <= servMgr->kickPushInterval)
+ return;
+
+ servMgr->kickPushTime = kickpushtime;
+ Servent *s = servMgr->servents;
+ LOG_DEBUG("Servent scan start.");
+
while (s) {
unsigned int tnum = 0;
+ if (s->type == Servent::T_NONE) {
+ s = s->next;
+ continue;
+ }
+ if (s->lastConnect)
+ tnum = sys->getTime() - s->lastConnect;
if ((s->type != Servent::T_RELAY) ||
(s->status != Servent::S_CONNECTED) ||
(tnum < 120)) {
s = s->next;
continue;
}
+ {
+ Host h = s->getHost();
int ip = h.ip;
int port = h.port;
Host h2(ip,port);
ChanHitList *chl = chanMgr->hitlist;
while (chl) {
if (chl->isUsed()) {
+ ChanHit *hit = chl->hit;
+ while (hit) {
+ if (hit->host.isValid() && (h2.ip == hit->host.ip)) {
if (hit->firewalled && hit->numRelays == 0) {
char hostName[256];
h2.toStr(hostName);
if (servMgr->isCheckPushStream()) {
s->thread.active = false;
+ LOG_ERROR("Stop firewalled Servent : %s",hostName);
}
}
+ }
hit = hit->next;
}
}
+ chl = chl->next;
}
+ } //
+ s = s->next;
+ } // while (s)
+ LOG_DEBUG("Servent scan finished.");
+}
diff -urN peercast-svn/core/common/servmgr.h gnome-peercast-0.4.1/peercast/core/common/servmgr.h
--- peercast-svn/core/common/servmgr.h 2005-07-02 18:41:33.000000000 +0200
+++ gnome-peercast-0.4.1/peercast/core/common/servmgr.h 2005-09-07 05:05:00.000000000 +0200
@@ -140,8 +140,6 @@
MAX_INCOMING = 6, // max. number of public incoming servents to use
MAX_TRYOUT = 10, // max. number of outgoing servents to try connect
MIN_CONNECTED = 3, // min. amount of connected hosts that should be kept
-
- MIN_RELAYS = 2,
MAX_FILTERS = 50,
@@ -386,9 +384,19 @@
int numVersions;
int serventNum;
-
String chanLog;
+ char modulePath[256]; //JP-EX
+ int enableGetName; //JP-EX
+ int allowConnectPCST; //JP-EX
+ int autoRelayKeep; //JP-EX
+ unsigned int autoMaxRelaySetting; //JP-EX
+ unsigned int autoBumpSkipCount;//JP-EX
+ unsigned int kickPushStartRelays; //JP-EX
+ unsigned int kickPushInterval; //JP-EX
+ unsigned int kickPushTime;
+ bool isCheckPushStream(); //JP-EX
+ void banFirewalledHost(); //JP-EX
private:
FW_STATE firewalled;
diff -urN peercast-svn/core/common/sys.h gnome-peercast-0.4.1/peercast/core/common/sys.h
--- peercast-svn/core/common/sys.h 2004-07-02 12:45:37.000000000 +0200
+++ gnome-peercast-0.4.1/peercast/core/common/sys.h 2005-09-07 05:08:45.000000000 +0200
@@ -322,7 +322,7 @@
#define _BIG_ENDIAN 1
#endif
-typedef long long int64_t;
+/* typedef long long int64_t; */
typedef int (*THREAD_FUNC)(ThreadInfo *);
#define THREAD_PROC int
diff -urN peercast-svn/core/common/version2.h gnome-peercast-0.4.1/peercast/core/common/version2.h
--- peercast-svn/core/common/version2.h 2005-06-22 18:16:51.000000000 +0200
+++ gnome-peercast-0.4.1/peercast/core/common/version2.h 2005-09-07 05:05:00.000000000 +0200
@@ -34,6 +34,7 @@
static const int PCP_CLIENT_MINVERSION = 1200;
static const char *PCX_AGENT = "PeerCast/0.1214";
+static const char *PCX_AGENTJP = "PeerCast/0.1214-J";
static const char *PCX_VERSTRING = "v0.1214";
// ------------------------------------------------