• R/O
  • HTTP
  • SSH
  • HTTPS

PeerCastIM: 提交


Commit MetaInfo

修訂1098be40dfeeed78d3fa74b72678d9f3e8978c78 (tree)
時間2009-09-30 03:25:29
作者eru <eru01@user...>
Commitereru

Log Message

バージョンチェックにDNS情報を使うようにした

Change Summary

差異

--- a/PeerCast.root/PeerCast/core/common/pcp.cpp
+++ b/PeerCast.root/PeerCast/core/common/pcp.cpp
@@ -736,11 +736,21 @@ int PCPStream::readBroadcastAtoms(AtomStream &atom,int numc,BroadcastState &bcs)
736736 patom.writeBytes(id,ver_ex_prefix,2);
737737 }else if (id == PCP_BCST_VERSION_EX_NUMBER)
738738 {
739+ // version check (force)
740+ if (servMgr->versionDNS > PCP_CLIENT_VERSION_EX_NUMBER)
741+ {
742+ strcpy(servMgr->downloadURL, PCP_CLIENT_DIST_URL);
743+ peercastApp->notifyMessage(ServMgr::NT_UPGRADE,"新しいバージョンのPeercastがリリースされました。");
744+
745+ LOG_DEBUG("PCP triggered version check (force): %d / %d", servMgr->versionDNS, PCP_CLIENT_VERSION_EX_NUMBER);
746+ }
747+
739748 ver_ex_number = atom.readShort();
740749 patom.writeShort(id,ver_ex_number);
741750
742751 // version check
743- if (!servMgr->noVersionCheck
752+ if (!servMgr->versionDNS // DNSからバージョン情報を取得できなかった
753+ && !servMgr->noVersionCheck
744754 && !strncmp(ver_ex_prefix, PCP_CLIENT_VERSION_EX_PREFIX, 2)
745755 && ver_ex_number > PCP_CLIENT_VERSION_EX_NUMBER)
746756 {
--- a/PeerCast.root/PeerCast/core/common/servmgr.cpp
+++ b/PeerCast.root/PeerCast/core/common/servmgr.cpp
@@ -143,6 +143,23 @@ ServMgr::ServMgr()
143143 preventSS = false;
144144 noVersionCheck = false;
145145
146+ // retrieve newest version number from DNS
147+ // for windows ONLY. Linux or other OS is NOT supported.
148+#ifdef WIN32
149+ {
150+ struct hostent *he;
151+
152+ he = gethostbyname(PCP_CLIENT_VERSION_URL);
153+ if (he && he->h_addrtype == AF_INET)
154+ {
155+ versionDNS = ((struct in_addr*)he->h_addr_list[0])->S_un.S_un_b.s_b3;
156+ } else
157+ versionDNS = 0;
158+ }
159+#else
160+ versionDNS = 0;
161+#endif
162+
146163 chanLog="";
147164
148165 maxRelaysIndexTxt = 1; // for PCRaw (relay)
--- a/PeerCast.root/PeerCast/core/common/servmgr.h
+++ b/PeerCast.root/PeerCast/core/common/servmgr.h
@@ -422,6 +422,8 @@ public:
422422 bool preventSS; // スクリーンセーバーを抑止
423423 bool noVersionCheck; // bcstAtomによるバージョンチェックを行わない
424424
425+ int versionDNS; // DNSから取得した最新バージョンの番号
426+
425427 int maxRelaysIndexTxt; // for PCRaw (relay)
426428
427429 #ifdef WIN32 //JP-MOD
--- a/PeerCast.root/PeerCast/core/common/version2.h
+++ b/PeerCast.root/PeerCast/core/common/version2.h
@@ -44,11 +44,12 @@ extern int version_ex; // VERSION_EX
4444 #if 1 /* for VP extend version */
4545 //#define VERSION_EX 1
4646 static const char *PCP_CLIENT_VERSION_EX_PREFIX = "IM"; // 2bytes only
47-static const int PCP_CLIENT_VERSION_EX_NUMBER = 39;
48-static const char *PCX_AGENTEX = "PeerCast/0.1218(IM0039)";
49-static const char *PCX_VERSTRING_EX = "v0.1218(IM0039)";
47+static const int PCP_CLIENT_VERSION_EX_NUMBER = 40;
48+static const char *PCX_AGENTEX = "PeerCast/0.1218(IM0040)";
49+static const char *PCX_VERSTRING_EX = "v0.1218(IM0040)";
5050
5151 static const char *PCP_CLIENT_DIST_URL = "http://pecaim.net/";
52+static const char *PCP_CLIENT_VERSION_URL = "version.pecaim.net";
5253 #endif
5354
5455 // ------------------------------------------------
--- a/PeerCast.root/PeerCast/ui/win32/simple/Simple.rc
+++ b/PeerCast.root/PeerCast/ui/win32/simple/Simple.rc
@@ -71,8 +71,8 @@ END
7171 //
7272
7373 VS_VERSION_INFO VERSIONINFO
74- FILEVERSION 1,3,9,0
75- PRODUCTVERSION 1,3,9,0
74+ FILEVERSION 1,4,0,0
75+ PRODUCTVERSION 1,4,0,0
7676 FILEFLAGSMASK 0x17L
7777 #ifdef _DEBUG
7878 FILEFLAGS 0x1L
@@ -89,12 +89,12 @@ BEGIN
8989 BEGIN
9090 VALUE "CompanyName", "PeCa"
9191 VALUE "FileDescription", "Peercast IM"
92- VALUE "FileVersion", "1, 3, 9, 0"
92+ VALUE "FileVersion", "1, 4, 0, 0"
9393 VALUE "InternalName", "PeCaIM"
9494 VALUE "LegalCopyright", "Copyright (C) 2009"
9595 VALUE "OriginalFilename", "PeerCast.exe"
9696 VALUE "ProductName", "Peercast IM"
97- VALUE "ProductVersion", "1, 3, 9, 0"
97+ VALUE "ProductVersion", "1, 4, 0, 0"
9898 END
9999 END
100100 BLOCK "VarFileInfo"
--- a/c:/Git/PeerCast.root/PeerCast/core/common/pcp.cpp
+++ b/c:/Git/PeerCast.root/PeerCast/core/common/pcp.cpp
@@ -736,11 +736,21 @@ int PCPStream::readBroadcastAtoms(AtomStream &atom,int numc,BroadcastState &bcs)
736736 patom.writeBytes(id,ver_ex_prefix,2);
737737 }else if (id == PCP_BCST_VERSION_EX_NUMBER)
738738 {
739+ // version check (force)
740+ if (servMgr->versionDNS > PCP_CLIENT_VERSION_EX_NUMBER)
741+ {
742+ strcpy(servMgr->downloadURL, PCP_CLIENT_DIST_URL);
743+ peercastApp->notifyMessage(ServMgr::NT_UPGRADE,"新しいバージョンのPeercastがリリースされました。");
744+
745+ LOG_DEBUG("PCP triggered version check (force): %d / %d", servMgr->versionDNS, PCP_CLIENT_VERSION_EX_NUMBER);
746+ }
747+
739748 ver_ex_number = atom.readShort();
740749 patom.writeShort(id,ver_ex_number);
741750
742751 // version check
743- if (!servMgr->noVersionCheck
752+ if (!servMgr->versionDNS // DNSからバージョン情報を取得できなかった
753+ && !servMgr->noVersionCheck
744754 && !strncmp(ver_ex_prefix, PCP_CLIENT_VERSION_EX_PREFIX, 2)
745755 && ver_ex_number > PCP_CLIENT_VERSION_EX_NUMBER)
746756 {
--- a/c:/Git/PeerCast.root/PeerCast/core/common/servmgr.cpp
+++ b/c:/Git/PeerCast.root/PeerCast/core/common/servmgr.cpp
@@ -143,6 +143,23 @@ ServMgr::ServMgr()
143143 preventSS = false;
144144 noVersionCheck = false;
145145
146+ // retrieve newest version number from DNS
147+ // for windows ONLY. Linux or other OS is NOT supported.
148+#ifdef WIN32
149+ {
150+ struct hostent *he;
151+
152+ he = gethostbyname(PCP_CLIENT_VERSION_URL);
153+ if (he && he->h_addrtype == AF_INET)
154+ {
155+ versionDNS = ((struct in_addr*)he->h_addr_list[0])->S_un.S_un_b.s_b3;
156+ } else
157+ versionDNS = 0;
158+ }
159+#else
160+ versionDNS = 0;
161+#endif
162+
146163 chanLog="";
147164
148165 maxRelaysIndexTxt = 1; // for PCRaw (relay)
--- a/c:/Git/PeerCast.root/PeerCast/core/common/servmgr.h
+++ b/c:/Git/PeerCast.root/PeerCast/core/common/servmgr.h
@@ -422,6 +422,8 @@ public:
422422 bool preventSS; // スクリーンセーバーを抑止
423423 bool noVersionCheck; // bcstAtomによるバージョンチェックを行わない
424424
425+ int versionDNS; // DNSから取得した最新バージョンの番号
426+
425427 int maxRelaysIndexTxt; // for PCRaw (relay)
426428
427429 #ifdef WIN32 //JP-MOD
--- a/c:/Git/PeerCast.root/PeerCast/core/common/version2.h
+++ b/c:/Git/PeerCast.root/PeerCast/core/common/version2.h
@@ -44,11 +44,12 @@ extern int version_ex; // VERSION_EX
4444 #if 1 /* for VP extend version */
4545 //#define VERSION_EX 1
4646 static const char *PCP_CLIENT_VERSION_EX_PREFIX = "IM"; // 2bytes only
47-static const int PCP_CLIENT_VERSION_EX_NUMBER = 39;
48-static const char *PCX_AGENTEX = "PeerCast/0.1218(IM0039)";
49-static const char *PCX_VERSTRING_EX = "v0.1218(IM0039)";
47+static const int PCP_CLIENT_VERSION_EX_NUMBER = 40;
48+static const char *PCX_AGENTEX = "PeerCast/0.1218(IM0040)";
49+static const char *PCX_VERSTRING_EX = "v0.1218(IM0040)";
5050
5151 static const char *PCP_CLIENT_DIST_URL = "http://pecaim.net/";
52+static const char *PCP_CLIENT_VERSION_URL = "version.pecaim.net";
5253 #endif
5354
5455 // ------------------------------------------------
--- a/c:/Git/PeerCast.root/PeerCast/ui/win32/simple/Simple.rc
+++ b/c:/Git/PeerCast.root/PeerCast/ui/win32/simple/Simple.rc
@@ -71,8 +71,8 @@ END
7171 //
7272
7373 VS_VERSION_INFO VERSIONINFO
74- FILEVERSION 1,3,9,0
75- PRODUCTVERSION 1,3,9,0
74+ FILEVERSION 1,4,0,0
75+ PRODUCTVERSION 1,4,0,0
7676 FILEFLAGSMASK 0x17L
7777 #ifdef _DEBUG
7878 FILEFLAGS 0x1L
@@ -89,12 +89,12 @@ BEGIN
8989 BEGIN
9090 VALUE "CompanyName", "PeCa"
9191 VALUE "FileDescription", "Peercast IM"
92- VALUE "FileVersion", "1, 3, 9, 0"
92+ VALUE "FileVersion", "1, 4, 0, 0"
9393 VALUE "InternalName", "PeCaIM"
9494 VALUE "LegalCopyright", "Copyright (C) 2009"
9595 VALUE "OriginalFilename", "PeerCast.exe"
9696 VALUE "ProductName", "Peercast IM"
97- VALUE "ProductVersion", "1, 3, 9, 0"
97+ VALUE "ProductVersion", "1, 4, 0, 0"
9898 END
9999 END
100100 BLOCK "VarFileInfo"
Show on old repository browser