• R/O
  • HTTP
  • SSH
  • HTTPS

PeerCastIM: Commit


Commit MetaInfo

Revisão85d213f7c11b6f55cead77b739a0d3e45b6288b5 (tree)
Hora2007-12-19 13:22:32
Autoreru <eru01@user...>
Commitereru

Mensagem de Log

VP24マージ

Mudança Sumário

Diff

--- a/PeerCast.root/PeerCast/core/common/pcp.cpp
+++ b/PeerCast.root/PeerCast/core/common/pcp.cpp
@@ -149,7 +149,9 @@ int PCPStream::readPacket(Stream &in,BroadcastState &bcs)
149149 error = PCPStream::procAtom(patom,id,numc,numd,bcs);
150150
151151 if (error)
152+ {
152153 throw StreamException("PCP exception");
154+ }
153155 }
154156
155157 error = 0;
--- a/PeerCast.root/PeerCast/core/common/servent.cpp
+++ b/PeerCast.root/PeerCast/core/common/servent.cpp
@@ -230,8 +230,8 @@ void Servent::reset()
230230 nsSwitchNum = 0;
231231 pack.func = 255;
232232 lastConnect = lastPing = lastPacket = 0;
233- loginPassword[0] = 0;
234- loginMount[0] = 0;
233+ loginPassword.clear();
234+ loginMount.clear();
235235 bytesPerSecond = 0;
236236 priorityConnect = false;
237237 pushSock = NULL;
--- a/PeerCast.root/PeerCast/core/common/servent.h
+++ b/PeerCast.root/PeerCast/core/common/servent.h
@@ -254,8 +254,8 @@ public:
254254 ThreadInfo thread;
255255
256256
257- char loginPassword[64];
258- char loginMount[64];
257+ String loginPassword;
258+ String loginMount;
259259
260260 bool priorityConnect;
261261 bool addMetadata;
--- a/PeerCast.root/PeerCast/core/common/servhs.cpp
+++ b/PeerCast.root/PeerCast/core/common/servhs.cpp
@@ -371,13 +371,13 @@ void Servent::handshakeHTTP(HTTP &http, bool isHTTP)
371371 mount[-1] = 0; // password preceeds
372372 break;
373373 }
374- strcpy(loginPassword,in+7);
374+ loginPassword.set(in+7);
375375
376- LOG_DEBUG("ICY client: %s %s",loginPassword,mount?mount:"unknown");
376+ LOG_DEBUG("ICY client: %s %s",loginPassword.cstr(),mount?mount:"unknown");
377377 }
378378
379379 if (mount)
380- strcpy(loginMount,mount);
380+ loginMount.set(mount);
381381
382382 handshakeICY(Channel::SRC_ICECAST,isHTTP);
383383 sock = NULL; // socket is taken over by channel, so don`t close it
@@ -387,7 +387,7 @@ void Servent::handshakeHTTP(HTTP &http, bool isHTTP)
387387 if (!isAllowed(ALLOW_BROADCAST))
388388 throw HTTPException(HTTP_SC_UNAVAILABLE,503);
389389
390- strcpy(loginPassword,servMgr->password); // pwd already checked
390+ loginPassword.set(servMgr->password); // pwd already checked
391391
392392 sock->writeLine("OK2");
393393 sock->writeLine("icy-caps:11");
@@ -1778,15 +1778,15 @@ void Servent::handshakeICY(Channel::SRC_TYPE type, bool isHTTP)
17781778 while (http.nextHeader())
17791779 {
17801780 LOG_DEBUG("ICY %s",http.cmdLine);
1781- readICYHeader(http,info,loginPassword);
1781+ readICYHeader(http,info,loginPassword.cstr());
17821782 }
17831783
17841784
17851785
17861786 // check password before anything else, if needed
1787- if (strcmp(servMgr->password,loginPassword)!=0)
1787+ if (servMgr->password != loginPassword)
17881788 {
1789- if (!sock->host.isLocalhost() || strlen(loginPassword))
1789+ if (!sock->host.isLocalhost() || !loginPassword.isEmpty())
17901790 throw HTTPException(HTTP_SC_UNAUTHORIZED,401);
17911791 }
17921792
@@ -1800,7 +1800,7 @@ void Servent::handshakeICY(Channel::SRC_TYPE type, bool isHTTP)
18001800
18011801
18021802 info.id = chanMgr->broadcastID;
1803- info.id.encode(NULL,info.name.cstr(),loginMount,info.bitrate);
1803+ info.id.encode(NULL,info.name.cstr(),loginMount.cstr(),info.bitrate);
18041804
18051805 LOG_DEBUG("Incoming source: %s : %s",info.name.cstr(),ChanInfo::getTypeStr(info.contentType));
18061806
@@ -1821,7 +1821,7 @@ void Servent::handshakeICY(Channel::SRC_TYPE type, bool isHTTP)
18211821 info.comment = chanMgr->broadcastMsg;
18221822 info.bcID = chanMgr->broadcastID;
18231823
1824- c = chanMgr->createChannel(info,loginMount);
1824+ c = chanMgr->createChannel(info,loginMount.cstr());
18251825 if (!c)
18261826 throw HTTPException(HTTP_SC_UNAVAILABLE,503);
18271827
--- a/PeerCast.root/PeerCast/core/common/servmgr.cpp
+++ b/PeerCast.root/PeerCast/core/common/servmgr.cpp
@@ -2354,6 +2354,8 @@ bool ServMgr::writeVariable(Stream &out, const String &var)
23542354 sprintf(buf,"%d",maxBitrateOut);
23552355 else if (var == "maxControlsIn")
23562356 sprintf(buf,"%d",maxControl);
2357+ else if (var == "maxServIn")
2358+ sprintf(buf,"%d",maxServIn);
23572359 else if (var == "numFilters")
23582360 sprintf(buf,"%d",numFilters+1);
23592361 else if (var == "maxPGNUIn")
--- a/PeerCast.root/PeerCast/core/common/sys.h
+++ b/PeerCast.root/PeerCast/core/common/sys.h
@@ -158,6 +158,7 @@ public:
158158 }
159159
160160 bool operator == (const char *s) const {return isSame(s);}
161+ bool operator != (const char *s) const {return !isSame(s);}
161162
162163 operator const char *() const {return data;}
163164
--- a/PeerCast.root/PeerCast/core/common/version2.h
+++ b/PeerCast.root/PeerCast/core/common/version2.h
@@ -28,23 +28,23 @@ static const char PCP_BROADCAST_FLAGS = 0x00;
2828 static bool PCP_FORCE_YP = false;
2929 #endif
3030 // ------------------------------------------------
31-static const int PCP_CLIENT_VERSION = 1217;
32-static const int PCP_CLIENT_VERSION_VP = 23;
33-static const int PCP_ROOT_VERSION = 1212;
31+static const int PCP_CLIENT_VERSION = 1218;
32+static const int PCP_CLIENT_VERSION_VP = 24;
33+static const int PCP_ROOT_VERSION = 1218;
3434
3535 static const int PCP_CLIENT_MINVERSION = 1200;
3636
37-static const char *PCX_AGENT = "PeerCast/0.1217";
38-static const char *PCX_AGENTJP = "PeerCast/0.1217-J";
39-static const char *PCX_AGENTVP = "PeerCast/0.1217(VP0023)";
40-static const char *PCX_VERSTRING = "v0.1217(VP0023)";
37+static const char *PCX_AGENT = "PeerCast/0.1218";
38+static const char *PCX_AGENTJP = "PeerCast/0.1218-J";
39+static const char *PCX_AGENTVP = "PeerCast/0.1218(VP0024)";
40+static const char *PCX_VERSTRING = "v0.1218(VP0024)";
4141
4242 #if 1 /* for VP extend version */
4343 #define VERSION_EX 1
4444 static const char *PCP_CLIENT_VERSION_EX_PREFIX = "IM"; // 2bytes only
4545 static const int PCP_CLIENT_VERSION_EX_NUMBER = 7651;
46-static const char *PCX_AGENTEX = "PeerCast/0.1217(IM7651)";
47-static const char *PCX_VERSTRING_EX = "v0.1217(IM7651)";
46+static const char *PCX_AGENTEX = "PeerCast/0.1218(IM7651)";
47+static const char *PCX_VERSTRING_EX = "v0.1218(IM7651)";
4848 #endif
4949
5050 // ------------------------------------------------
--- a/PeerCast.root/PeerCast/core/win32/wsocket.cpp
+++ b/PeerCast.root/PeerCast/core/win32/wsocket.cpp
@@ -613,7 +613,7 @@ ClientSocket *WSAClientSocket::accept()
613613 WSAClientSocket *cs = new WSAClientSocket();
614614 cs->sockNum = conSock;
615615
616- cs->host.port = from.sin_port;
616+ cs->host.port = (from.sin_port & 0xff) << 8 | ((from.sin_port >> 8) & 0xff);
617617 cs->host.ip = from.sin_addr.S_un.S_un_b.s_b1<<24 |
618618 from.sin_addr.S_un.S_un_b.s_b2<<16 |
619619 from.sin_addr.S_un.S_un_b.s_b3<<8 |
--- a/c:/Git/PeerCast.root/PeerCast/core/common/pcp.cpp
+++ b/c:/Git/PeerCast.root/PeerCast/core/common/pcp.cpp
@@ -149,7 +149,9 @@ int PCPStream::readPacket(Stream &in,BroadcastState &bcs)
149149 error = PCPStream::procAtom(patom,id,numc,numd,bcs);
150150
151151 if (error)
152+ {
152153 throw StreamException("PCP exception");
154+ }
153155 }
154156
155157 error = 0;
--- a/c:/Git/PeerCast.root/PeerCast/core/common/servent.cpp
+++ b/c:/Git/PeerCast.root/PeerCast/core/common/servent.cpp
@@ -230,8 +230,8 @@ void Servent::reset()
230230 nsSwitchNum = 0;
231231 pack.func = 255;
232232 lastConnect = lastPing = lastPacket = 0;
233- loginPassword[0] = 0;
234- loginMount[0] = 0;
233+ loginPassword.clear();
234+ loginMount.clear();
235235 bytesPerSecond = 0;
236236 priorityConnect = false;
237237 pushSock = NULL;
--- a/c:/Git/PeerCast.root/PeerCast/core/common/servent.h
+++ b/c:/Git/PeerCast.root/PeerCast/core/common/servent.h
@@ -254,8 +254,8 @@ public:
254254 ThreadInfo thread;
255255
256256
257- char loginPassword[64];
258- char loginMount[64];
257+ String loginPassword;
258+ String loginMount;
259259
260260 bool priorityConnect;
261261 bool addMetadata;
--- a/c:/Git/PeerCast.root/PeerCast/core/common/servhs.cpp
+++ b/c:/Git/PeerCast.root/PeerCast/core/common/servhs.cpp
@@ -371,13 +371,13 @@ void Servent::handshakeHTTP(HTTP &http, bool isHTTP)
371371 mount[-1] = 0; // password preceeds
372372 break;
373373 }
374- strcpy(loginPassword,in+7);
374+ loginPassword.set(in+7);
375375
376- LOG_DEBUG("ICY client: %s %s",loginPassword,mount?mount:"unknown");
376+ LOG_DEBUG("ICY client: %s %s",loginPassword.cstr(),mount?mount:"unknown");
377377 }
378378
379379 if (mount)
380- strcpy(loginMount,mount);
380+ loginMount.set(mount);
381381
382382 handshakeICY(Channel::SRC_ICECAST,isHTTP);
383383 sock = NULL; // socket is taken over by channel, so don`t close it
@@ -387,7 +387,7 @@ void Servent::handshakeHTTP(HTTP &http, bool isHTTP)
387387 if (!isAllowed(ALLOW_BROADCAST))
388388 throw HTTPException(HTTP_SC_UNAVAILABLE,503);
389389
390- strcpy(loginPassword,servMgr->password); // pwd already checked
390+ loginPassword.set(servMgr->password); // pwd already checked
391391
392392 sock->writeLine("OK2");
393393 sock->writeLine("icy-caps:11");
@@ -1778,15 +1778,15 @@ void Servent::handshakeICY(Channel::SRC_TYPE type, bool isHTTP)
17781778 while (http.nextHeader())
17791779 {
17801780 LOG_DEBUG("ICY %s",http.cmdLine);
1781- readICYHeader(http,info,loginPassword);
1781+ readICYHeader(http,info,loginPassword.cstr());
17821782 }
17831783
17841784
17851785
17861786 // check password before anything else, if needed
1787- if (strcmp(servMgr->password,loginPassword)!=0)
1787+ if (servMgr->password != loginPassword)
17881788 {
1789- if (!sock->host.isLocalhost() || strlen(loginPassword))
1789+ if (!sock->host.isLocalhost() || !loginPassword.isEmpty())
17901790 throw HTTPException(HTTP_SC_UNAUTHORIZED,401);
17911791 }
17921792
@@ -1800,7 +1800,7 @@ void Servent::handshakeICY(Channel::SRC_TYPE type, bool isHTTP)
18001800
18011801
18021802 info.id = chanMgr->broadcastID;
1803- info.id.encode(NULL,info.name.cstr(),loginMount,info.bitrate);
1803+ info.id.encode(NULL,info.name.cstr(),loginMount.cstr(),info.bitrate);
18041804
18051805 LOG_DEBUG("Incoming source: %s : %s",info.name.cstr(),ChanInfo::getTypeStr(info.contentType));
18061806
@@ -1821,7 +1821,7 @@ void Servent::handshakeICY(Channel::SRC_TYPE type, bool isHTTP)
18211821 info.comment = chanMgr->broadcastMsg;
18221822 info.bcID = chanMgr->broadcastID;
18231823
1824- c = chanMgr->createChannel(info,loginMount);
1824+ c = chanMgr->createChannel(info,loginMount.cstr());
18251825 if (!c)
18261826 throw HTTPException(HTTP_SC_UNAVAILABLE,503);
18271827
--- a/c:/Git/PeerCast.root/PeerCast/core/common/servmgr.cpp
+++ b/c:/Git/PeerCast.root/PeerCast/core/common/servmgr.cpp
@@ -2354,6 +2354,8 @@ bool ServMgr::writeVariable(Stream &out, const String &var)
23542354 sprintf(buf,"%d",maxBitrateOut);
23552355 else if (var == "maxControlsIn")
23562356 sprintf(buf,"%d",maxControl);
2357+ else if (var == "maxServIn")
2358+ sprintf(buf,"%d",maxServIn);
23572359 else if (var == "numFilters")
23582360 sprintf(buf,"%d",numFilters+1);
23592361 else if (var == "maxPGNUIn")
--- a/c:/Git/PeerCast.root/PeerCast/core/common/sys.h
+++ b/c:/Git/PeerCast.root/PeerCast/core/common/sys.h
@@ -158,6 +158,7 @@ public:
158158 }
159159
160160 bool operator == (const char *s) const {return isSame(s);}
161+ bool operator != (const char *s) const {return !isSame(s);}
161162
162163 operator const char *() const {return data;}
163164
--- a/c:/Git/PeerCast.root/PeerCast/core/common/version2.h
+++ b/c:/Git/PeerCast.root/PeerCast/core/common/version2.h
@@ -28,23 +28,23 @@ static const char PCP_BROADCAST_FLAGS = 0x00;
2828 static bool PCP_FORCE_YP = false;
2929 #endif
3030 // ------------------------------------------------
31-static const int PCP_CLIENT_VERSION = 1217;
32-static const int PCP_CLIENT_VERSION_VP = 23;
33-static const int PCP_ROOT_VERSION = 1212;
31+static const int PCP_CLIENT_VERSION = 1218;
32+static const int PCP_CLIENT_VERSION_VP = 24;
33+static const int PCP_ROOT_VERSION = 1218;
3434
3535 static const int PCP_CLIENT_MINVERSION = 1200;
3636
37-static const char *PCX_AGENT = "PeerCast/0.1217";
38-static const char *PCX_AGENTJP = "PeerCast/0.1217-J";
39-static const char *PCX_AGENTVP = "PeerCast/0.1217(VP0023)";
40-static const char *PCX_VERSTRING = "v0.1217(VP0023)";
37+static const char *PCX_AGENT = "PeerCast/0.1218";
38+static const char *PCX_AGENTJP = "PeerCast/0.1218-J";
39+static const char *PCX_AGENTVP = "PeerCast/0.1218(VP0024)";
40+static const char *PCX_VERSTRING = "v0.1218(VP0024)";
4141
4242 #if 1 /* for VP extend version */
4343 #define VERSION_EX 1
4444 static const char *PCP_CLIENT_VERSION_EX_PREFIX = "IM"; // 2bytes only
4545 static const int PCP_CLIENT_VERSION_EX_NUMBER = 7651;
46-static const char *PCX_AGENTEX = "PeerCast/0.1217(IM7651)";
47-static const char *PCX_VERSTRING_EX = "v0.1217(IM7651)";
46+static const char *PCX_AGENTEX = "PeerCast/0.1218(IM7651)";
47+static const char *PCX_VERSTRING_EX = "v0.1218(IM7651)";
4848 #endif
4949
5050 // ------------------------------------------------
--- a/c:/Git/PeerCast.root/PeerCast/core/win32/wsocket.cpp
+++ b/c:/Git/PeerCast.root/PeerCast/core/win32/wsocket.cpp
@@ -613,7 +613,7 @@ ClientSocket *WSAClientSocket::accept()
613613 WSAClientSocket *cs = new WSAClientSocket();
614614 cs->sockNum = conSock;
615615
616- cs->host.port = from.sin_port;
616+ cs->host.port = (from.sin_port & 0xff) << 8 | ((from.sin_port >> 8) & 0xff);
617617 cs->host.ip = from.sin_addr.S_un.S_un_b.s_b1<<24 |
618618 from.sin_addr.S_un.S_un_b.s_b2<<16 |
619619 from.sin_addr.S_un.S_un_b.s_b3<<8 |
Show on old repository browser