• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revision68ed879837ccc3d81e0782684506f8ff5e0d7bc4 (tree)
Time2007-12-30 00:19:04
Authoreru <eru01@user...>
Commitereru

Log Message

リレー数上限をチャンネル毎に設定出来るように修正。

Change Summary

Incremental Difference

--- a/PeerCast.root/PeerCast/core/common/channel.cpp
+++ b/PeerCast.root/PeerCast/core/common/channel.cpp
@@ -143,7 +143,7 @@ int channel_count=1;
143143 // -----------------------------------------------------------------------------
144144 // Initialise the channel to its default settings of unallocated and reset.
145145 // -----------------------------------------------------------------------------
146-Channel::Channel()
146+Channel::Channel() : maxRelays(0)
147147 {
148148 next = NULL;
149149 reset();
@@ -306,7 +306,14 @@ bool Channel::isFull()
306306 }
307307 // for PCRaw (relay) end.
308308
309- return chanMgr->maxRelaysPerChannel ? localRelays() >= chanMgr->maxRelaysPerChannel : false;
309+ // チャンネル固有のリレー上限設定があるか
310+ if (maxRelays > 0)
311+ {
312+ return localRelays() >= maxRelays;
313+ } else
314+ {
315+ return chanMgr->maxRelaysPerChannel ? localRelays() >= chanMgr->maxRelaysPerChannel : false;
316+ }
310317 }
311318 // -----------------------------------
312319 int Channel::localRelays()
--- a/PeerCast.root/PeerCast/core/common/channel.h
+++ b/PeerCast.root/PeerCast/core/common/channel.h
@@ -532,6 +532,8 @@ public:
532532 bool bumped;
533533 unsigned int lastSkipTime;
534534 unsigned int lastStopTime;
535+
536+ int maxRelays; // チャンネル固有のリレー最大数(コンストラクタで初期化)
535537 };
536538
537539 // ----------------------------------
--- a/PeerCast.root/PeerCast/core/common/version2.h
+++ b/PeerCast.root/PeerCast/core/common/version2.h
@@ -42,9 +42,9 @@ static const char *PCX_VERSTRING = "v0.1218(VP0026)";
4242 #if 1 /* for VP extend version */
4343 #define VERSION_EX 1
4444 static const char *PCP_CLIENT_VERSION_EX_PREFIX = "IM"; // 2bytes only
45-static const int PCP_CLIENT_VERSION_EX_NUMBER = 26;
46-static const char *PCX_AGENTEX = "PeerCast/0.1218(IM0026-2)";
47-static const char *PCX_VERSTRING_EX = "v0.1218(IM0026-2)";
45+static const int PCP_CLIENT_VERSION_EX_NUMBER = 27;
46+static const char *PCX_AGENTEX = "PeerCast/0.1218(IM0027)";
47+static const char *PCX_VERSTRING_EX = "v0.1218(IM0027)";
4848 #endif
4949
5050 // ------------------------------------------------
--- a/PeerCast.root/PeerCast/ui/win32/PeerCast.sln
+++ b/PeerCast.root/PeerCast/ui/win32/PeerCast.sln
@@ -8,6 +8,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Simple", "simple\Simple.vcp
88 {7BCFE65B-8757-45F3-8DFB-1E7D683950D1} = {7BCFE65B-8757-45F3-8DFB-1E7D683950D1}
99 EndProjectSection
1010 EndProject
11+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{00D364AE-DB2F-4109-A925-31B4F129D613}"
12+ ProjectSection(SolutionItems) = preProject
13+ memo.txt = memo.txt
14+ EndProjectSection
15+EndProject
1116 Global
1217 GlobalSection(SourceCodeControl) = preSolution
1318 SccNumberOfProjects = 3
--- /dev/null
+++ b/PeerCast.root/PeerCast/ui/win32/memo.txt
@@ -0,0 +1,5 @@
1+・7144/7145のListenポートを捌くスレッド
2+  int Servent::serverProc(ThreadInfo *thread); (servent.cpp)
3+
4+・リレー上限チェック
5+  bool Channel::isFull(); (channel.cpp)
--- a/PeerCast.root/PeerCast/ui/win32/simple/Simple.cpp
+++ b/PeerCast.root/PeerCast/ui/win32/simple/Simple.cpp
@@ -1365,6 +1365,15 @@ LRESULT CALLBACK ChanInfoProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPa
13651365 {
13661366 SendDlgItemMessage(hDlg,IDC_EDIT_STATUS,WM_SETTEXT,0,(LONG)ch->getStatusStr());
13671367 SendDlgItemMessage(hDlg, IDC_KEEP,BM_SETCHECK, ch->stayConnected, 0);
1368+
1369+ // 現在の固有リレー上限設定を表示(0は無効)
1370+ ::SetDlgItemInt(hDlg, IDC_EDIT_MAXRELAYS, ch->maxRelays, false);
1371+ if (isIndexTxt(ch))
1372+ {
1373+ // index.txtなので無効に
1374+ ::EnableWindow(::GetDlgItem(hDlg, IDC_EDIT_MAXRELAYS), false);
1375+ ::EnableWindow(::GetDlgItem(hDlg, IDC_APPLY_MAXRELAYS), false);
1376+ }
13681377 }else
13691378 {
13701379 SendDlgItemMessage(hDlg,IDC_EDIT_STATUS,WM_SETTEXT,0,(LONG)"OK");
@@ -1406,18 +1415,18 @@ LRESULT CALLBACK ChanInfoProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPa
14061415
14071416 switch (LOWORD(wParam))
14081417 {
1409- case IDC_CONTACT:
1418+ case IDC_CONTACT:
14101419 {
14111420 sys->getURL(chanInfo.url);
14121421 return TRUE;
14131422 }
1414- case IDC_DETAILS:
1423+ case IDC_DETAILS:
14151424 {
14161425 sprintf(str,"admin?page=chaninfo&id=%s&relay=%d",idstr,chanInfoIsRelayed);
14171426 sys->callLocalURL(str,servMgr->serverHost.port);
14181427 return TRUE;
14191428 }
1420- case IDC_KEEP:
1429+ case IDC_KEEP:
14211430 {
14221431 Channel *ch = chanMgr->findChannelByID(chanInfo.id);
14231432 if (ch)
@@ -1426,12 +1435,36 @@ LRESULT CALLBACK ChanInfoProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPa
14261435 }
14271436
14281437
1429- case IDC_PLAY:
1438+ case IDC_PLAY:
14301439 {
14311440 chanMgr->findAndPlayChannel(chanInfo,false);
14321441 return TRUE;
14331442 }
14341443
1444+ case IDC_APPLY_MAXRELAYS:
1445+ {
1446+ // チャンネル固有の最大リレー数を設定
1447+ BOOL bSucc;
1448+ unsigned int mr;
1449+
1450+ // 入力値取得
1451+ mr = ::GetDlgItemInt(hDlg, IDC_EDIT_MAXRELAYS, &bSucc, false);
1452+
1453+ if (bSucc)
1454+ {
1455+ Channel *ch = chanMgr->findChannelByID(chanInfo.id);
1456+ if (ch && !isIndexTxt(ch))
1457+ {
1458+ ch->maxRelays = mr;
1459+ }
1460+ } else
1461+ {
1462+ MessageBox(hDlg, "入力値が不正です。", "Error", MB_OK|MB_ICONERROR|MB_APPLMODAL);
1463+ Channel *ch = chanMgr->findChannelByID(chanInfo.id);
1464+ if (ch)
1465+ ::SetDlgItemInt(hDlg, IDC_EDIT_MAXRELAYS, ch->maxRelays, false);
1466+ }
1467+ }
14351468 }
14361469 }
14371470 break;
--- a/PeerCast.root/PeerCast/ui/win32/simple/Simple.rc
+++ b/PeerCast.root/PeerCast/ui/win32/simple/Simple.rc
@@ -166,6 +166,9 @@ BEGIN
166166 LTEXT "ステータス:",IDC_STATIC,7,153,41,9
167167 EDITTEXT IDC_EDIT_STATUS,8,163,82,12,ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP,WS_EX_STATICEDGE
168168 PUSHBUTTON "再生",IDC_PLAY,56,185,34,15
169+ EDITTEXT IDC_EDIT_MAXRELAYS,98,166,46,12,ES_AUTOHSCROLL | ES_NUMBER | NOT WS_BORDER | NOT WS_TABSTOP,WS_EX_RIGHT | WS_EX_STATICEDGE
170+ PUSHBUTTON "適用",IDC_APPLY_MAXRELAYS,149,164,24,15
171+ GROUPBOX "最大リレー数",IDC_STATIC,94,156,83,27
169172 END
170173
171174
--- a/PeerCast.root/PeerCast/ui/win32/simple/resource.h
+++ b/PeerCast.root/PeerCast/ui/win32/simple/resource.h
@@ -50,7 +50,10 @@
5050 #define IDC_STATIC_LOG 1018
5151 #define IDC_BUTTON4 1019
5252 #define IDC_BUTTON5 1020
53+#define IDC_EDIT_MAXRELAYS 1020
5354 #define IDC_BUTTON6 1021
55+#define IDC_APPLY_MAX_RELAYS 1021
56+#define IDC_APPLY_MAXRELAYS 1021
5457 #define IDC_EDIT3 1025
5558 #define IDC_EDIT5 1027
5659 #define IDC_LOGDEBUG 1037
@@ -107,9 +110,9 @@
107110 //
108111 #ifdef APSTUDIO_INVOKED
109112 #ifndef APSTUDIO_READONLY_SYMBOLS
110-#define _APS_NEXT_RESOURCE_VALUE 142
113+#define _APS_NEXT_RESOURCE_VALUE 143
111114 #define _APS_NEXT_COMMAND_VALUE 32831
112-#define _APS_NEXT_CONTROL_VALUE 1019
115+#define _APS_NEXT_CONTROL_VALUE 1022
113116 #define _APS_NEXT_SYMED_VALUE 110
114117 #endif
115118 #endif
--- a/c:/Git/PeerCast.root/PeerCast/core/common/channel.cpp
+++ b/c:/Git/PeerCast.root/PeerCast/core/common/channel.cpp
@@ -143,7 +143,7 @@ int channel_count=1;
143143 // -----------------------------------------------------------------------------
144144 // Initialise the channel to its default settings of unallocated and reset.
145145 // -----------------------------------------------------------------------------
146-Channel::Channel()
146+Channel::Channel() : maxRelays(0)
147147 {
148148 next = NULL;
149149 reset();
@@ -306,7 +306,14 @@ bool Channel::isFull()
306306 }
307307 // for PCRaw (relay) end.
308308
309- return chanMgr->maxRelaysPerChannel ? localRelays() >= chanMgr->maxRelaysPerChannel : false;
309+ // チャンネル固有のリレー上限設定があるか
310+ if (maxRelays > 0)
311+ {
312+ return localRelays() >= maxRelays;
313+ } else
314+ {
315+ return chanMgr->maxRelaysPerChannel ? localRelays() >= chanMgr->maxRelaysPerChannel : false;
316+ }
310317 }
311318 // -----------------------------------
312319 int Channel::localRelays()
--- a/c:/Git/PeerCast.root/PeerCast/core/common/channel.h
+++ b/c:/Git/PeerCast.root/PeerCast/core/common/channel.h
@@ -532,6 +532,8 @@ public:
532532 bool bumped;
533533 unsigned int lastSkipTime;
534534 unsigned int lastStopTime;
535+
536+ int maxRelays; // チャンネル固有のリレー最大数(コンストラクタで初期化)
535537 };
536538
537539 // ----------------------------------
--- a/c:/Git/PeerCast.root/PeerCast/core/common/version2.h
+++ b/c:/Git/PeerCast.root/PeerCast/core/common/version2.h
@@ -42,9 +42,9 @@ static const char *PCX_VERSTRING = "v0.1218(VP0026)";
4242 #if 1 /* for VP extend version */
4343 #define VERSION_EX 1
4444 static const char *PCP_CLIENT_VERSION_EX_PREFIX = "IM"; // 2bytes only
45-static const int PCP_CLIENT_VERSION_EX_NUMBER = 26;
46-static const char *PCX_AGENTEX = "PeerCast/0.1218(IM0026-2)";
47-static const char *PCX_VERSTRING_EX = "v0.1218(IM0026-2)";
45+static const int PCP_CLIENT_VERSION_EX_NUMBER = 27;
46+static const char *PCX_AGENTEX = "PeerCast/0.1218(IM0027)";
47+static const char *PCX_VERSTRING_EX = "v0.1218(IM0027)";
4848 #endif
4949
5050 // ------------------------------------------------
--- a/c:/Git/PeerCast.root/PeerCast/ui/win32/PeerCast.sln
+++ b/c:/Git/PeerCast.root/PeerCast/ui/win32/PeerCast.sln
@@ -8,6 +8,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Simple", "simple\Simple.vcp
88 {7BCFE65B-8757-45F3-8DFB-1E7D683950D1} = {7BCFE65B-8757-45F3-8DFB-1E7D683950D1}
99 EndProjectSection
1010 EndProject
11+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{00D364AE-DB2F-4109-A925-31B4F129D613}"
12+ ProjectSection(SolutionItems) = preProject
13+ memo.txt = memo.txt
14+ EndProjectSection
15+EndProject
1116 Global
1217 GlobalSection(SourceCodeControl) = preSolution
1318 SccNumberOfProjects = 3
--- /dev/null
+++ b/c:/Git/PeerCast.root/PeerCast/ui/win32/memo.txt
@@ -0,0 +1,5 @@
1+・7144/7145のListenポートを捌くスレッド
2+  int Servent::serverProc(ThreadInfo *thread); (servent.cpp)
3+
4+・リレー上限チェック
5+  bool Channel::isFull(); (channel.cpp)
--- a/c:/Git/PeerCast.root/PeerCast/ui/win32/simple/Simple.cpp
+++ b/c:/Git/PeerCast.root/PeerCast/ui/win32/simple/Simple.cpp
@@ -1365,6 +1365,15 @@ LRESULT CALLBACK ChanInfoProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPa
13651365 {
13661366 SendDlgItemMessage(hDlg,IDC_EDIT_STATUS,WM_SETTEXT,0,(LONG)ch->getStatusStr());
13671367 SendDlgItemMessage(hDlg, IDC_KEEP,BM_SETCHECK, ch->stayConnected, 0);
1368+
1369+ // 現在の固有リレー上限設定を表示(0は無効)
1370+ ::SetDlgItemInt(hDlg, IDC_EDIT_MAXRELAYS, ch->maxRelays, false);
1371+ if (isIndexTxt(ch))
1372+ {
1373+ // index.txtなので無効に
1374+ ::EnableWindow(::GetDlgItem(hDlg, IDC_EDIT_MAXRELAYS), false);
1375+ ::EnableWindow(::GetDlgItem(hDlg, IDC_APPLY_MAXRELAYS), false);
1376+ }
13681377 }else
13691378 {
13701379 SendDlgItemMessage(hDlg,IDC_EDIT_STATUS,WM_SETTEXT,0,(LONG)"OK");
@@ -1406,18 +1415,18 @@ LRESULT CALLBACK ChanInfoProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPa
14061415
14071416 switch (LOWORD(wParam))
14081417 {
1409- case IDC_CONTACT:
1418+ case IDC_CONTACT:
14101419 {
14111420 sys->getURL(chanInfo.url);
14121421 return TRUE;
14131422 }
1414- case IDC_DETAILS:
1423+ case IDC_DETAILS:
14151424 {
14161425 sprintf(str,"admin?page=chaninfo&id=%s&relay=%d",idstr,chanInfoIsRelayed);
14171426 sys->callLocalURL(str,servMgr->serverHost.port);
14181427 return TRUE;
14191428 }
1420- case IDC_KEEP:
1429+ case IDC_KEEP:
14211430 {
14221431 Channel *ch = chanMgr->findChannelByID(chanInfo.id);
14231432 if (ch)
@@ -1426,12 +1435,36 @@ LRESULT CALLBACK ChanInfoProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPa
14261435 }
14271436
14281437
1429- case IDC_PLAY:
1438+ case IDC_PLAY:
14301439 {
14311440 chanMgr->findAndPlayChannel(chanInfo,false);
14321441 return TRUE;
14331442 }
14341443
1444+ case IDC_APPLY_MAXRELAYS:
1445+ {
1446+ // チャンネル固有の最大リレー数を設定
1447+ BOOL bSucc;
1448+ unsigned int mr;
1449+
1450+ // 入力値取得
1451+ mr = ::GetDlgItemInt(hDlg, IDC_EDIT_MAXRELAYS, &bSucc, false);
1452+
1453+ if (bSucc)
1454+ {
1455+ Channel *ch = chanMgr->findChannelByID(chanInfo.id);
1456+ if (ch && !isIndexTxt(ch))
1457+ {
1458+ ch->maxRelays = mr;
1459+ }
1460+ } else
1461+ {
1462+ MessageBox(hDlg, "入力値が不正です。", "Error", MB_OK|MB_ICONERROR|MB_APPLMODAL);
1463+ Channel *ch = chanMgr->findChannelByID(chanInfo.id);
1464+ if (ch)
1465+ ::SetDlgItemInt(hDlg, IDC_EDIT_MAXRELAYS, ch->maxRelays, false);
1466+ }
1467+ }
14351468 }
14361469 }
14371470 break;
--- a/c:/Git/PeerCast.root/PeerCast/ui/win32/simple/Simple.rc
+++ b/c:/Git/PeerCast.root/PeerCast/ui/win32/simple/Simple.rc
@@ -166,6 +166,9 @@ BEGIN
166166 LTEXT "ステータス:",IDC_STATIC,7,153,41,9
167167 EDITTEXT IDC_EDIT_STATUS,8,163,82,12,ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP,WS_EX_STATICEDGE
168168 PUSHBUTTON "再生",IDC_PLAY,56,185,34,15
169+ EDITTEXT IDC_EDIT_MAXRELAYS,98,166,46,12,ES_AUTOHSCROLL | ES_NUMBER | NOT WS_BORDER | NOT WS_TABSTOP,WS_EX_RIGHT | WS_EX_STATICEDGE
170+ PUSHBUTTON "適用",IDC_APPLY_MAXRELAYS,149,164,24,15
171+ GROUPBOX "最大リレー数",IDC_STATIC,94,156,83,27
169172 END
170173
171174
--- a/c:/Git/PeerCast.root/PeerCast/ui/win32/simple/resource.h
+++ b/c:/Git/PeerCast.root/PeerCast/ui/win32/simple/resource.h
@@ -50,7 +50,10 @@
5050 #define IDC_STATIC_LOG 1018
5151 #define IDC_BUTTON4 1019
5252 #define IDC_BUTTON5 1020
53+#define IDC_EDIT_MAXRELAYS 1020
5354 #define IDC_BUTTON6 1021
55+#define IDC_APPLY_MAX_RELAYS 1021
56+#define IDC_APPLY_MAXRELAYS 1021
5457 #define IDC_EDIT3 1025
5558 #define IDC_EDIT5 1027
5659 #define IDC_LOGDEBUG 1037
@@ -107,9 +110,9 @@
107110 //
108111 #ifdef APSTUDIO_INVOKED
109112 #ifndef APSTUDIO_READONLY_SYMBOLS
110-#define _APS_NEXT_RESOURCE_VALUE 142
113+#define _APS_NEXT_RESOURCE_VALUE 143
111114 #define _APS_NEXT_COMMAND_VALUE 32831
112-#define _APS_NEXT_CONTROL_VALUE 1019
115+#define _APS_NEXT_CONTROL_VALUE 1022
113116 #define _APS_NEXT_SYMED_VALUE 110
114117 #endif
115118 #endif