You can subscribe to this list here.
2006 |
Jan
|
Feb
(24) |
Mar
(9) |
Apr
(4) |
May
(7) |
Jun
(13) |
Jul
(19) |
Aug
(1) |
Sep
(12) |
Oct
(20) |
Nov
(1) |
Dec
(15) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
|
Feb
(6) |
Mar
(24) |
Apr
(1) |
May
(10) |
Jun
(30) |
Jul
(46) |
Aug
(20) |
Sep
(12) |
Oct
(27) |
Nov
(51) |
Dec
(58) |
2008 |
Jan
(40) |
Feb
(40) |
Mar
(78) |
Apr
(138) |
May
(4) |
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(5) |
Sep
|
Oct
|
Nov
|
Dec
|
2010 |
Jan
|
Feb
|
Mar
|
Apr
(3) |
May
|
Jun
(2) |
Jul
(10) |
Aug
(1) |
Sep
(11) |
Oct
(31) |
Nov
(7) |
Dec
(1) |
2011 |
Jan
(1) |
Feb
|
Mar
(3) |
Apr
|
May
(1) |
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2012 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
(2) |
Sep
|
Oct
|
Nov
(2) |
Dec
(2) |
2013 |
Jan
(3) |
Feb
(5) |
Mar
(1) |
Apr
|
May
|
Jun
(11) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(4) |
2014 |
Jan
(2) |
Feb
(3) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2015 |
Jan
|
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2025 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(4) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <pie...@us...> - 2007-12-14 16:40:51
|
Revision: 943 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=943&view=rev Author: pietricica Date: 2007-12-14 08:40:43 -0800 (Fri, 14 Dec 2007) Log Message: ----------- 0.704 Added Paths: ----------- dcplusplus/tags/dcplusplus-0.704/ Copied: dcplusplus/tags/dcplusplus-0.704 (from rev 942, dcplusplus/trunk) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pie...@us...> - 2007-12-14 16:38:39
|
Revision: 942 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=942&view=rev Author: pietricica Date: 2007-12-14 08:38:27 -0800 (Fri, 14 Dec 2007) Log Message: ----------- edited changelog release date and installer file Modified Paths: -------------- dcplusplus/trunk/DCPlusPlus.nsi dcplusplus/trunk/changelog.txt Modified: dcplusplus/trunk/DCPlusPlus.nsi =================================================================== --- dcplusplus/trunk/DCPlusPlus.nsi 2007-12-14 14:07:34 UTC (rev 941) +++ dcplusplus/trunk/DCPlusPlus.nsi 2007-12-14 16:38:27 UTC (rev 942) @@ -116,13 +116,11 @@ ; remove files Delete "$INSTDIR\DCPlusPlus.exe" Delete "$INSTDIR\DCPlusPlus.chm" - Delete "$INSTDIR\dbghelp.dll" - Delete "$INSTDIR\DCPlusPlus.pdb" + Delete "$INSTDIR\dcppboot.xml" Delete "$INSTDIR\License-GeoIP.txt" Delete "$INSTDIR\License.txt" Delete "$INSTDIR\ChangeLog.txt" - Delete "$INSTDIR\unicows.dll" - Delete "$INSTDIR\unicows.pdb" + Delete "$INSTDIR\LICENSE-OpenSSL.tx" Delete "$INSTDIR\Example.xml" Delete "$INSTDIR\Magnet.exe" Delete "$INSTDIR\GeoIPCountryWhois.csv" Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2007-12-14 14:07:34 UTC (rev 941) +++ dcplusplus/trunk/changelog.txt 2007-12-14 16:38:27 UTC (rev 942) @@ -1,4 +1,4 @@ --- 0.704 -- +-- 0.704 2007-12-14 -- * Hub lists added to utilize Coral's distributed network (ullner) * Use system header arrows on common controls 6+ (thanks poy) * Fixed badly drawn arrows (thanks poy) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2007-12-14 15:17:02
|
Revision: 105 http://adchpp.svn.sourceforge.net/adchpp/?rev=105&view=rev Author: arnetheduck Date: 2007-12-14 07:16:58 -0800 (Fri, 14 Dec 2007) Log Message: ----------- python versions other than 2.5 on linux, lua script fix Modified Paths: -------------- adchpp/trunk/plugins/Script/examples/access.lua adchpp/trunk/readme.txt adchpp/trunk/swig/SConscript Modified: adchpp/trunk/plugins/Script/examples/access.lua =================================================================== --- adchpp/trunk/plugins/Script/examples/access.lua 2007-12-10 20:11:15 UTC (rev 104) +++ adchpp/trunk/plugins/Script/examples/access.lua 2007-12-14 15:16:58 UTC (rev 105) @@ -49,9 +49,10 @@ local context_bcast = "[BF]" local context_direct = "[DE]" local context_send = "[BFD]" +local context_hubdirect = "[HDE]" local command_contexts = { - [adchpp.AdcCommand_CMD_STA] = context_hub, + [adchpp.AdcCommand_CMD_STA] = context_hubdirect, [adchpp.AdcCommand_CMD_SUP] = context_hub, [adchpp.AdcCommand_CMD_SID] = context_hub, [adchpp.AdcCommand_CMD_INF] = context_bcast, Modified: adchpp/trunk/readme.txt =================================================================== --- adchpp/trunk/readme.txt 2007-12-10 20:11:15 UTC (rev 104) +++ adchpp/trunk/readme.txt 2007-12-14 15:16:58 UTC (rev 105) @@ -3,7 +3,8 @@ -- Introduction -- -ADCH++ is a hub for the ADC network. +ADCH++ is a hub for the ADC network. It implements the ADC protocol, which can +be found here: http://dcplusplus.sf.net/ADC.html. -- Requirements -- @@ -16,7 +17,6 @@ An administrator/root account (to install as service / run on port < 1024 on unix). A brain (to understand the readme and setup) gcc 4.2+ (linux or mingw) -boost (http://www.boost.org) scons (http://www.scons.org) swig 1.3.33 @@ -25,10 +25,11 @@ On the client side, I've only tested with DC++. -- Building -- -Install boost, swig and scons. Ensure that your compiler is available in the +Install swig and scons. Ensure that your compiler is available in the PATH. To build with gcc (*nix, mingw), run "scons" in the adchpp root folder. To build with msvc (windows), run "scons tools=default" in the adchpp root folder. To build a release build, add "mode=release" to the build line. +For additional build options, type "scons -h". -- Command line options -- Modified: adchpp/trunk/swig/SConscript =================================================================== --- adchpp/trunk/swig/SConscript 2007-12-10 20:11:15 UTC (rev 104) +++ adchpp/trunk/swig/SConscript 2007-12-14 15:16:58 UTC (rev 105) @@ -87,7 +87,7 @@ env.Append(CPPPATH=[incpath]) else: env.Append(CPPPATH=[distutils.sysconfig.get_python_inc()]) - env.Append(LIBS=['python2.4']) + env.Append(LIBS=['python' + sys.version[0:3]]) env.Append(LIBS=['adchpp']) wrapper = build_path + 'python_wrap.cc' This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2007-12-14 14:07:55
|
Revision: 941 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=941&view=rev Author: arnetheduck Date: 2007-12-14 06:07:34 -0800 (Fri, 14 Dec 2007) Log Message: ----------- Retry at once if protocol is not supported Modified Paths: -------------- dcplusplus/trunk/dcpp/AdcHub.cpp Modified: dcplusplus/trunk/dcpp/AdcHub.cpp =================================================================== --- dcplusplus/trunk/dcpp/AdcHub.cpp 2007-12-14 10:37:24 UTC (rev 940) +++ dcplusplus/trunk/dcpp/AdcHub.cpp 2007-12-14 14:07:34 UTC (rev 941) @@ -450,6 +450,8 @@ u->getUser()->setFlag(User::NO_ADCS_0_10_PROTOCOL); u->getUser()->unsetFlag(User::TLS); } + // Try again... + ConnectionManager::getInstance()->force(u->getUser()); } } fire(ClientListener::Message(), this, *u, c.getParam(1)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2007-12-14 10:37:28
|
Revision: 940 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=940&view=rev Author: arnetheduck Date: 2007-12-14 02:37:24 -0800 (Fri, 14 Dec 2007) Log Message: ----------- compile fix, some qui flags used Modified Paths: -------------- dcplusplus/trunk/changelog.txt dcplusplus/trunk/dcpp/AdcHub.cpp dcplusplus/trunk/win32/WaitingUsersFrame.cpp Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2007-12-13 22:28:47 UTC (rev 939) +++ dcplusplus/trunk/changelog.txt 2007-12-14 10:37:24 UTC (rev 940) @@ -30,6 +30,7 @@ * Page up/down in private chat scrolls chat log just as in hub chat * Fixed crash on right-click in the download queue (poy) * Readded waiting users frame keyboard shortcut +* Handle some QUI flags (thanks pret/poy) -- 0.703 2007-11-08 -- * Fixed invalid strings (thanks james ross) Modified: dcplusplus/trunk/dcpp/AdcHub.cpp =================================================================== --- dcplusplus/trunk/dcpp/AdcHub.cpp 2007-12-13 22:28:47 UTC (rev 939) +++ dcplusplus/trunk/dcpp/AdcHub.cpp 2007-12-14 10:37:24 UTC (rev 940) @@ -263,12 +263,26 @@ void AdcHub::handle(AdcCommand::QUI, AdcCommand& c) throw() { uint32_t s = AdcCommand::toSID(c.getParam(0)); - putUser(s); - - // No use to hammer if we're banned - if(s == sid && c.hasFlag("TL", 1)) { - setAutoReconnect(false); + putUser(s); // @todo: use the DI flag + + string tmp; + if(c.getParam("MS", 1, tmp)) { + fire(ClientListener::StatusMessage(), this, tmp); } + + if(s == sid) { + if(c.getParam("TL", 1, tmp)) { + if(tmp == "-1") { + setAutoReconnect(false); + } else { + setAutoReconnect(true); + setReconnDelay(Util::toUInt32(tmp)); + } + } + if(c.getParam("RD", 1, tmp)) { + fire(ClientListener::Redirect(), this, tmp); + } + } } void AdcHub::handle(AdcCommand::CTM, AdcCommand& c) throw() { Modified: dcplusplus/trunk/win32/WaitingUsersFrame.cpp =================================================================== --- dcplusplus/trunk/win32/WaitingUsersFrame.cpp 2007-12-13 22:28:47 UTC (rev 939) +++ dcplusplus/trunk/win32/WaitingUsersFrame.cpp 2007-12-14 10:37:24 UTC (rev 940) @@ -192,9 +192,9 @@ } // Keyboard shortcuts -bool WaitingUsersFrame::onChar(int c) { +bool WaitingUsersFrame::handleChar(int c) { if(c == VK_DELETE) { - onRemove(0, 0, 0, bHandled); + onRemove(); return true; } return false; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2007-12-13 22:28:48
|
Revision: 939 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=939&view=rev Author: arnetheduck Date: 2007-12-13 14:28:47 -0800 (Thu, 13 Dec 2007) Log Message: ----------- Remove some cruft Modified Paths: -------------- dcplusplus/trunk/changelog.txt dcplusplus/trunk/win32/HubFrame.cpp dcplusplus/trunk/win32/MainWindow.h dcplusplus/trunk/win32/WaitingUsersFrame.cpp dcplusplus/trunk/win32/WaitingUsersFrame.h Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2007-12-13 20:32:16 UTC (rev 938) +++ dcplusplus/trunk/changelog.txt 2007-12-13 22:28:47 UTC (rev 939) @@ -29,6 +29,7 @@ * Fixed state checks for uploads (an invalid sequence could possibly crash client from remote) * Page up/down in private chat scrolls chat log just as in hub chat * Fixed crash on right-click in the download queue (poy) +* Readded waiting users frame keyboard shortcut -- 0.703 2007-11-08 -- * Fixed invalid strings (thanks james ross) Modified: dcplusplus/trunk/win32/HubFrame.cpp =================================================================== --- dcplusplus/trunk/win32/HubFrame.cpp 2007-12-13 20:32:16 UTC (rev 938) +++ dcplusplus/trunk/win32/HubFrame.cpp 2007-12-13 22:28:47 UTC (rev 939) @@ -1198,17 +1198,6 @@ layout(); } -#ifdef PORT_ME - -LRESULT HubFrame::OnForwardMsg(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/) { - LPMSG pMsg = (LPMSG)lParam; - if((pMsg->message >= WM_MOUSEFIRST) && (pMsg->message <= WM_MOUSELAST)) - ctrlLastLines.RelayEvent(pMsg); - return 0; -} - -#endif - void HubFrame::handleCopyNick() { int i=-1; string nicks; @@ -1234,64 +1223,6 @@ } } -#ifdef PORT_ME -static const COLORREF RED = RGB(255, 0, 0); -static const COLORREF GREEN = RGB(0, 255, 0); - -LRESULT HubFrame::onLButton(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { - HWND focus = GetFocus(); - bHandled = false; - if(focus == ctrlClient.m_hWnd) { - POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; - tstring x; - tstring::size_type start = (tstring::size_type)WinUtil::textUnderCursor(pt, ctrlClient, x); - tstring::size_type end = x.find(_T(" "), start); - - if(end == tstring::npos) - end = x.length(); - - bHandled = WinUtil::parseDBLClick(x, start, end); - if (!bHandled) { - string::size_type end = x.find_first_of(_T(" >\t"), start+1); - - if(end == tstring::npos) // get EOL as well - end = x.length(); - else if(end == start + 1) - return 0; - - // Nickname click, let's see if we can find one like it in the name list... - tstring nick = x.substr(start, end - start); - UserInfo* ui = findUser(nick); - if(ui) { - bHandled = true; - if (wParam & MK_CONTROL) { // MK_CONTROL = 0x0008 - PrivateFrame::openWindow(ui->user); - } else if (wParam & MK_SHIFT) { - try { - QueueManager::getInstance()->addList(ui->user, QueueItem::FLAG_CLIENT_VIEW); - } catch(const Exception& e) { - addClientLine(Text::toT(e.getError())); - } - } else if(showUsers->getChecked()) { - int items = ctrlUsers.GetItemCount(); - int pos = -1; - ctrlUsers.SetRedraw(FALSE); - for(int i = 0; i < items; ++i) { - if(ctrlUsers.getData(i) == ui) - pos = i; - ctrlUsers.SetItemState(i, (i == pos) ? LVIS_SELECTED | LVIS_FOCUSED : 0, LVIS_SELECTED | LVIS_FOCUSED); - } - ctrlUsers.SetRedraw(TRUE); - ctrlUsers.EnsureVisible(pos, FALSE); - } - } - } - } - return 0; -} - -#endif - void HubFrame::runUserCommand(const UserCommand& uc) { if(!WinUtil::getUCParams(this, uc, ucLineParams)) return; @@ -1448,23 +1379,6 @@ } } -#ifdef PORT_ME -LRESULT HubFrame::onGetToolTip(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/) { - NMTTDISPINFO* nm = (NMTTDISPINFO*)pnmh; - lastLines.clear(); - for(TStringIter i = lastLinesList.begin(); i != lastLinesList.end(); ++i) { - lastLines += *i; - lastLines += _T("\r\n"); - } - if(lastLines.size() > 2) { - lastLines.erase(lastLines.size() - 2); - } - nm->lpszText = const_cast<TCHAR*>(lastLines.c_str()); - return 0; -} - -#endif - void HubFrame::resortUsers() { for(FrameIter i = frames.begin(); i != frames.end(); ++i) (*i)->resortForFavsFirst(true); Modified: dcplusplus/trunk/win32/MainWindow.h =================================================================== --- dcplusplus/trunk/win32/MainWindow.h 2007-12-13 20:32:16 UTC (rev 938) +++ dcplusplus/trunk/win32/MainWindow.h 2007-12-13 22:28:47 UTC (rev 939) @@ -200,46 +200,6 @@ virtual void on(QueueManagerListener::Finished, QueueItem* qi, const string& dir, int64_t speed) throw(); virtual void on(PartialList, const UserPtr&, const string& text) throw(); -#ifdef PORT_ME - - virtual BOOL PreTranslateMessage(MSG* pMsg) - { - if((pMsg->message >= WM_MOUSEFIRST) && (pMsg->message <= WM_MOUSELAST)) - ctrlLastLines.RelayEvent(pMsg); - - if(CMDIFrameWindowImpl<MainFrame>::PreTranslateMessage(pMsg)) - return TRUE; - - HWND hWnd = MDIGetActive(); - if(hWnd != NULL) - return (BOOL)::SendMessage(hWnd, WM_FORWARDMSG, 0, (LPARAM)pMsg); - - return FALSE; - } - - BEGIN_MSG_MAP(MainFrame) - NOTIFY_CODE_HANDLER(TTN_GETDISPINFO, onGetToolTip) - END_MSG_MAP() - - LRESULT OnViewStatusBar(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/); - LRESULT OnViewToolBar(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/); - LRESULT OnViewTransferView(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/); - LRESULT onCloseWindows(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/); - LRESULT onServerSocket(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); - - LRESULT onTrayQuit(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { - PostMessage(WM_CLOSE); - return 0; - } - - LRESULT onTrayShow(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { - ShowWindow(SW_SHOW); - ShowWindow(maximized ? SW_MAXIMIZE : SW_RESTORE); - return 0; - } - -#endif - }; #endif // !defined(MAIN_FRM_H) Modified: dcplusplus/trunk/win32/WaitingUsersFrame.cpp =================================================================== --- dcplusplus/trunk/win32/WaitingUsersFrame.cpp 2007-12-13 20:32:16 UTC (rev 938) +++ dcplusplus/trunk/win32/WaitingUsersFrame.cpp 2007-12-13 22:28:47 UTC (rev 939) @@ -40,6 +40,7 @@ addWidget(queued); queued->setColor(WinUtil::textColor, WinUtil::bgColor); queued->onContextMenu(std::tr1::bind(&WaitingUsersFrame::handleContextMenu, this, _1)); + queued->onChar(std::tr1::bind(&WaitingUsersFrame::handleChar, this, _1)); } initStatus(); @@ -190,24 +191,15 @@ speak(SPEAK_ADD_FILE, (LPARAM)new pair<UserPtr, string>(aUser, aFilename)); } -#ifdef PORT_ME - // Keyboard shortcuts -LRESULT WaitingUsersFrame::onChar(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) -{ - switch(wParam) - { - case VK_DELETE: +bool WaitingUsersFrame::onChar(int c) { + if(c == VK_DELETE) { onRemove(0, 0, 0, bHandled); - break; - default: - bHandled = FALSE; + return true; } - return 0; + return false; } -#endif - void WaitingUsersFrame::onRemoveUser(const UserPtr& aUser) { HTREEITEM userNode = queued->getRoot(); Modified: dcplusplus/trunk/win32/WaitingUsersFrame.h =================================================================== --- dcplusplus/trunk/win32/WaitingUsersFrame.h 2007-12-13 20:32:16 UTC (rev 938) +++ dcplusplus/trunk/win32/WaitingUsersFrame.h 2007-12-13 22:28:47 UTC (rev 939) @@ -58,7 +58,7 @@ void onRemove(); bool handleContextMenu(SmartWin::ScreenCoordinate pt); HRESULT handleSpeaker(WPARAM wParam, LPARAM lParam); - //LRESULT onChar(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled); + bool handleChar(int c); void onPrivateMessage(); void onGrantSlot(); void onAddToFavorites(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2007-12-13 20:32:17
|
Revision: 938 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=938&view=rev Author: arnetheduck Date: 2007-12-13 12:32:16 -0800 (Thu, 13 Dec 2007) Log Message: ----------- advertise base support Modified Paths: -------------- dcplusplus/trunk/dcpp/AdcHub.cpp dcplusplus/trunk/dcpp/ConnectionManager.cpp Modified: dcplusplus/trunk/dcpp/AdcHub.cpp =================================================================== --- dcplusplus/trunk/dcpp/AdcHub.cpp 2007-12-13 20:15:27 UTC (rev 937) +++ dcplusplus/trunk/dcpp/AdcHub.cpp 2007-12-13 20:32:16 UTC (rev 938) @@ -208,7 +208,7 @@ return; } else if(!tigrOk) { oldPassword = true; - // What now? Some hubs fake BASE support without TIGR support =/ + // Some hubs fake BASE support without TIGR support =/ fire(ClientListener::StatusMessage(), this, "Hub probably uses an old version of ADC, please encourage the owner to upgrade"); } } @@ -292,7 +292,7 @@ token = tok; } } else { - // <= 0.703 would send an empty token for passive connections... + // <= 0.703 would send an empty token for passive connections when replying to RCM } bool secure = false; @@ -678,7 +678,7 @@ sid = 0; AdcCommand cmd(AdcCommand::CMD_SUP, AdcCommand::TYPE_HUB); - cmd.addParam(BAS0_SUPPORT).addParam(TIGR_SUPPORT); + cmd.addParam(BAS0_SUPPORT).addParam(BASE_SUPPORT).addParam(TIGR_SUPPORT); if(BOOLSETTING(HUB_USER_COMMANDS)) { cmd.addParam(UCM0_SUPPORT); Modified: dcplusplus/trunk/dcpp/ConnectionManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/ConnectionManager.cpp 2007-12-13 20:15:27 UTC (rev 937) +++ dcplusplus/trunk/dcpp/ConnectionManager.cpp 2007-12-13 20:32:16 UTC (rev 938) @@ -43,6 +43,7 @@ features.push_back(UserConnection::FEATURE_TTHF); adcFeatures.push_back("AD" + UserConnection::FEATURE_ADC_BAS0); + adcFeatures.push_back("AD" + UserConnection::FEATURE_ADC_BASE); adcFeatures.push_back("AD" + UserConnection::FEATURE_ADC_TIGR); adcFeatures.push_back("AD" + UserConnection::FEATURE_ADC_BZIP); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2007-12-13 20:15:34
|
Revision: 937 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=937&view=rev Author: arnetheduck Date: 2007-12-13 12:15:27 -0800 (Thu, 13 Dec 2007) Log Message: ----------- Fix some connectivity issues, fix download moving Modified Paths: -------------- dcplusplus/trunk/changelog.txt dcplusplus/trunk/dcpp/AdcHub.cpp dcplusplus/trunk/dcpp/ConnectionManager.cpp dcplusplus/trunk/dcpp/Download.cpp dcplusplus/trunk/dcpp/DownloadManager.cpp dcplusplus/trunk/dcpp/QueueManager.cpp dcplusplus/trunk/dcpp/UserConnection.cpp Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2007-12-12 19:28:12 UTC (rev 936) +++ dcplusplus/trunk/changelog.txt 2007-12-13 20:15:27 UTC (rev 937) @@ -7,7 +7,7 @@ * Fixed version info (poy) * Keep selection visible on move up/down in some list views (poy) * Fixed clicking in the header of the favorite hubs list view (poy) -* Update to ADC 1.0 +* Update most things to ADC 1.0 * Fixed pressing enter in the notepad (poy) * Fixed user commands params (poy) * Readded list view double buffering (thanks poy) Modified: dcplusplus/trunk/dcpp/AdcHub.cpp =================================================================== --- dcplusplus/trunk/dcpp/AdcHub.cpp 2007-12-12 19:28:12 UTC (rev 936) +++ dcplusplus/trunk/dcpp/AdcHub.cpp 2007-12-13 20:15:27 UTC (rev 937) @@ -275,20 +275,26 @@ OnlineUser* u = findUser(c.getFrom()); if(!u || u->getUser() == ClientManager::getInstance()->getMe()) return; - if(c.getParameters().size() < 3) + if(c.getParameters().size() < 2) return; const string& protocol = c.getParam(0); const string& port = c.getParam(1); - + string token; - bool hasToken = c.getParam("TO", 2, token); - - if(!hasToken) { - // @todo remove this bugfix for <=0.698 some time - token = c.getParam(2); + if(c.getParameters().size() == 3) { + const string& tok = c.getParam(2); + + // 0.699 put TO before the token, keep this bug fix for a while + if(tok.compare(0, 2, "TO") == 0) { + token = tok.substr(2); + } else { + token = tok; + } + } else { + // <= 0.703 would send an empty token for passive connections... } - + bool secure = false; if(protocol == CLIENT_PROTOCOL || protocol == CLIENT_PROTOCOL_TEST) { // Nothing special @@ -298,10 +304,8 @@ AdcCommand cmd(AdcCommand::SEV_FATAL, AdcCommand::ERROR_PROTOCOL_UNSUPPORTED, "Protocol unknown", AdcCommand::TYPE_DIRECT); cmd.setTo(c.getFrom()); cmd.addParam("PR", protocol); + cmd.addParam("TO", token); - if(hasToken) - cmd.addParam("TO", token); - send(cmd); return; } @@ -315,7 +319,7 @@ } void AdcHub::handle(AdcCommand::RCM, AdcCommand& c) throw() { - if(c.getParameters().empty()) { + if(c.getParameters().size() < 2) { return; } if(!ClientManager::getInstance()->isActive()) @@ -325,8 +329,14 @@ return; const string& protocol = c.getParam(0); + const string& tok = c.getParam(1); string token; - bool hasToken = c.getParam("TO", 1, token); + // 0.699 sent a token with "TO" prefix + if(tok.compare(0, 2, "TO") == 0) { + token = tok.substr(2); + } else { + token = tok; + } bool secure; if(protocol == CLIENT_PROTOCOL || protocol == CLIENT_PROTOCOL_TEST) { @@ -337,10 +347,8 @@ AdcCommand cmd(AdcCommand::SEV_FATAL, AdcCommand::ERROR_PROTOCOL_UNSUPPORTED, "Protocol unknown", AdcCommand::TYPE_DIRECT); cmd.setTo(c.getFrom()); cmd.addParam("PR", protocol); + cmd.addParam("TO", token); - if(hasToken) - cmd.addParam("TO", token); - send(cmd); return; } Modified: dcplusplus/trunk/dcpp/ConnectionManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/ConnectionManager.cpp 2007-12-12 19:28:12 UTC (rev 936) +++ dcplusplus/trunk/dcpp/ConnectionManager.cpp 2007-12-13 20:15:27 UTC (rev 937) @@ -634,9 +634,10 @@ ConnectionQueueItem::Iter i = find(downloads.begin(), downloads.end(), aSource->getUser()); if(i != downloads.end()) { - // Last compare for compatibility with pre-0.700 const string& to = (*i)->getToken(); - if(to == token || (to.size() > 2 && to.compare(0, 2, "TO") == 0 && to.compare(2, to.size() - 2, token) == 0)) { + + // 0.698 would send an empty token in some cases...remove this bugfix at some point + if(to == token || token.empty()) { down = true; } } Modified: dcplusplus/trunk/dcpp/Download.cpp =================================================================== --- dcplusplus/trunk/dcpp/Download.cpp 2007-12-12 19:28:12 UTC (rev 936) +++ dcplusplus/trunk/dcpp/Download.cpp 2007-12-13 20:15:27 UTC (rev 937) @@ -85,7 +85,6 @@ Download::~Download() { getUserConnection().setDownload(0); - delete file; } AdcCommand Download::getCommand(bool zlib) { Modified: dcplusplus/trunk/dcpp/DownloadManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/DownloadManager.cpp 2007-12-12 19:28:12 UTC (rev 936) +++ dcplusplus/trunk/dcpp/DownloadManager.cpp 2007-12-13 20:15:27 UTC (rev 937) @@ -489,10 +489,6 @@ } catch(const Exception&) { } } - - if(d->isSet(Download::FLAG_ANTI_FRAG)) { - d->unsetFlag(Download::FLAG_ANTI_FRAG); - } } { Modified: dcplusplus/trunk/dcpp/QueueManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/QueueManager.cpp 2007-12-12 19:28:12 UTC (rev 936) +++ dcplusplus/trunk/dcpp/QueueManager.cpp 2007-12-13 20:15:27 UTC (rev 937) @@ -797,6 +797,9 @@ { Lock l(cs); + delete aDownload->getFile(); + aDownload->setFile(0); + if(aDownload->getType() == Transfer::TYPE_PARTIAL_LIST) { pair<PfsIter, PfsIter> range = pfsQueue.equal_range(aDownload->getUser()->getCID()); PfsIter i = find_if(range.first, range.second, CompareSecond<CID, string>(aDownload->getPath())); @@ -849,9 +852,6 @@ } if(aDownload->getType() != Transfer::TYPE_FILE || q->isFinished()) { - // Delete file here to ensure that move works - delete aDownload->getFile(); - aDownload->setFile(0); // Check if we're anti-fragging... if(aDownload->isSet(Download::FLAG_ANTI_FRAG)) { Modified: dcplusplus/trunk/dcpp/UserConnection.cpp =================================================================== --- dcplusplus/trunk/dcpp/UserConnection.cpp 2007-12-12 19:28:12 UTC (rev 936) +++ dcplusplus/trunk/dcpp/UserConnection.cpp 2007-12-13 20:15:27 UTC (rev 937) @@ -150,12 +150,7 @@ AdcCommand c(AdcCommand::CMD_INF); c.addParam("ID", ClientManager::getInstance()->getMyCID().toBase32()); if(withToken) { - if(getToken().compare(0, 2, "TO") == 0) { - // Compatibility with pre-0.700 - c.addParam(getToken()); - } else { - c.addParam("TO", getToken()); - } + c.addParam("TO", getToken()); } send(c); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <zou...@us...> - 2007-12-12 19:29:21
|
Revision: 936 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=936&view=rev Author: zouzou123gen Date: 2007-12-12 11:28:12 -0800 (Wed, 12 Dec 2007) Log Message: ----------- more focus fixes Modified Paths: -------------- dcplusplus/trunk/win32/MDIChildFrame.h Modified: dcplusplus/trunk/win32/MDIChildFrame.h =================================================================== --- dcplusplus/trunk/win32/MDIChildFrame.h 2007-12-12 14:41:23 UTC (rev 935) +++ dcplusplus/trunk/win32/MDIChildFrame.h 2007-12-12 19:28:12 UTC (rev 936) @@ -97,6 +97,8 @@ if(alwaysFocus || (lastFocus == NULL)) { lastFocus = widget->handle(); + if(this->getVisible()) + ::SetFocus(lastFocus); } if(alwaysFocus) alwaysSameFocus = true; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2007-12-12 14:41:29
|
Revision: 935 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=935&view=rev Author: arnetheduck Date: 2007-12-12 06:41:23 -0800 (Wed, 12 Dec 2007) Log Message: ----------- Clarify patch procedure Modified Paths: -------------- dcplusplus/trunk/Compile.txt Modified: dcplusplus/trunk/Compile.txt =================================================================== --- dcplusplus/trunk/Compile.txt 2007-12-11 20:41:10 UTC (rev 934) +++ dcplusplus/trunk/Compile.txt 2007-12-12 14:41:23 UTC (rev 935) @@ -50,7 +50,7 @@ If you think you've done something that more people could use, you can always submit a patch for inclusion in the original distribution. I will then consider whether I like the patch or not based on things that might seem to be completely random, which just might be the case. Popular reasons for rejecting a patch include, but are not limited to, -ugly code, abusable features, feature that I don't like that bloat the application and incompatibility with other +ugly code, abusable features, features that I don't like that bloat the application and incompatibility with other modifications I've already done. To increase the chances of your patch being accepted, do like this: @@ -58,10 +58,12 @@ 2) Make your modification. If you make other modifications apart from the one you want to submit, do them on a separate copy of the DC++ source code and then copy them to this folder. 3) In the source root folder (the one with this file in it) do "svn diff > my-patch.diff". -4) Post the file in the DC++ bugzilla (don't forget to hand over copyright, see below). +4) Send the patch along with a description to the dcplusplus-devel mailing list (more information here: + http://sourceforge.net/mail/?group_id=40287). Please make sure to include a + copyright handover notice (see below). -By submitting a patch, you agree to that I get copyright of it. This to avoid stupid situations later on where -the copyright is split out over a million people, each of which could stop further distribution of DC++, and also -to make it easier for us to defend the gpl against violators. If you don't like this policy, start your own -distribution, if you're lucky it might become more popular than the original =). Please -state explicitly in the bugzilla that you give me copyright over the code if the submission is larger than trivial. +In order to avoid future licensing issues, I ask you to give me copyright over any submitted code. +If you don't like this policy, you are free to start your own distribution (as +many have done), and if you're lucky it might become more popular than the original =). Please +state explicitly when submitting the patch that you give me copyright over the code if the submission is larger than trivial. + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <zou...@us...> - 2007-12-11 20:41:20
|
Revision: 934 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=934&view=rev Author: zouzou123gen Date: 2007-12-11 12:41:10 -0800 (Tue, 11 Dec 2007) Log Message: ----------- crash on right-click in the download queue Modified Paths: -------------- dcplusplus/trunk/changelog.txt dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetTreeView.h Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2007-12-11 20:00:08 UTC (rev 933) +++ dcplusplus/trunk/changelog.txt 2007-12-11 20:41:10 UTC (rev 934) @@ -28,6 +28,7 @@ * Fixed a multisource download crash * Fixed state checks for uploads (an invalid sequence could possibly crash client from remote) * Page up/down in private chat scrolls chat log just as in hub chat +* Fixed crash on right-click in the download queue (poy) -- 0.703 2007-11-08 -- * Fixed invalid strings (thanks james ross) Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetTreeView.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetTreeView.h 2007-12-11 20:00:08 UTC (rev 933) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetTreeView.h 2007-12-11 20:41:10 UTC (rev 934) @@ -349,7 +349,8 @@ inline HTREEITEM WidgetTreeView::hitTest(const ScreenCoordinate& pt) { ClientCoordinate cc(pt, this); - return TreeView_HitTest(this->handle(), &cc.getPoint()); + TVHITTESTINFO tvhti = { cc.getPoint() }; + return TreeView_HitTest(this->handle(), &tvhti); } inline HTREEITEM WidgetTreeView::getSelection() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2007-12-11 20:00:10
|
Revision: 933 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=933&view=rev Author: arnetheduck Date: 2007-12-11 12:00:08 -0800 (Tue, 11 Dec 2007) Log Message: ----------- fix adc protocol order, chat focus, pageup/down in private frame Modified Paths: -------------- dcplusplus/trunk/changelog.txt dcplusplus/trunk/dcpp/AdcHub.cpp dcplusplus/trunk/win32/MDIChildFrame.h dcplusplus/trunk/win32/PrivateFrame.cpp Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2007-12-11 18:25:18 UTC (rev 932) +++ dcplusplus/trunk/changelog.txt 2007-12-11 20:00:08 UTC (rev 933) @@ -27,6 +27,7 @@ * Fixed protocol error STA being sent as type C * Fixed a multisource download crash * Fixed state checks for uploads (an invalid sequence could possibly crash client from remote) +* Page up/down in private chat scrolls chat log just as in hub chat -- 0.703 2007-11-08 -- * Fixed invalid strings (thanks james ross) Modified: dcplusplus/trunk/dcpp/AdcHub.cpp =================================================================== --- dcplusplus/trunk/dcpp/AdcHub.cpp 2007-12-11 18:25:18 UTC (rev 932) +++ dcplusplus/trunk/dcpp/AdcHub.cpp 2007-12-11 20:00:08 UTC (rev 933) @@ -469,14 +469,15 @@ proto = &SECURE_CLIENT_PROTOCOL_TEST; } else { // dc++ <= 0.703 has a bug which makes it respond with CSTA to the hub if an unrecognised protocol is used *sigh* - if(true || user.getUser()->isSet(User::NO_ADC_1_0_PROTOCOL)) { - if(user.getUser()->isSet(User::NO_ADC_0_10_PROTOCOL)) { + // so we try 0.10 first... + if(user.getUser()->isSet(User::NO_ADC_0_10_PROTOCOL)) { + if(user.getUser()->isSet(User::NO_ADC_1_0_PROTOCOL)) { /// @todo log return; } + proto = &CLIENT_PROTOCOL; + } else { proto = &CLIENT_PROTOCOL_TEST; - } else { - proto = &CLIENT_PROTOCOL; } } Modified: dcplusplus/trunk/win32/MDIChildFrame.h =================================================================== --- dcplusplus/trunk/win32/MDIChildFrame.h 2007-12-11 18:25:18 UTC (rev 932) +++ dcplusplus/trunk/win32/MDIChildFrame.h 2007-12-11 20:00:08 UTC (rev 933) @@ -97,7 +97,6 @@ if(alwaysFocus || (lastFocus == NULL)) { lastFocus = widget->handle(); - ::SetFocus(lastFocus); } if(alwaysFocus) alwaysSameFocus = true; Modified: dcplusplus/trunk/win32/PrivateFrame.cpp =================================================================== --- dcplusplus/trunk/win32/PrivateFrame.cpp 2007-12-11 18:25:18 UTC (rev 932) +++ dcplusplus/trunk/win32/PrivateFrame.cpp 2007-12-11 20:00:08 UTC (rev 933) @@ -145,8 +145,8 @@ } line += aLine; - int limit = chat->getTextLimit(); - if(chat->length() + static_cast<int>(line.size()) > limit) { + size_t limit = chat->getTextLimit(); + if(chat->length() + line.size() > limit) { HoldRedraw hold(chat); chat->setSelection(0, chat->lineIndex(chat->lineFromChar(limit / 10))); chat->replaceSelection(_T("")); @@ -336,8 +336,14 @@ bool PrivateFrame::handleKeyDown(int c) { if(c == VK_RETURN && enter()) { return true; + } else if(c == VK_PRIOR) { // page up + chat->sendMessage(WM_VSCROLL, SB_PAGEUP); + return true; + } else if(c == VK_NEXT) { // page down + chat->sendMessage(WM_VSCROLL, SB_PAGEDOWN); + return true; } - + return false; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <zou...@us...> - 2007-12-11 18:25:25
|
Revision: 932 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=932&view=rev Author: zouzou123gen Date: 2007-12-11 10:25:18 -0800 (Tue, 11 Dec 2007) Log Message: ----------- fix DirectoryListingFrame's status bar Modified Paths: -------------- dcplusplus/trunk/win32/DirectoryListingFrame.cpp Modified: dcplusplus/trunk/win32/DirectoryListingFrame.cpp =================================================================== --- dcplusplus/trunk/win32/DirectoryListingFrame.cpp 2007-12-11 17:07:20 UTC (rev 931) +++ dcplusplus/trunk/win32/DirectoryListingFrame.cpp 2007-12-11 18:25:18 UTC (rev 932) @@ -204,7 +204,7 @@ error = WinUtil::getNicks(dl->getUser()) + Text::toT(": " + e.getError()); } - initStatus(); + initStatusText(); } void DirectoryListingFrame::loadXML(const string& txt) { @@ -214,16 +214,9 @@ error = WinUtil::getNicks(dl->getUser()) + Text::toT(": " + e.getError()); } - initStatus(); + initStatusText(); } - -void DirectoryListingFrame::initStatusText() { - setStatus(STATUS_TOTAL_FILES, Text::toT(STRING(FILES) + ": " + Util::toString(dl->getTotalFileCount(true)))); - setStatus(STATUS_TOTAL_SIZE, Text::toT(STRING(SIZE) + ": " + Util::formatBytes(dl->getTotalSize(true)))); - setStatus(STATUS_SPEED, Text::toT(STRING(SPEED) + ": " + Util::formatBytes(speed) + "/s")); -} - void DirectoryListingFrame::layout() { SmartWin::Rectangle r(getClientAreaSize()); @@ -271,7 +264,7 @@ dirList.loadFile(Text::fromT(file)); dl->getRoot()->filterList(dirList); refreshTree(Util::emptyStringT); - initStatus(); + initStatusText(); updateStatus(); } catch(const Exception&) { /// @todo report to user? @@ -533,7 +526,7 @@ } } } catch(const Exception& e) { - setStatus(STATUS_STATUS, Text::toT(e.getError()).c_str()); + setStatus(STATUS_STATUS, Text::toT(e.getError())); } } else { tstring target = Text::toT(SETTING(DOWNLOAD_DIRECTORY)); @@ -577,7 +570,7 @@ try { dl->download(ii->file, target, false, WinUtil::isShift()); } catch(const Exception& e) { - setStatus(STATUS_STATUS, Text::toT(e.getError()).c_str()); + setStatus(STATUS_STATUS, Text::toT(e.getError())); } } @@ -658,6 +651,12 @@ } } +void DirectoryListingFrame::initStatusText() { + setStatus(STATUS_TOTAL_FILES, Text::toT(STRING(FILES) + ": " + Util::toString(dl->getTotalFileCount(true)))); + setStatus(STATUS_TOTAL_SIZE, Text::toT(STRING(SIZE) + ": " + Util::formatBytes(dl->getTotalSize(true)))); + setStatus(STATUS_SPEED, Text::toT(STRING(SPEED) + ": " + Util::formatBytes(speed) + "/s")); +} + void DirectoryListingFrame::updateStatus() { if(!searching && !updating) { int cnt = files->getSelectedCount(); @@ -669,11 +668,9 @@ total = files->forEachSelectedT(ItemInfo::TotalSize()).total; } - tstring tmp = Text::toT(STRING(ITEMS) + ": " + Util::toString(cnt)); - setStatus(STATUS_SELECTED_FILES, tmp.c_str()); + setStatus(STATUS_SELECTED_FILES, Text::toT(STRING(ITEMS) + ": " + Util::toString(cnt))); - tmp = Text::toT(STRING(SIZE) + ": " + Util::formatBytes(total)); - setStatus(STATUS_SELECTED_SIZE, tmp.c_str()); + setStatus(STATUS_SELECTED_SIZE, Text::toT(STRING(SIZE) + ": " + Util::formatBytes(total))); } } @@ -710,12 +707,12 @@ if(dl->getUser()->isOnline()) { try { QueueManager::getInstance()->addPfs(dl->getUser(), dl->getPath(d)); - setStatus(STATUS_STATUS, CTSTRING(DOWNLOADING_LIST)); + setStatus(STATUS_STATUS, TSTRING(DOWNLOADING_LIST)); } catch(const QueueException& e) { - setStatus(STATUS_STATUS, Text::toT(e.getError()).c_str()); + setStatus(STATUS_STATUS, Text::toT(e.getError())); } } else { - setStatus(STATUS_STATUS, CTSTRING(USER_OFFLINE)); + setStatus(STATUS_STATUS, TSTRING(USER_OFFLINE)); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2007-12-11 17:07:29
|
Revision: 931 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=931&view=rev Author: arnetheduck Date: 2007-12-11 09:07:20 -0800 (Tue, 11 Dec 2007) Log Message: ----------- fix state issues Modified Paths: -------------- dcplusplus/trunk/changelog.txt dcplusplus/trunk/dcpp/ConnectionManager.cpp dcplusplus/trunk/dcpp/DownloadManager.cpp dcplusplus/trunk/dcpp/UploadManager.cpp dcplusplus/trunk/dcpp/version.h dcplusplus/trunk/win32/DCPlusPlus.rc Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2007-12-10 22:30:37 UTC (rev 930) +++ dcplusplus/trunk/changelog.txt 2007-12-11 17:07:20 UTC (rev 931) @@ -26,6 +26,7 @@ * Fixed status bars (poy) * Fixed protocol error STA being sent as type C * Fixed a multisource download crash +* Fixed state checks for uploads (an invalid sequence could possibly crash client from remote) -- 0.703 2007-11-08 -- * Fixed invalid strings (thanks james ross) Modified: dcplusplus/trunk/dcpp/ConnectionManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/ConnectionManager.cpp 2007-12-10 22:30:37 UTC (rev 930) +++ dcplusplus/trunk/dcpp/ConnectionManager.cpp 2007-12-11 17:07:20 UTC (rev 931) @@ -323,7 +323,7 @@ void ConnectionManager::on(AdcCommand::SUP, UserConnection* aSource, const AdcCommand& cmd) throw() { if(aSource->getState() != UserConnection::STATE_SUPNICK) { // Already got this once, ignore...@todo fix support updates - dcdebug("CM::onMyNick %p sent nick twice\n", (void*)aSource); + dcdebug("CM::onSUP %p sent sup twice\n", (void*)aSource); return; } @@ -375,7 +375,7 @@ aSource->setState(UserConnection::STATE_INF); } -void ConnectionManager::on(AdcCommand::STA, UserConnection*, const AdcCommand&) throw() { +void ConnectionManager::on(AdcCommand::STA, UserConnection*, const AdcCommand& cmd) throw() { } @@ -595,9 +595,7 @@ void ConnectionManager::on(AdcCommand::INF, UserConnection* aSource, const AdcCommand& cmd) throw() { if(aSource->getState() != UserConnection::STATE_INF) { - // Already got this once, ignore... aSource->send(AdcCommand(AdcCommand::SEV_FATAL, AdcCommand::ERROR_PROTOCOL_GENERIC, "Expecting INF")); - dcdebug("CM::onINF %p sent INF twice\n", (void*)aSource); aSource->disconnect(); return; } Modified: dcplusplus/trunk/dcpp/DownloadManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/DownloadManager.cpp 2007-12-10 22:30:37 UTC (rev 930) +++ dcplusplus/trunk/dcpp/DownloadManager.cpp 2007-12-11 17:07:20 UTC (rev 931) @@ -515,7 +515,7 @@ } const string& err = cmd.getParameters()[0]; - if(err.length() < 3) { + if(err.length() != 3) { aSource->disconnect(); return; } @@ -533,6 +533,10 @@ noSlots(aSource); return; } + case AdcCommand::SEV_SUCCESS: + // We don't know any messages that would give us these... + dcdebug("Unknown success message %s %s", err.c_str(), cmd.getParam(1).c_str()); + return; } aSource->disconnect(); } Modified: dcplusplus/trunk/dcpp/UploadManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/UploadManager.cpp 2007-12-10 22:30:37 UTC (rev 930) +++ dcplusplus/trunk/dcpp/UploadManager.cpp 2007-12-11 17:07:20 UTC (rev 931) @@ -280,6 +280,11 @@ } void UploadManager::on(AdcCommand::GET, UserConnection* aSource, const AdcCommand& c) throw() { + if(aSource->getState() != UserConnection::STATE_GET) { + dcdebug("UM::onGET Bad state, ignoring\n"); + return; + } + const string& type = c.getParam(0); const string& fname = c.getParam(1); int64_t aStartPos = Util::toInt64(c.getParam(2)); @@ -454,6 +459,11 @@ } void UploadManager::on(AdcCommand::GFI, UserConnection* aSource, const AdcCommand& c) throw() { + if(aSource->getState() != UserConnection::STATE_GET) { + dcdebug("UM::onSend Bad state, ignoring\n"); + return; + } + if(c.getParameters().size() < 2) { aSource->send(AdcCommand(AdcCommand::SEV_RECOVERABLE, AdcCommand::ERROR_PROTOCOL_GENERIC, "Missing parameters")); return; Modified: dcplusplus/trunk/dcpp/version.h =================================================================== --- dcplusplus/trunk/dcpp/version.h 2007-12-10 22:30:37 UTC (rev 930) +++ dcplusplus/trunk/dcpp/version.h 2007-12-11 17:07:20 UTC (rev 931) @@ -17,7 +17,7 @@ */ #define APPNAME "DC++" -#define VERSIONSTRING "0.703" -#define VERSIONFLOAT 0.703 +#define VERSIONSTRING "0.704" +#define VERSIONFLOAT 0.704 /* Update the .rc file as well... */ Modified: dcplusplus/trunk/win32/DCPlusPlus.rc =================================================================== --- dcplusplus/trunk/win32/DCPlusPlus.rc 2007-12-10 22:30:37 UTC (rev 930) +++ dcplusplus/trunk/win32/DCPlusPlus.rc 2007-12-11 17:07:20 UTC (rev 931) @@ -818,8 +818,8 @@ // VS_VERSION_INFO VERSIONINFO - FILEVERSION 0,7,0,3 - PRODUCTVERSION 0,7,0,3 + FILEVERSION 0,7,0,4 + PRODUCTVERSION 0,7,0,4 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -836,12 +836,12 @@ BEGIN VALUE "Comments", "http://dcplusplus.sourceforge.net" VALUE "FileDescription", "DC++" - VALUE "FileVersion", "0, 7, 0, 3" + VALUE "FileVersion", "0, 7, 0, 4" VALUE "InternalName", "DC++" VALUE "LegalCopyright", "Copyright 2001-2006 Jacek Sieka" VALUE "OriginalFilename", "DCPlusPlus.exe" VALUE "ProductName", "DC++" - VALUE "ProductVersion", "0, 7, 0, 3" + VALUE "ProductVersion", "0, 7, 0, 4" END END BLOCK "VarFileInfo" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2007-12-10 22:30:41
|
Revision: 930 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=930&view=rev Author: arnetheduck Date: 2007-12-10 14:30:37 -0800 (Mon, 10 Dec 2007) Log Message: ----------- fix file moving Modified Paths: -------------- dcplusplus/trunk/dcpp/QueueManager.cpp Modified: dcplusplus/trunk/dcpp/QueueManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/QueueManager.cpp 2007-12-09 22:06:36 UTC (rev 929) +++ dcplusplus/trunk/dcpp/QueueManager.cpp 2007-12-10 22:30:37 UTC (rev 930) @@ -849,6 +849,10 @@ } if(aDownload->getType() != Transfer::TYPE_FILE || q->isFinished()) { + // Delete file here to ensure that move works + delete aDownload->getFile(); + aDownload->setFile(0); + // Check if we're anti-fragging... if(aDownload->isSet(Download::FLAG_ANTI_FRAG)) { // Ok, rename the file to what we expect it to be... This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2007-12-10 20:11:16
|
Revision: 104 http://adchpp.svn.sourceforge.net/adchpp/?rev=104&view=rev Author: arnetheduck Date: 2007-12-10 12:11:15 -0800 (Mon, 10 Dec 2007) Log Message: ----------- More scons fixes Modified Paths: -------------- adchpp/trunk/swig/SConscript Modified: adchpp/trunk/swig/SConscript =================================================================== --- adchpp/trunk/swig/SConscript 2007-12-10 12:04:03 UTC (rev 103) +++ adchpp/trunk/swig/SConscript 2007-12-10 20:11:15 UTC (rev 104) @@ -82,12 +82,8 @@ libpath = os.path.join(pyprefix, "libs") version = '25' # We only support 2.5.x for now - if 'mingw' in env['TOOLS']: - sources += [File(os.path.join(libpath, "python" + version + ".lib"))] - env.Append(LIBS=['msvcr71']) - else: - env.Append(LIBPATH=[libpath]) - env.Append(LIBS=["python"+version]) + env.Append(LIBPATH=[libpath]) + env.Append(LIBS=["python"+version, "msvcr71"]) env.Append(CPPPATH=[incpath]) else: env.Append(CPPPATH=[distutils.sysconfig.get_python_inc()]) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2007-12-10 12:04:10
|
Revision: 103 http://adchpp.svn.sourceforge.net/adchpp/?rev=103&view=rev Author: arnetheduck Date: 2007-12-10 04:04:03 -0800 (Mon, 10 Dec 2007) Log Message: ----------- more compile experiments Modified Paths: -------------- adchpp/trunk/SConstruct adchpp/trunk/swig/SConscript Modified: adchpp/trunk/SConstruct =================================================================== --- adchpp/trunk/SConstruct 2007-12-10 11:00:24 UTC (rev 102) +++ adchpp/trunk/SConstruct 2007-12-10 12:04:03 UTC (rev 103) @@ -54,7 +54,7 @@ # --- cut --- -import os,sys +import os,sys,distutils.sysconfig plugins = filter(lambda x: os.path.isfile(os.path.join('plugins', x, 'SConscript')), os.listdir('plugins')) @@ -73,10 +73,10 @@ BoolOption('verbose', 'Show verbose command lines', 'no'), BoolOption('savetemps', 'Save intermediate compilation files (assembly output)', 'no'), BoolOption('nls', 'Build with internationalization support', 'yes'), - ('prefix', 'Prefix to use when cross compiling', 'i386-mingw32-') + ('prefix', 'Prefix to use when cross compiling', 'i386-mingw32-'), + ('python', 'Python path to use when compiling python extensions', distutils.sysconfig.get_config_var('prefix')) ) - tools = ARGUMENTS.get('tools', tooldef) toolset = [tools, 'swig'] Modified: adchpp/trunk/swig/SConscript =================================================================== --- adchpp/trunk/swig/SConscript 2007-12-10 11:00:24 UTC (rev 102) +++ adchpp/trunk/swig/SConscript 2007-12-10 12:04:03 UTC (rev 103) @@ -1,3 +1,5 @@ +# vim: set filetype: py + Import('dev source_path') targets = [] @@ -60,36 +62,38 @@ def buildPyModule(): import sys - if dev.is_win32() and sys.platform != 'win32': - print "Cross-compiling python module not supported" - return env, target, sources = dev.prepare_build(source_path, '_pyadchpp', 'python.i') env.Append(SWIGFLAGS=['-c++','-threads','-Wall','-python', '-O', '-classic']) - import distutils.sysconfig,distutils.cygwinccompiler + import distutils.sysconfig - env.Append(CPPPATH=['#', distutils.sysconfig.get_python_inc()]) + env.Append(CPPPATH=['#']) if '_DEBUG' in env['CPPDEFINES']: env['CPPDEFINES'].remove('_DEBUG') if '/MDd' in env['CCFLAGS']: env['CCFLAGS'].remove('/MDd') env['CCFLAGS'].append('/MD') - if 'mingw' in env['TOOLS']: - compiler = distutils.cygwinccompiler.Mingw32CCompiler() - env.Append(LIBS=compiler.dll_libraries) + import os,distutils,sys + if dev.is_win32(): + pyprefix = env['python'] + incpath = os.path.join(pyprefix, "include") + libpath = os.path.join(pyprefix, "libs") + version = '25' # We only support 2.5.x for now - import os,distutils,sys - if env['PLATFORM'] == 'win32': if 'mingw' in env['TOOLS']: - env.Append(LIBPATH=[distutils.sysconfig.get_config_var('prefix')]) + sources += [File(os.path.join(libpath, "python" + version + ".lib"))] + env.Append(LIBS=['msvcr71']) else: - env.Append(LIBPATH=[os.path.join(distutils.sysconfig.get_config_var('prefix'),"libs")]) - env.Append(LIBS=["python"+"".join(sys.version[0:3].split(".")), 'adchpp']) + env.Append(LIBPATH=[libpath]) + env.Append(LIBS=["python"+version]) + env.Append(CPPPATH=[incpath]) else: - env.Append(LIBS=['python2.4', 'adchpp']) + env.Append(CPPPATH=[distutils.sysconfig.get_python_inc()]) + env.Append(LIBS=['python2.4']) + env.Append(LIBS=['adchpp']) wrapper = build_path + 'python_wrap.cc' pyfile = build_path + 'pyadchpp.py' pytarget = dev.get_target(source_path, 'pyadchpp.py') @@ -126,3 +130,4 @@ buildLuaModule() Return('targets') + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2007-12-10 11:00:31
|
Revision: 102 http://adchpp.svn.sourceforge.net/adchpp/?rev=102&view=rev Author: arnetheduck Date: 2007-12-10 03:00:24 -0800 (Mon, 10 Dec 2007) Log Message: ----------- experiment with mingw python module compile Modified Paths: -------------- adchpp/trunk/swig/SConscript Modified: adchpp/trunk/swig/SConscript =================================================================== --- adchpp/trunk/swig/SConscript 2007-12-09 19:40:15 UTC (rev 101) +++ adchpp/trunk/swig/SConscript 2007-12-10 11:00:24 UTC (rev 102) @@ -63,11 +63,11 @@ if dev.is_win32() and sys.platform != 'win32': print "Cross-compiling python module not supported" return - + env, target, sources = dev.prepare_build(source_path, '_pyadchpp', 'python.i') env.Append(SWIGFLAGS=['-c++','-threads','-Wall','-python', '-O', '-classic']) - import distutils.sysconfig + import distutils.sysconfig,distutils.cygwinccompiler env.Append(CPPPATH=['#', distutils.sysconfig.get_python_inc()]) if '_DEBUG' in env['CPPDEFINES']: @@ -75,10 +75,17 @@ if '/MDd' in env['CCFLAGS']: env['CCFLAGS'].remove('/MDd') env['CCFLAGS'].append('/MD') - + + if 'mingw' in env['TOOLS']: + compiler = distutils.cygwinccompiler.Mingw32CCompiler() + env.Append(LIBS=compiler.dll_libraries) + import os,distutils,sys if env['PLATFORM'] == 'win32': - env.Append(LIBPATH=[os.path.join(distutils.sysconfig.get_config_var('prefix'),"libs")]) + if 'mingw' in env['TOOLS']: + env.Append(LIBPATH=[distutils.sysconfig.get_config_var('prefix')]) + else: + env.Append(LIBPATH=[os.path.join(distutils.sysconfig.get_config_var('prefix'),"libs")]) env.Append(LIBS=["python"+"".join(sys.version[0:3].split(".")), 'adchpp']) else: env.Append(LIBS=['python2.4', 'adchpp']) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2007-12-09 22:06:45
|
Revision: 929 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=929&view=rev Author: arnetheduck Date: 2007-12-09 14:06:36 -0800 (Sun, 09 Dec 2007) Log Message: ----------- tentative multisource crash fix Modified Paths: -------------- dcplusplus/trunk/changelog.txt dcplusplus/trunk/dcpp/Download.cpp dcplusplus/trunk/dcpp/DownloadManager.cpp Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2007-12-04 21:17:15 UTC (rev 928) +++ dcplusplus/trunk/changelog.txt 2007-12-09 22:06:36 UTC (rev 929) @@ -25,6 +25,7 @@ * Finished UCMD extension draft implementation * Fixed status bars (poy) * Fixed protocol error STA being sent as type C +* Fixed a multisource download crash -- 0.703 2007-11-08 -- * Fixed invalid strings (thanks james ross) Modified: dcplusplus/trunk/dcpp/Download.cpp =================================================================== --- dcplusplus/trunk/dcpp/Download.cpp 2007-12-04 21:17:15 UTC (rev 928) +++ dcplusplus/trunk/dcpp/Download.cpp 2007-12-09 22:06:36 UTC (rev 929) @@ -61,10 +61,10 @@ } if(qi.isSet(QueueItem::FLAG_RESUME)) { +#ifdef PORT_ME const string& target = (getTempTarget().empty() ? getPath() : getTempTarget()); int64_t start = File::getSize(target); -#ifdef PORT_ME // Only use antifrag if we don't have a previous non-antifrag part if( BOOLSETTING(ANTI_FRAG) && (start == -1) ) { int64_t aSize = File::getSize(target + Download::ANTI_FRAG_EXT); @@ -85,6 +85,7 @@ Download::~Download() { getUserConnection().setDownload(0); + delete file; } AdcCommand Download::getCommand(bool zlib) { Modified: dcplusplus/trunk/dcpp/DownloadManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/DownloadManager.cpp 2007-12-04 21:17:15 UTC (rev 928) +++ dcplusplus/trunk/dcpp/DownloadManager.cpp 2007-12-09 22:06:36 UTC (rev 929) @@ -341,8 +341,6 @@ if(d->getType() == Transfer::TYPE_TREE) { d->getFile()->flush(); - delete d->getFile(); - d->setFile(NULL); int64_t bl = 1024; while(bl * (int64_t)d->getTigerTree().getLeaves().size() < d->getTigerTree().getFileSize()) @@ -367,8 +365,6 @@ // First, finish writing the file (flushing the buffers and closing the file...) try { d->getFile()->flush(); - delete d->getFile(); - d->setFile(0); } catch(const FileException& e) { failDownload(aSource, e.getError()); return; @@ -493,8 +489,6 @@ } catch(const Exception&) { } } - delete d->getFile(); - d->setFile(NULL); if(d->isSet(Download::FLAG_ANTI_FRAG)) { d->unsetFlag(Download::FLAG_ANTI_FRAG); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2007-12-09 19:40:25
|
Revision: 101 http://adchpp.svn.sourceforge.net/adchpp/?rev=101&view=rev Author: arnetheduck Date: 2007-12-09 11:40:15 -0800 (Sun, 09 Dec 2007) Log Message: ----------- Simplify logmanager, more lua fixes Modified Paths: -------------- adchpp/trunk/adchpp/LogManager.cpp adchpp/trunk/adchpp/LogManager.h adchpp/trunk/adchpp/PluginManager.cpp adchpp/trunk/adchpp/SettingsManager.cpp adchpp/trunk/adchpp/SocketManager.cpp adchpp/trunk/plugins/Bloom/src/BloomManager.cpp adchpp/trunk/plugins/Script/examples/access.lua adchpp/trunk/plugins/Script/src/LuaScript.cpp adchpp/trunk/plugins/Script/src/ScriptManager.cpp adchpp/trunk/swig/adchpp.i adchpp/trunk/swig/lua.i adchpp/trunk/swig/python.i adchpp/trunk/unix/main.cpp adchpp/trunk/unix/po/adchppd.pot adchpp/trunk/windows/adchppdw.cpp Modified: adchpp/trunk/adchpp/LogManager.cpp =================================================================== --- adchpp/trunk/adchpp/LogManager.cpp 2007-12-09 18:53:20 UTC (rev 100) +++ adchpp/trunk/adchpp/LogManager.cpp 2007-12-09 19:40:15 UTC (rev 101) @@ -29,8 +29,7 @@ LogManager* LogManager::instance = 0; -void LogManager::logDateTime(const string& area, const string& msg) throw() -{ +void LogManager::log(const string& area, const string& msg) throw() { char buf[64]; time_t now = time(NULL); size_t s = strftime(buf, 64, "%Y-%m-%d %H:%M:%S: ", localtime(&now)); @@ -41,7 +40,6 @@ dolog(tmp); } - void LogManager::dolog(const string& msg) throw() { dcdebug("Logging: %s\n", msg.c_str()); if(SETTING(LOG)) { Modified: adchpp/trunk/adchpp/LogManager.h =================================================================== --- adchpp/trunk/adchpp/LogManager.h 2007-12-09 18:53:20 UTC (rev 100) +++ adchpp/trunk/adchpp/LogManager.h 2007-12-09 19:40:15 UTC (rev 101) @@ -35,23 +35,13 @@ * @param area Name of the module that generated the error. * @param msg Message to log. */ - void log(const std::string& area, const std::string& msg) throw() { - std::string tmp(area); - tmp += ": "; - tmp += msg; - dolog(tmp); - } + ADCHPP_DLL void log(const std::string& area, const std::string& msg) throw(); - /** - * Same as log, but prepends the current date and time. - * @see log - */ - ADCHPP_DLL void logDateTime(const std::string& area, const std::string& msg) throw(); private: friend class Singleton<LogManager>; ADCHPP_DLL static LogManager* instance; FastMutex mtx; - + LogManager() throw() { } virtual ~LogManager() throw() { } @@ -59,7 +49,6 @@ }; #define LOG(area, msg) LogManager::getInstance()->log(area, msg) -#define LOGDT(area, msg) LogManager::getInstance()->logDateTime(area, msg) } Modified: adchpp/trunk/adchpp/PluginManager.cpp =================================================================== --- adchpp/trunk/adchpp/PluginManager.cpp 2007-12-09 18:53:20 UTC (rev 100) +++ adchpp/trunk/adchpp/PluginManager.cpp 2007-12-09 19:40:15 UTC (rev 101) @@ -86,7 +86,7 @@ #endif if(h == NULL) { - LOGDT(className, "Failed to load " + Util::toAcp(file) + ": " + PM_GET_ERROR_STRING()); + LOG(className, "Failed to load " + Util::toAcp(file) + ": " + PM_GET_ERROR_STRING()); return false; } @@ -103,7 +103,7 @@ h = PM_LOAD_LIBRARY(file.c_str()); } if(h == NULL) { - LOGDT(className, "Failed to load " + Util::toAcp(file) + ": " + PM_GET_ERROR_STRING()); + LOG(className, "Failed to load " + Util::toAcp(file) + ": " + PM_GET_ERROR_STRING()); return false; } #endif @@ -113,21 +113,21 @@ if(l != NULL && u != NULL) { int i = l(); if(i != 0) { - LOGDT(className, "Failed to load plugin " + Util::toAcp(file) + " (Error " + Util::toString(i) + ")"); + LOG(className, "Failed to load plugin " + Util::toAcp(file) + " (Error " + Util::toString(i) + ")"); } else { // Wonderful, we have a plugin... active.push_back(PluginInfo(h, v, l, u)); - LOGDT(className, Util::toAcp(file) + " loaded"); + LOG(className, Util::toAcp(file) + " loaded"); return true; } } else { - LOGDT(className, Util::toAcp(file) + " is not a valid ADCH++ plugin"); + LOG(className, Util::toAcp(file) + " is not a valid ADCH++ plugin"); } } else { - LOGDT(className, Util::toAcp(file) + " is for another version of ADCH++ (" + Util::toString(ver) + "), please get the correct one from the author"); + LOG(className, Util::toAcp(file) + " is for another version of ADCH++ (" + Util::toString(ver) + "), please get the correct one from the author"); } } else { - LOGDT(className, Util::toAcp(file) + " is not a valid ADCH++ plugin"); + LOG(className, Util::toAcp(file) + " is not a valid ADCH++ plugin"); } PM_UNLOAD_LIBRARY(h); Modified: adchpp/trunk/adchpp/SettingsManager.cpp =================================================================== --- adchpp/trunk/adchpp/SettingsManager.cpp 2007-12-09 18:53:20 UTC (rev 100) +++ adchpp/trunk/adchpp/SettingsManager.cpp 2007-12-09 19:40:15 UTC (rev 101) @@ -105,7 +105,7 @@ if(xml.findChild(attr)) set(StrSetting(i), xml.getChildData()); else - LOGDT(className, attr + " missing from settings, using default"); + LOG(className, attr + " missing from settings, using default"); xml.resetCurrentChild(); } for(i=INT_FIRST; i<INT_LAST; i++) { @@ -115,7 +115,7 @@ if(xml.findChild(attr)) set(IntSetting(i), Util::toInt(xml.getChildData())); else - LOGDT(className, attr + " missing from settings, using default"); + LOG(className, attr + " missing from settings, using default"); xml.resetCurrentChild(); } Modified: adchpp/trunk/adchpp/SocketManager.cpp =================================================================== --- adchpp/trunk/adchpp/SocketManager.cpp 2007-12-09 18:53:20 UTC (rev 100) +++ adchpp/trunk/adchpp/SocketManager.cpp 2007-12-09 19:40:15 UTC (rev 101) @@ -172,7 +172,7 @@ *overlapped = MSOverlapped(MSOverlapped::SHUTDOWN); if(!poller.post(overlapped)) { - LOGDT(SocketManager::className, "Fatal error while posting shutdown to completion port: " + Util::translateError(::GetLastError())); + LOG(SocketManager::className, "Fatal error while posting shutdown to completion port: " + Util::translateError(::GetLastError())); } join(); } @@ -189,7 +189,7 @@ private: bool init() { if(!poller.init()) { - LOGDT(SocketManager::className, "Unable to start poller: " + Util::translateError(socket_errno)); + LOG(SocketManager::className, "Unable to start poller: " + Util::translateError(socket_errno)); return false; } @@ -197,23 +197,23 @@ srv.listen(SETTING(SERVER_PORT)); srv.setBlocking(false); } catch(const SocketException& e) { - LOGDT(SocketManager::className, "Unable to create server socket: " + e.getError()); + LOG(SocketManager::className, "Unable to create server socket: " + e.getError()); return false; } if(!poller.associate(srv.getSocket())) { - LOGDT(SocketManager::className, "Unable to associate server socket with poller: " + Util::translateError(socket_errno)); + LOG(SocketManager::className, "Unable to associate server socket with poller: " + Util::translateError(socket_errno)); return false; } #ifndef _WIN32 if(socketpair(AF_UNIX, SOCK_STREAM, 0, event) == -1) { - LOGDT(SocketManager::className, "Unable to create event socketpair: " + Util::translateError(errno)); + LOG(SocketManager::className, "Unable to create event socketpair: " + Util::translateError(errno)); return false; } if(!poller.associate(event[1])) { - LOGDT(SocketManager::className, "Unable to associate event: " + Util::translateError(errno)); + LOG(SocketManager::className, "Unable to associate event: " + Util::translateError(errno)); return false; } #endif @@ -221,7 +221,7 @@ } virtual int run() { - LOGDT(SocketManager::className, "Writer starting"); + LOG(SocketManager::className, "Writer starting"); if(!init()) { return 0; } @@ -242,7 +242,7 @@ } } - LOGDT(SocketManager::className, "Writer shutting down"); + LOG(SocketManager::className, "Writer shutting down"); return 0; } @@ -257,7 +257,7 @@ int error = ::GetLastError(); if(overlapped == 0) { if(error != WAIT_TIMEOUT) { - LOGDT(SocketManager::className, "Fatal error while getting status from completion port: " + Util::translateError(error)); + LOG(SocketManager::className, "Fatal error while getting status from completion port: " + Util::translateError(error)); return; } } else if(overlapped->type == MSOverlapped::ACCEPT_DONE) { @@ -310,12 +310,12 @@ try { ms->create(); } catch (const SocketException& e) { - LOGDT(SocketManager::className, "Unable to create socket: " + e.getError()); + LOG(SocketManager::className, "Unable to create socket: " + e.getError()); return; } if(!poller.associate(ms->getSocket())) { - LOGDT(SocketManager::className, "Unable to associate poller: " + Util::translateError(::GetLastError())); + LOG(SocketManager::className, "Unable to associate poller: " + Util::translateError(::GetLastError())); return; } @@ -331,7 +331,7 @@ int error = ::WSAGetLastError(); if(error != ERROR_IO_PENDING) { if(!stop) { - LOGDT(SocketManager::className, "Failed accepting connection: " + Util::translateError(GetLastError())); + LOG(SocketManager::className, "Failed accepting connection: " + Util::translateError(GetLastError())); } pool.put(overlapped); @@ -491,7 +491,7 @@ void handleEvents() { vector<epoll_event> events; if(!poller.get(events)) { - LOGDT(SocketManager::className, "Poller failed: " + Util::translateError(errno)); + LOG(SocketManager::className, "Poller failed: " + Util::translateError(errno)); } for(vector<epoll_event>::iterator i = events.begin(); i != events.end(); ++i) { epoll_event& ev = *i; @@ -518,7 +518,7 @@ ms->setIp(ms->sock.accept(srv)); if(!poller.associate(ms)) { - LOGDT(SocketManager::className, "Unable to associate EPoll: " + Util::translateError(errno)); + LOG(SocketManager::className, "Unable to associate EPoll: " + Util::translateError(errno)); return; } @@ -530,7 +530,7 @@ read(ms); } catch (const SocketException& e) { - LOGDT(SocketManager::className, "Unable to create socket: " + e.getError()); + LOG(SocketManager::className, "Unable to create socket: " + e.getError()); return; } } @@ -610,7 +610,7 @@ if(err == EAGAIN || err == EINTR) { return; } - LOGDT(SocketManager::className, "Error reading from event[1]: " + Util::translateError(err)); + LOG(SocketManager::className, "Error reading from event[1]: " + Util::translateError(err)); return; } @@ -692,7 +692,7 @@ const string SocketManager::className = "SocketManager"; int SocketManager::run() { - LOGDT(SocketManager::className, "Starting"); + LOG(SocketManager::className, "Starting"); writer->start(); writer->setThreadPriority(Thread::HIGH); @@ -706,14 +706,14 @@ } for(ProcessQueue::iterator i = workQueue.begin(); i != workQueue.end(); ++i) { if(!(*i)) { - LOGDT(SocketManager::className, "Shutting down"); + LOG(SocketManager::className, "Shutting down"); return 0; } (*i)(); } workQueue.clear(); } - LOGDT(SocketManager::className, "ERROR; should never end up here..."); + LOG(SocketManager::className, "ERROR; should never end up here..."); return 0; } Modified: adchpp/trunk/plugins/Bloom/src/BloomManager.cpp =================================================================== --- adchpp/trunk/plugins/Bloom/src/BloomManager.cpp 2007-12-09 18:53:20 UTC (rev 100) +++ adchpp/trunk/plugins/Bloom/src/BloomManager.cpp 2007-12-09 19:40:15 UTC (rev 101) @@ -28,14 +28,14 @@ const string BloomManager::className = "BloomManager"; BloomManager::BloomManager() { - LOGDT(className, "Starting"); + LOG(className, "Starting"); ClientManager* cm = ClientManager::getInstance(); receiveConn = manage(&cm->signalReceive(), std::tr1::bind(&BloomManager::onReceive, this, _1, _2, _3)); disconnectConn = manage(&cm->signalDisconnected(), std::tr1::bind(&BloomManager::onDisconnected, this, _1)); } BloomManager::~BloomManager() { - LOGDT(className, "Shutting down"); + LOG(className, "Shutting down"); } static const std::string FEATURE = "BLOM"; Modified: adchpp/trunk/plugins/Script/examples/access.lua =================================================================== --- adchpp/trunk/plugins/Script/examples/access.lua 2007-12-09 18:53:20 UTC (rev 100) +++ adchpp/trunk/plugins/Script/examples/access.lua 2007-12-09 19:40:15 UTC (rev 101) @@ -241,7 +241,6 @@ for field, regex in pairs(inf_fields) do val = cmd:getParam(field, 0) if #val > 0 and hasVal and not val:match(regex) then - print("Bad INF " .. field) reply(c, "Field " .. field .. " has an invalid value, removed") cmd:delParam(field, 0) end @@ -252,6 +251,11 @@ return command_processed end + if #cmd:getParam("CT", 0) > 0 then + dump(c, adchpp.AdcCommand_ERROR_PROTOCOL_GENERIC, "I decide what type you are") + return command_processed + end + if #cmd:getParam("OP", 0) > 0 then dump(c, adchpp.AdcCommand_ERROR_PROTOCOL_GENERIC, "I decide who's an OP") return command_processed @@ -323,7 +327,6 @@ local user = get_user(c:getCID():toBase32(), c:getField("NI")) if not user then - print("User sending PAS not found (?)") dump(c, adchpp.AdcCommand_ERROR_PROTOCOL_GENERIC, "Can't find you now") return command_processed end @@ -388,7 +391,6 @@ local function onMSG(c, cmd) msg = cmd:getParam(0) - print("got message") local command, parameters = msg:match("^%+(%a+) ?(.*)") if not command then @@ -514,7 +516,7 @@ victim = cm:getClient(adchpp.AdcCommand_toSID(sid)) if not victim then - print "Victim not found" + reply(c, "Victim not found") return command_processed end @@ -538,7 +540,6 @@ local allowed_type = command_contexts[cmd:getCommand()] if allowed_type then if not cmd:getType():match(allowed_type) then - print("Invalid context for " .. cmd:getCommandString()) reply(c, "Invalid context for " .. cmd:getCommandString()) return command_processed end @@ -549,14 +550,12 @@ if allowed_level then user = get_user(c:getCID(), c:getField("NI")) if not user or user.level < allowed_level then - print("unallowed") reply(c, "You don't have access to " .. cmd:getCommandString()) return command_processed end end end - print("command is " .. cmd:getCommand() .. " msg is " .. adchpp.AdcCommand_CMD_MSG) if cmd:getCommand() == adchpp.AdcCommand_CMD_INF then return onINF(c, cmd) elseif cmd:getCommand() == adchpp.AdcCommand_CMD_PAS then Modified: adchpp/trunk/plugins/Script/src/LuaScript.cpp =================================================================== --- adchpp/trunk/plugins/Script/src/LuaScript.cpp 2007-12-09 18:53:20 UTC (rev 100) +++ adchpp/trunk/plugins/Script/src/LuaScript.cpp 2007-12-09 19:40:15 UTC (rev 101) @@ -87,9 +87,9 @@ int error = luaL_loadfile(l, filename.c_str()) || lua_pcall(l, 0, 0, 0); if(error) { - LOGDT(className, string("Error loading file: ") + lua_tostring(l, -1)); + LOG(className, string("Error loading file: ") + lua_tostring(l, -1)); } else { - LOGDT(className, "Loaded " + filename); + LOG(className, "Loaded " + filename); } chdir(old_dir); } Modified: adchpp/trunk/plugins/Script/src/ScriptManager.cpp =================================================================== --- adchpp/trunk/plugins/Script/src/ScriptManager.cpp 2007-12-09 18:53:20 UTC (rev 100) +++ adchpp/trunk/plugins/Script/src/ScriptManager.cpp 2007-12-09 19:40:15 UTC (rev 101) @@ -39,7 +39,7 @@ const string ScriptManager::className = "ScriptManager"; ScriptManager::ScriptManager() { - LOGDT(className, "Starting"); + LOG(className, "Starting"); ClientManager::SignalReceive::Signal& sig = ClientManager::getInstance()->signalReceive(); receiveConn = manage(&sig, std::tr1::bind(&ScriptManager::onReceive, this, _1, _2, _3)); @@ -47,7 +47,7 @@ } ScriptManager::~ScriptManager() { - LOGDT(className, "Shutting down"); + LOG(className, "Shutting down"); clearEngines(); } @@ -74,7 +74,7 @@ } xml.stepOut(); } catch(const Exception& e) { - LOGDT(className, "Failed to load settings: " + e.getError()); + LOG(className, "Failed to load settings: " + e.getError()); return; } } Modified: adchpp/trunk/swig/adchpp.i =================================================================== --- adchpp/trunk/swig/adchpp.i 2007-12-09 18:53:20 UTC (rev 100) +++ adchpp/trunk/swig/adchpp.i 2007-12-09 19:40:15 UTC (rev 101) @@ -455,7 +455,6 @@ { public: void log(const std::string& area, const std::string& msg) throw(); - void logDateTime(const std::string& area, const std::string& msg) throw(); }; %template(SignalC) Signal<void (Client&)>; Modified: adchpp/trunk/swig/lua.i =================================================================== --- adchpp/trunk/swig/lua.i 2007-12-09 18:53:20 UTC (rev 100) +++ adchpp/trunk/swig/lua.i 2007-12-09 19:40:15 UTC (rev 101) @@ -179,4 +179,3 @@ return std::string(); } } - Modified: adchpp/trunk/swig/python.i =================================================================== --- adchpp/trunk/swig/python.i 2007-12-09 18:53:20 UTC (rev 100) +++ adchpp/trunk/swig/python.i 2007-12-09 19:40:15 UTC (rev 101) @@ -1,6 +1,5 @@ %module pyadchpp - %{ // Python pollution #undef socklen_t @@ -111,3 +110,4 @@ PyObject* obj; }; %} + Modified: adchpp/trunk/unix/main.cpp =================================================================== --- adchpp/trunk/unix/main.cpp 2007-12-09 18:53:20 UTC (rev 100) +++ adchpp/trunk/unix/main.cpp 2007-12-09 19:40:15 UTC (rev 101) @@ -66,7 +66,7 @@ } static void uninit() { - LOGDT(modName, versionString + " shut down"); + LOG(modName, versionString + " shut down"); if(!asdaemon) printf(_("Shutting down.")); shutdown(&f2); @@ -86,19 +86,19 @@ static void daemonize() { switch(fork()) { case -1: - LOGDT(modName, string("First fork failed: ") + strerror(errno)); + LOG(modName, string("First fork failed: ") + strerror(errno)); exit(5); case 0: break; default: _exit(0); } if(setsid() < 0) { - LOGDT(modName, string("setsid failed: ") + strerror(errno)); + LOG(modName, string("setsid failed: ") + strerror(errno)); exit(6); } switch(fork()) { case -1: - LOGDT(modName, string("Second fork failed: ") + strerror(errno)); + LOG(modName, string("Second fork failed: ") + strerror(errno)); exit(7); case 0: break; default: exit(0); @@ -121,11 +121,11 @@ try { adchpp::startup(&f2); } catch(const adchpp::Exception& e) { - LOGDT(modName, "Failed to start: " + e.getError()); + LOG(modName, "Failed to start: " + e.getError()); uninit(); return; } - LOGDT(modName, versionString + " started as a daemon"); + LOG(modName, versionString + " started as a daemon"); // Now what? int x = 0; sigset_t st; @@ -141,7 +141,7 @@ printf(_("Starting")); init(); initialize(configPath); - LOGDT(modName, versionString + " starting from console"); + LOG(modName, versionString + " starting from console"); printf("."); try { startup(&f2); Modified: adchpp/trunk/unix/po/adchppd.pot =================================================================== --- adchpp/trunk/unix/po/adchppd.pot 2007-12-09 18:53:20 UTC (rev 100) +++ adchpp/trunk/unix/po/adchppd.pot 2007-12-09 19:40:15 UTC (rev 101) @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: \"adchpp\"--copyright-holder=\"Jacek Sieka\"\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2007-12-09 18:46+0100\n" +"POT-Creation-Date: 2007-12-09 20:22+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL...@li...>\n" Modified: adchpp/trunk/windows/adchppdw.cpp =================================================================== --- adchpp/trunk/windows/adchppdw.cpp 2007-12-09 18:53:20 UTC (rev 100) +++ adchpp/trunk/windows/adchppdw.cpp 2007-12-09 19:40:15 UTC (rev 101) @@ -28,7 +28,7 @@ static const string modName = "adchpp"; -#define LOGERROR(func) LOGDT(modName, func " failed: " + Util::translateError(GetLastError())) +#define LOGERROR(func) LOG(modName, func " failed: " + Util::translateError(GetLastError())) #define PRINTERROR(func) fprintf(stderr, func " failed: 0x%x, %s", GetLastError(), Util::translateError(GetLastError()).c_str()) #ifdef _MSC_VER @@ -172,9 +172,9 @@ initialize(configPath); if(asService) - LOGDT(modName, versionString + " started as a service"); + LOG(modName, versionString + " started as a service"); else - LOGDT(modName, versionString + " started from console"); + LOG(modName, versionString + " started from console"); } static void f2() { @@ -182,7 +182,7 @@ } static void uninit() { - LOGDT(modName, versionString + " shut down"); + LOG(modName, versionString + " shut down"); printf("Shutting down."); shutdown(&f2); #if defined(_MSC_VER) && !defined(NDEBUG) @@ -202,7 +202,7 @@ case SERVICE_CONTROL_SHUTDOWN: // Fallthrough case SERVICE_CONTROL_STOP: ss.dwCurrentState = SERVICE_STOP_PENDING; exitSem.signal(); break; case SERVICE_CONTROL_INTERROGATE: break; - default: LOGDT(modName, "Unknown service handler code " + Util::toString(code)); + default: LOG(modName, "Unknown service handler code " + Util::toString(code)); } if(!SetServiceStatus(ssh, &ss)) { @@ -243,7 +243,7 @@ try { startup(&f); } catch(const Exception& e) { - LOGDT(modName, "ADCH++ startup failed because: " + e.getError()); + LOG(modName, "ADCH++ startup failed because: " + e.getError()); uninit(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2007-12-09 18:53:21
|
Revision: 100 http://adchpp.svn.sourceforge.net/adchpp/?rev=100&view=rev Author: arnetheduck Date: 2007-12-09 10:53:20 -0800 (Sun, 09 Dec 2007) Log Message: ----------- Add correct client types to lua script Modified Paths: -------------- adchpp/trunk/plugins/Script/examples/access.lua Modified: adchpp/trunk/plugins/Script/examples/access.lua =================================================================== --- adchpp/trunk/plugins/Script/examples/access.lua 2007-12-09 18:44:45 UTC (rev 99) +++ adchpp/trunk/plugins/Script/examples/access.lua 2007-12-09 18:53:20 UTC (rev 100) @@ -290,9 +290,11 @@ end if user.level > 1 then - cmd:addParam("OP1") + cmd:addParam("CT4") + cmd:addParam("OP1") -- old name else - cmd:addParam("RG1") + cmd:addParam("CT2") + cmd:addParam("RG1") -- old name end if not cm:verifyINF(c, cmd) then @@ -349,7 +351,7 @@ reply(c, "Welcome back") cm:enterNormal(c, true, true) - if user.level > 1 and c:supports("UCMD") then + if user.level > 1 and (c:supports("UCMD") or c:supports("UCM0") then for k, v in pairs(user_commands) do ucmd = adchpp.AdcCommand(adchpp.AdcCommand_CMD_CMD, adchpp.AdcCommand_TYPE_INFO, adchpp.AdcCommand_HUB_SID) ucmd:addParam(k) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2007-12-09 18:44:51
|
Revision: 99 http://adchpp.svn.sourceforge.net/adchpp/?rev=99&view=rev Author: arnetheduck Date: 2007-12-09 10:44:45 -0800 (Sun, 09 Dec 2007) Log Message: ----------- Simplified writers some Modified Paths: -------------- adchpp/trunk/SConstruct adchpp/trunk/adchpp/ManagedSocket.cpp adchpp/trunk/adchpp/ManagedSocket.h adchpp/trunk/adchpp/Socket.cpp adchpp/trunk/adchpp/SocketManager.cpp adchpp/trunk/adchpp/SocketManager.h adchpp/trunk/adchpp/Util.cpp adchpp/trunk/plugins/Script/examples/access.lua adchpp/trunk/readme.txt adchpp/trunk/swig/adchpp.i adchpp/trunk/swig/lua.i adchpp/trunk/swig/python.i adchpp/trunk/test/PyClient.py adchpp/trunk/unix/po/adchppd.pot Modified: adchpp/trunk/SConstruct =================================================================== --- adchpp/trunk/SConstruct 2007-12-04 22:04:21 UTC (rev 98) +++ adchpp/trunk/SConstruct 2007-12-09 18:44:45 UTC (rev 99) @@ -213,6 +213,8 @@ conf = Configure(env) +if conf.CheckCHeader('poll.h'): + conf.env.Append(CPPDEFINES='HAVE_POLL_H') if conf.CheckCHeader('sys/epoll.h'): conf.env.Append(CPPDEFINES=['HAVE_SYS_EPOLL_H']) if conf.CheckLib('dl', 'dlopen'): Modified: adchpp/trunk/adchpp/ManagedSocket.cpp =================================================================== --- adchpp/trunk/adchpp/ManagedSocket.cpp 2007-12-04 22:04:21 UTC (rev 98) +++ adchpp/trunk/adchpp/ManagedSocket.cpp 2007-12-09 18:44:45 UTC (rev 99) @@ -34,6 +34,8 @@ ManagedSocket::ManagedSocket() throw() : outBuf(0), overFlow(0), disc(0) #ifdef _WIN32 , writeBuf(0) +#else +, blocked(false) #endif { } @@ -92,8 +94,12 @@ } ByteVector* ManagedSocket::prepareWrite() { - ByteVector* buffer = 0; + if(isBlocked()) { + return 0; + } + ByteVector* buffer = 0; + { FastMutex::Lock l(writeMutex); @@ -153,11 +159,11 @@ } void ManagedSocket::completeAccept() throw() { - SocketManager::getInstance()->addJob(std::tr1::bind(&ManagedSocket::processIncoming, this)); + SocketManager::getInstance()->addJob(connectedHandler); } -void ManagedSocket::failSocket() throw() { - SocketManager::getInstance()->addJob(std::tr1::bind(&ManagedSocket::processFail, this)); +void ManagedSocket::failSocket(int) throw() { + SocketManager::getInstance()->addJob(failedHandler); } void ManagedSocket::disconnect(Util::Reason reason) throw() { @@ -165,22 +171,14 @@ return; } - disc = GET_TICK(); + disc = GET_TICK() + SETTING(DISCONNECT_TIMEOUT); Util::reasons[reason]++; SocketManager::getInstance()->addDisconnect(this); } -void ManagedSocket::processIncoming() throw() { - connectedHandler(); -} - void ManagedSocket::processData(ByteVector* buf) throw() { dataHandler(*buf); Util::freeBuf = buf; } -void ManagedSocket::processFail() throw() { - failedHandler(); } - -} Modified: adchpp/trunk/adchpp/ManagedSocket.h =================================================================== --- adchpp/trunk/adchpp/ManagedSocket.h 2007-12-04 22:04:21 UTC (rev 98) +++ adchpp/trunk/adchpp/ManagedSocket.h 2007-12-09 18:44:45 UTC (rev 99) @@ -73,15 +73,13 @@ void completeAccept() throw(); bool completeWrite(ByteVector* buf, size_t written) throw(); bool completeRead(ByteVector* buf) throw(); - void failSocket() throw(); + void failSocket(int error) throw(); void shutdown() { sock.shutdown(); } void close() { sock.disconnect(); } // Functions processing events - void processIncoming() throw(); void processData(ByteVector* buf) throw(); - void processFail() throw(); // No copies ManagedSocket(const ManagedSocket&); @@ -103,6 +101,12 @@ ByteVector* writeBuf; /** WSABUF for data being sent */ WSABUF wsabuf; + + bool isBlocked() { return writeBuf != 0; } +#else + bool blocked; + bool isBlocked() { return blocked; } + void setBlocked(bool blocked_) { blocked = blocked_; } #endif ConnectedHandler connectedHandler; Modified: adchpp/trunk/adchpp/Socket.cpp =================================================================== --- adchpp/trunk/adchpp/Socket.cpp 2007-12-04 22:04:21 UTC (rev 98) +++ adchpp/trunk/adchpp/Socket.cpp 2007-12-09 18:44:45 UTC (rev 99) @@ -20,6 +20,10 @@ #include "Socket.h" +#ifdef HAVE_POLL_H +#include <poll.h> +#endif + namespace adchpp { using namespace std; @@ -37,13 +41,12 @@ { #ifdef _WIN32 checksocket(sock = WSASocket(AF_INET, SOCK_STREAM, IPPROTO_TCP, 0, 0, WSA_FLAG_OVERLAPPED)); - setBlocking(false); DWORD x = 0; setsockopt(sock, SOL_SOCKET, SO_SNDBUF, (char*)&x, sizeof(x)); #else checksocket(sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)); - setBlocking(false); #endif + setBlocking(false); } break; case TYPE_UDP: @@ -75,13 +78,14 @@ #else sock = ::socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); #endif - int x = 1; - ::setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char*)&x, sizeof(int)); if(sock == (socket_t)-1) { throw SocketException(socket_errno); } + int x = 1; + ::setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char*)&x, sizeof(int)); + tcpaddr.sin_family = AF_INET; tcpaddr.sin_port = htons(aPort); tcpaddr.sin_addr.s_addr = htonl(INADDR_ANY); @@ -254,25 +258,21 @@ if(waitFor & WAIT_READ || waitFor & WAIT_CONNECT) { fd.events |= POLLIN; } - if(waifFor & WAIT_WRITE) { + if(waitFor & WAIT_WRITE) { fd.events |= POLLOUT; } - int result = poll(&fd, 1, millis)); + int result = poll(&fd, 1, millis); if(result == 1) { if(fd.revents & POLLERR) { int y = 0; socklen_t z = sizeof(y); checksockerr(getsockopt(sock, SOL_SOCKET, SO_ERROR, (char*)&y, &z)); - if(y != 0) { - throw SocketException(y); - } - // Should never happen - throw SocketException("Unknown socket error"); + throw SocketException(y); } int ret = 0; - if(fr.revents & POLLIN) { + if(fd.revents & POLLIN) { ret |= waitFor & (WAIT_READ | WAIT_CONNECT); } if(fd.revents & POLLOUT) { @@ -384,9 +384,8 @@ void Socket::disconnect() throw() { if(sock != INVALID_SOCKET) { closesocket(sock); + sock = INVALID_SOCKET; } - - sock = INVALID_SOCKET; } } Modified: adchpp/trunk/adchpp/SocketManager.cpp =================================================================== --- adchpp/trunk/adchpp/SocketManager.cpp 2007-12-04 22:04:21 UTC (rev 98) +++ adchpp/trunk/adchpp/SocketManager.cpp 2007-12-09 18:44:45 UTC (rev 99) @@ -48,12 +48,9 @@ struct MSOverlapped : OVERLAPPED { enum Types { - ACCEPT, + ACCEPT_DONE, READ_DONE, WRITE_DONE, - WRITE_WAITING, - WRITE_ALL, - DISCONNECT, SHUTDOWN } type; ManagedSocketPtr ms; @@ -69,17 +66,17 @@ } }; -class CompletionPort { +class Poller { public: - CompletionPort() : handle(INVALID_HANDLE_VALUE) { + Poller() : handle(INVALID_HANDLE_VALUE) { } - ~CompletionPort() { + ~Poller() { if(handle != INVALID_HANDLE_VALUE) ::CloseHandle(handle); } - bool create() { + bool init() { handle = ::CreateIoCompletionPort(INVALID_HANDLE_VALUE, 0, 0, 0); return handle != NULL; } @@ -102,89 +99,124 @@ HANDLE handle; }; -class Writer : public Thread { -public: - static const size_t PREPARED_SOCKETS = 32; - - Writer() : stop(false) { + +#elif defined(HAVE_SYS_EPOLL_H) + +struct Poller { + Poller() : poll_fd(-1) { } - void addWriter(ManagedSocketPtr /*ms */) { - if(stop) - return; -#if 0 - MSOverlapped* overlapped = pool.get(); - *overlapped = MSOverlapped(MSOverlapped::WRITE_WAITING, ms); - - if(!port.post(overlapped)) { - LOGDT(SocketManager::className, "Fatal error while posting write to completion port: " + Util::translateError(::GetLastError())); + ~Poller() { + if(poll_fd != -1) { + close(poll_fd); } -#endif } - void addAllWriters() { - if(stop) - return; -#if 0 - MSOverlapped* overlapped = pool.get(); - *overlapped = MSOverlapped(MSOverlapped::WRITE_ALL); + bool init() { + poll_fd = epoll_create(1024); + if(poll_fd == -1) + return false; - if(!port.post(overlapped)) { - LOGDT(SocketManager::className, "Fatal error while posting writeAll to completion port: " + Util::translateError(::GetLastError())); + return true; + } + + bool associate(const ManagedSocketPtr& ms) { + struct epoll_event ev; + ev.data.ptr = reinterpret_cast<void*>(ms.get()); + ev.events = EPOLLIN | EPOLLOUT | EPOLLET; + return epoll_ctl(poll_fd, EPOLL_CTL_ADD, ms->getSocket(), &ev) == 0; + } + + bool associate(int fd) { + struct epoll_event ev; + ev.data.fd = fd; + ev.events = EPOLLIN; + return epoll_ctl(poll_fd, EPOLL_CTL_ADD, fd, &ev) == 0; + } + + bool get(vector<epoll_event>& events) { + events.clear(); + events.resize(1024); + while(true) { + int n = epoll_wait(poll_fd, &events[0], events.size(), WRITE_TIMEOUT); + if(n == -1) { + if(errno != EINTR) { + return false; + } + // Keep looping + } else { + events.resize(n); + return true; + } } -#endif } - void addDisconnect(ManagedSocketPtr ms) { - if(stop) - return; - - MSOverlapped* overlapped = pool.get(); - *overlapped = MSOverlapped(MSOverlapped::DISCONNECT, ms); - - if(!port.post(overlapped)) { - LOGDT(SocketManager::className, "Fatal error while posting disconnect to completion port: " + Util::translateError(::GetLastError())); - } - } + int poll_fd; +}; + +#else +#error No socket implementation for your platform +#endif // _WIN32 + +class Writer : public Thread { +public: + Writer() : stop(false) { + } + +#ifdef _WIN32 void shutdown() { stop = true; MSOverlapped* overlapped = pool.get(); *overlapped = MSOverlapped(MSOverlapped::SHUTDOWN); - if(!port.post(overlapped)) { + if(!poller.post(overlapped)) { LOGDT(SocketManager::className, "Fatal error while posting shutdown to completion port: " + Util::translateError(::GetLastError())); } join(); } +#else + void shutdown() { + stop = true; - void getErrors(SocketManager::ErrorMap& acceptErrors_, SocketManager::ErrorMap& readErrors_, SocketManager::ErrorMap& writeErrors_) { - FastMutex::Lock l(errorMutex); - acceptErrors_ = acceptErrors; - readErrors_ = readErrors; - writeErrors_ = writeErrors; + char ev = 0; + ::write(event[0], &ev, sizeof(ev)); + + join(); } - +#endif private: bool init() { - if(!port.create()) { - LOGDT(SocketManager::className, "Unable to create IO Completion port: " + Util::translateError(::GetLastError())); + if(!poller.init()) { + LOGDT(SocketManager::className, "Unable to start poller: " + Util::translateError(socket_errno)); return false; } try { - srv.listen(static_cast<short>(SETTING(SERVER_PORT))); + srv.listen(SETTING(SERVER_PORT)); + srv.setBlocking(false); } catch(const SocketException& e) { LOGDT(SocketManager::className, "Unable to create server socket: " + e.getError()); return false; } - if(!port.associate(srv.getSocket())) { - LOGDT(SocketManager::className, "Unable to associate IO Completion port: " + Util::translateError(::GetLastError())); + if(!poller.associate(srv.getSocket())) { + LOGDT(SocketManager::className, "Unable to associate server socket with poller: " + Util::translateError(socket_errno)); return false; } - + +#ifndef _WIN32 + if(socketpair(AF_UNIX, SOCK_STREAM, 0, event) == -1) { + LOGDT(SocketManager::className, "Unable to create event socketpair: " + Util::translateError(errno)); + return false; + } + + if(!poller.associate(event[1])) { + LOGDT(SocketManager::className, "Unable to associate event: " + Util::translateError(errno)); + return false; + } +#endif return true; } @@ -194,77 +226,18 @@ return 0; } - prepareAccept(); - - DWORD bytes = 0; - MSOverlapped* overlapped = 0; - uint32_t lastWrite = 0; - while(!stop || !accepting.empty() || !active.empty()) { - bool ret = port.get(&bytes, &overlapped); - //dcdebug("Event: %x, %x, %x, %x, %x, %x\n", (unsigned int)ret, (unsigned int)bytes, (unsigned int)ms, (unsigned int)overlapped, (unsigned int)overlapped->ms, (unsigned int)overlapped->type); +#ifdef _WIN32 + prepareAccept(); +#endif + while(!stop || !active.empty()) { + handleEvents(); - if(!ret) { - int error = ::GetLastError(); - if(overlapped == 0) { - if(error != WAIT_TIMEOUT) { - LOGDT(SocketManager::className, "Fatal error while getting status from completion port: " + Util::translateError(error)); - return error; - } - } else if(overlapped->type == MSOverlapped::ACCEPT) { - dcdebug("Error accepting: %s\n", Util::translateError(error).c_str()); - failAccept(overlapped->ms, error); - } else if(overlapped->type == MSOverlapped::READ_DONE) { - dcdebug("Error reading: %s\n", Util::translateError(error).c_str()); - failRead(overlapped->ms, error); - } else if(overlapped->type == MSOverlapped::WRITE_DONE) { - dcdebug("Error writing: %s\n", Util::translateError(error).c_str()); - failWrite(overlapped->ms, error); - } else { - dcdebug("Unknown error %d when waiting\n", overlapped->type); - } - } else { - switch(overlapped->type) { - case MSOverlapped::ACCEPT: { - checkDisconnects(); - handleAccept(overlapped->ms); - break; - } - case MSOverlapped::READ_DONE: { - handleReadDone(overlapped->ms); - break; - } - case MSOverlapped::WRITE_DONE: { - handleWriteDone(overlapped->ms, bytes); - break; - } - case MSOverlapped::WRITE_WAITING: { - prepareWrite(overlapped->ms); - break; - } - case MSOverlapped::WRITE_ALL: { - writeAll(); - break; - } - case MSOverlapped::DISCONNECT: { - handleDisconnect(overlapped->ms); - break; - } - case MSOverlapped::SHUTDOWN: { - handleShutdown(); - break; - } - } - } - if(overlapped != 0) { - pool.put(overlapped); - } - uint32_t now = GET_TICK(); if(now > lastWrite + WRITE_TIMEOUT) { - checkDisconnects(); writeAll(); + removeDisconnected(); lastWrite = now; } @@ -273,6 +246,57 @@ return 0; } +#ifdef _WIN32 + void handleEvents() { + DWORD bytes = 0; + MSOverlapped* overlapped = 0; + bool ret = poller.get(&bytes, &overlapped); + //dcdebug("Event: %x, %x, %x, %x, %x, %x\n", (unsigned int)ret, (unsigned int)bytes, (unsigned int)ms, (unsigned int)overlapped, (unsigned int)overlapped->ms, (unsigned int)overlapped->type); + + if(!ret) { + int error = ::GetLastError(); + if(overlapped == 0) { + if(error != WAIT_TIMEOUT) { + LOGDT(SocketManager::className, "Fatal error while getting status from completion port: " + Util::translateError(error)); + return; + } + } else if(overlapped->type == MSOverlapped::ACCEPT_DONE) { + dcdebug("Error accepting: %s\n", Util::translateError(error).c_str()); + failAccept(overlapped->ms, error); + } else if(overlapped->type == MSOverlapped::READ_DONE) { + dcdebug("Error reading: %s\n", Util::translateError(error).c_str()); + disconnect(overlapped->ms, error); + } else if(overlapped->type == MSOverlapped::WRITE_DONE) { + dcdebug("Error writing: %s\n", Util::translateError(error).c_str()); + failWrite(overlapped->ms, error); + } else { + dcdebug("Unknown error %d when waiting\n", overlapped->type); + } + } else { + switch(overlapped->type) { + case MSOverlapped::ACCEPT_DONE: { + handleAccept(overlapped->ms); + break; + } + case MSOverlapped::READ_DONE: { + handleReadDone(overlapped->ms); + break; + } + case MSOverlapped::WRITE_DONE: { + handleWriteDone(overlapped->ms, bytes); + break; + } + case MSOverlapped::SHUTDOWN: { + handleShutdown(); + break; + } + } + } + if(overlapped != 0) { + pool.put(overlapped); + } + } + void prepareAccept() throw() { if(stop) return; @@ -290,8 +314,8 @@ return; } - if(!port.associate(ms->getSocket())) { - LOGDT(SocketManager::className, "Unable to associate IO Completion port: " + Util::translateError(::GetLastError())); + if(!poller.associate(ms->getSocket())) { + LOGDT(SocketManager::className, "Unable to associate poller: " + Util::translateError(::GetLastError())); return; } @@ -301,7 +325,7 @@ ms->writeBuf->resize(ACCEPT_BUF_SIZE); MSOverlapped* overlapped = pool.get(); - *overlapped = MSOverlapped(MSOverlapped::ACCEPT, ms); + *overlapped = MSOverlapped(MSOverlapped::ACCEPT_DONE, ms); if(!::AcceptEx(srv.getSocket(), ms->getSocket(), &(*ms->writeBuf)[0], 0, ACCEPT_BUF_SIZE/2, ACCEPT_BUF_SIZE/2, &x, overlapped)) { int error = ::WSAGetLastError(); @@ -312,9 +336,6 @@ pool.put(overlapped); - FastMutex::Lock l(errorMutex); - acceptErrors[error]++; - return; } } @@ -340,7 +361,7 @@ SocketManager::getInstance()->incomingHandler(ms); ms->completeAccept(); - prepareRead(ms); + read(ms); // Prepare a new socket to replace this one... prepareAccept(); } @@ -348,14 +369,10 @@ void failAccept(ManagedSocketPtr& ms, int error) throw() { accepting.erase(ms); - prepareAccept(); - - FastMutex::Lock l(errorMutex); - acceptErrors[error]++; } - - void prepareRead(const ManagedSocketPtr& ms) throw() { + + void read(const ManagedSocketPtr& ms) throw() { if(stop) return; @@ -370,7 +387,7 @@ int error = ::WSAGetLastError(); if(error != WSA_IO_PENDING) { dcdebug("Error preparing read: %s\n", Util::translateError(error).c_str()); - failRead(ms, error); + disconnect(ms, error); } } } @@ -391,58 +408,38 @@ int error = ::WSAGetLastError(); if(error != WSAEWOULDBLOCK) { // Socket failed... - failRead(ms, error); + disconnect(ms, error); return; } - prepareRead(ms); + read(ms); return; } if(bytes == 0) { Util::freeBuf = readBuf; - failRead(ms, 0); + disconnect(ms, 0); return; } readBuf->resize(bytes); ms->completeRead(readBuf); - prepareRead(ms); + read(ms); } - void failRead(const ManagedSocketPtr& ms, int error) throw() { - if(active.find(ms) == active.end()) { + void write(const ManagedSocketPtr& ms) throw() { + if(stop || !(*ms)) { return; } - if(error != 0) { - FastMutex::Lock l(errorMutex); - readErrors[error]++; - } - - ms->close(); - - SocketSet::iterator i = disconnecting.find(ms); - if(i == disconnecting.end()) { - ms->failSocket(); - } else { - disconnecting.erase(i); - } - - active.erase(ms); - } - - void prepareWrite(const ManagedSocketPtr& ms) throw() { - if(stop || ms->writeBuf) { - return; - } - ms->writeBuf = ms->prepareWrite(); if(!ms->writeBuf) { - if(ms->disc) { - ms->close(); + uint32_t now = GET_TICK(); + + if(ms->disc || (ms->isBlocked() && ms->disc < now)) { + disconnect(ms, 0); } return; } @@ -457,11 +454,10 @@ if(::WSASend(ms->getSocket(), &ms->wsabuf, 1, &x, 0, reinterpret_cast<LPWSAOVERLAPPED>(overlapped), 0) != 0) { int error = ::WSAGetLastError(); if(error != WSA_IO_PENDING) { - failWrite(ms, error); pool.put(overlapped); + disconnect(ms, error); } } - return; } void handleWriteDone(const ManagedSocketPtr& ms, DWORD bytes) throw() { @@ -472,328 +468,51 @@ dcdebug("No buffer in handleWriteDone??\n"); return; } - if(ms->completeWrite(buf, bytes)) { - prepareWrite(ms); - } + ms->completeWrite(buf, bytes); } void failWrite(const ManagedSocketPtr& ms, int error) throw() { Util::freeBuf = ms->writeBuf; ms->writeBuf = 0; - - FastMutex::Lock l(errorMutex); - writeErrors[error]++; + disconnect(ms, error); } - - void writeAll() throw() { - for(SocketSet::iterator i = active.begin(); i != active.end(); ++i) { - prepareWrite(*i); - } - } - - void handleDisconnect(const ManagedSocketPtr& ms) throw() { - if(active.find(ms) == active.end()) { - return; - } - - if(disconnecting.find(ms) != disconnecting.end()) { - return; - } - - prepareWrite(ms); - disconnecting.insert(ms); - ms->failSocket(); - } - - void checkDisconnects() throw() { - uint32_t now = GET_TICK(); - for(SocketSet::iterator i = disconnecting.begin(); i != disconnecting.end(); ++i) { - const ManagedSocketPtr& ms = *i; - if(ms->disc + (uint32_t)SETTING(DISCONNECT_TIMEOUT) < now) { - ms->close(); - } - } - } - + void handleShutdown() throw() { for(SocketSet::iterator i = accepting.begin(); i != accepting.end(); ++i) { (*i)->close(); } for(SocketSet::iterator i = active.begin(); i != active.end(); ++i) { - (*i)->close(); + disconnect(*i, 0); } } - - FastMutex errorMutex; - SocketManager::ErrorMap acceptErrors; - SocketManager::ErrorMap readErrors; - SocketManager::ErrorMap writeErrors; - - CompletionPort port; - Socket srv; - - bool stop; - - Pool<MSOverlapped, ClearOverlapped> pool; - - typedef unordered_set<ManagedSocketPtr, PointerHash<ManagedSocket> > SocketSet; - /** Sockets that have a pending read */ - SocketSet active; - /** Sockets that have a pending accept */ - SocketSet accepting; - /** Sockets that are being written to but should be disconnected if timeout it reached */ - SocketSet disconnecting; -}; -#elif defined(HAVE_SYS_EPOLL_H) - -struct EPoll { - EPoll() : poll_fd(-1) { - } +#else - ~EPoll() { - if(poll_fd != -1) { - close(poll_fd); + void handleEvents() { + vector<epoll_event> events; + if(!poller.get(events)) { + LOGDT(SocketManager::className, "Poller failed: " + Util::translateError(errno)); } - } - - bool init() { - poll_fd = epoll_create(1024); - if(poll_fd == -1) - return false; - - return true; - } - - bool associate(const ManagedSocketPtr& ms) { - struct epoll_event ev; - ev.data.ptr = reinterpret_cast<void*>(ms.get()); - ev.events = EPOLLIN | EPOLLOUT | EPOLLET; - return epoll_ctl(poll_fd, EPOLL_CTL_ADD, ms->getSocket(), &ev) == 0; - } - - bool associate(int fd) { - struct epoll_event ev; - ev.data.fd = fd; - ev.events = EPOLLIN; - return epoll_ctl(poll_fd, EPOLL_CTL_ADD, fd, &ev) == 0; - } - - bool get(vector<epoll_event>& events) { - events.resize(1024); - while(true) { - int n = epoll_wait(poll_fd, &events[0], events.size(), WRITE_TIMEOUT); - if(n == -1) { - if(errno != EINTR) { - return false; - } - // Keep looping + for(vector<epoll_event>::iterator i = events.begin(); i != events.end(); ++i) { + epoll_event& ev = *i; + if(ev.data.fd == srv.getSocket()) { + accept(); + } else if(ev.data.fd == event[1]) { + handleShutdown(); } else { - events.resize(n); - return true; - } - } - } - - void remove(const ManagedSocketPtr& ms) { - // Buggy pre-2.6.9 kernels require non-null for last param - epoll_event e; - epoll_ctl(poll_fd, EPOLL_CTL_DEL, ms->getSocket(), &e); - } - - int poll_fd; -}; - -struct Event { - enum Type { - WRITE, - WRITE_ALL, - DISCONNECT, - REMOVE, - SHUTDOWN - } event; - ManagedSocketPtr ms; - - Event(Type event_, const ManagedSocketPtr& ms_) : event(event_), ms(ms_) { } - Event() : event(WRITE), ms(0) { } -}; - -struct ClearEvent { - void operator()(Event& evt) { - evt.ms = 0; - } -}; - -class Writer : public Thread { -public: - Writer() : stop(false) { - } - - void addWriter(const ManagedSocketPtr& ms) { - if(stop) - return; -/* - Event* ev = pool.get(); - *ev = Event(Event::WRITE, ms); - ::write(event[0], &ev, sizeof(ev));*/ - } - - void addAllWriters() { - if(stop) - return; -/* Event* ev = pool.get(); - *ev = Event(Event::WRITE_ALL, 0); - ::write(event[0], &ev, sizeof(ev));*/ - } - - void addDisconnect(const ManagedSocketPtr& ms) { - if(stop) - return; - - Event* ev = pool.get(); - *ev = Event(Event::DISCONNECT, ms); - ::write(event[0], &ev, sizeof(ev)); - } - - void shutdown() { - stop = true; - - Event* ev = pool.get(); - *ev = Event(Event::SHUTDOWN, 0); - ::write(event[0], &ev, sizeof(ev)); - - join(); - } - - void getErrors(SocketManager::ErrorMap& acceptErrors_, SocketManager::ErrorMap& readErrors_, SocketManager::ErrorMap& writeErrors_) { - FastMutex::Lock l(errorMutex); - acceptErrors_ = acceptErrors; - readErrors_ = readErrors; - writeErrors_ = writeErrors; - } - -private: - bool init() { - if(!poller.init()) { - LOGDT(SocketManager::className, "Unable to create initialize epoll: " + Util::translateError(errno)); - return false; - } - - try { - srv.listen(SETTING(SERVER_PORT)); - srv.setBlocking(false); - } catch(const SocketException& e) { - LOGDT(SocketManager::className, "Unable to create server socket: " + e.getError()); - return false; - } - - if(!poller.associate(srv.getSocket())) { - LOGDT(SocketManager::className, "Unable to set epoll: " + Util::translateError(errno)); - return false; - } - - if(socketpair(AF_UNIX, SOCK_STREAM, 0, event) == -1) { - LOGDT(SocketManager::className, "Unable to create event socketpair: " + Util::translateError(errno)); - return false; - } - if(!poller.associate(event[1])) { - LOGDT(SocketManager::className, "Unable to associate event: " + Util::translateError(errno)); - return false; - } - return true; - } - - virtual int run() { - LOGDT(SocketManager::className, "Writer starting"); - if(!init()) { - return 0; - } - - uint32_t lastWrite = 0; - std::vector<epoll_event> events; - while(!stop || !active.empty()) { - events.clear(); - - if(!poller.get(events)) { - LOGDT(SocketManager::className, "Poller failed: " + Util::translateError(errno)); - } - bool doevents = false; - for(std::vector<epoll_event>::iterator i = events.begin(); i != events.end(); ++i) { - epoll_event& ev = *i; - if(ev.data.fd == srv.getSocket()) { - accept(); - } else if(ev.data.fd == event[1]) { - doevents = true; - } else { - ManagedSocketPtr ms(reinterpret_cast<ManagedSocket*>(ev.data.ptr)); - if(ev.events & (EPOLLIN | EPOLLHUP | EPOLLERR)) { - if(!read(ms)) - continue; - } - if(ev.events & EPOLLOUT) { - write(ms); - } + ManagedSocketPtr ms(reinterpret_cast<ManagedSocket*>(ev.data.ptr)); + if(ev.events & (EPOLLIN | EPOLLHUP | EPOLLERR)) { + if(!read(ms)) + continue; } + if(ev.events & EPOLLOUT) { + ms->setBlocked(false); + } } - - if(doevents) { - handleEvents(); - } - - uint32_t now = GET_TICK(); - if(now > lastWrite + WRITE_TIMEOUT) { - checkDisconnects(); - writeAll(); - lastWrite = now; - } } - LOGDT(SocketManager::className, "Writer shutting down"); - return 0; } - - void handleEvents() { - while(true) { - size_t start = ev.size(); - ev.resize(64 * sizeof(Event*)); - int bytes = ::recv(event[1], &ev[0] + start, ev.size() - start, MSG_DONTWAIT); - if(bytes == -1) { - ev.resize(start); - int err = errno; - if(err == EAGAIN) { - return; - } - LOGDT(SocketManager::className, "Error reading from event[1]: " + Util::translateError(err)); - return; - } - ev.resize(bytes); - size_t events = bytes / sizeof(Event*); - for(size_t i = 0; i < events; ++i) { - Event** ee = reinterpret_cast<Event**>(&ev[i*sizeof(Event*)]); - Event* e = *ee; - switch(e->event) { - case Event::WRITE: { - write(e->ms); - } break; - case Event::WRITE_ALL: { - writeAll(); - } break; - case Event::DISCONNECT: { - disconnect(e->ms); - } break; - case Event::REMOVE: { - failRead(e->ms, 0); - } break; - case Event::SHUTDOWN: { - handleShutdown(); - } break; - } - pool.put(e); - } - ev.erase(ev.begin(), ev.begin() + events*sizeof(Event*)); - } - } - - void accept() throw() { + + void accept() { ManagedSocketPtr ms(new ManagedSocket()); try { ms->setIp(ms->sock.accept(srv)); @@ -812,15 +531,11 @@ read(ms); } catch (const SocketException& e) { LOGDT(SocketManager::className, "Unable to create socket: " + e.getError()); - if(e.getErrorCode() != 0) { - FastMutex::Lock l(errorMutex); - acceptErrors[e.getErrorCode()]++; - } return; } } - bool read(const ManagedSocketPtr& ms) throw() { + bool read(const ManagedSocketPtr& ms) { if(stop || !(*ms)) return false; @@ -834,14 +549,16 @@ Util::freeBuf = readBuf; int error = errno; - if(error != EAGAIN) { - failRead(ms, error); + if(error != EAGAIN && error != EINTR) { + ms->close(); + disconnect(ms, error); return false; } break; } else if(bytes == 0) { Util::freeBuf = readBuf; - failRead(ms, 0); + ms->close(); + disconnect(ms, 0); return false; } @@ -851,28 +568,7 @@ return true; } - void failRead(const ManagedSocketPtr& ms, int error) throw() { - if(!(*ms)) { - return; - } - - SocketSet::iterator i = disconnecting.find(ms); - if(i == disconnecting.end()) { - ms->failSocket(); - } else { - disconnecting.erase(i); - } - - poller.remove(ms); - ms->close(); - active.erase(ms); - if(error != 0) { - FastMutex::Lock l(errorMutex); - readErrors[error]++; - } - } - - void write(const ManagedSocketPtr& ms) throw() { + void write(const ManagedSocketPtr& ms) { if(stop || !(*ms)) { return; } @@ -881,8 +577,9 @@ ByteVector* writeBuf = ms->prepareWrite(); if(!writeBuf) { - if(ms->disc) { - addRemove(ms); + uint32_t now = GET_TICK(); + if(ms->disc || (ms->isBlocked() && ms->disc < now)) { + disconnect(ms, 0); } return; } @@ -895,7 +592,7 @@ return; } Util::freeBuf = writeBuf; - failWrite(ms, error); + disconnect(ms, error); return; } if(!ms->completeWrite(writeBuf, bytes)) { @@ -903,87 +600,88 @@ } } } - - void failWrite(const ManagedSocketPtr& ms, int error) throw() { - addRemove(ms); - if(error != 0) { - FastMutex::Lock l(errorMutex); - writeErrors[error]++; + + void handleShutdown() { + char buf; + int bytes = ::recv(event[1], &buf, 1, MSG_DONTWAIT); + if(bytes == -1) { + + int err = errno; + if(err == EAGAIN || err == EINTR) { + return; + } + LOGDT(SocketManager::className, "Error reading from event[1]: " + Util::translateError(err)); + return; } + + srv.disconnect(); + + for(SocketSet::iterator i = active.begin(); i != active.end(); ++i) { + disconnect(*i, 0); + } } + +#endif void writeAll() throw() { - for(SocketSet::iterator i = active.begin(); i != active.end(); ++i) { + if(active.empty()) { + return; + } + SocketSet::iterator start = active.begin(); + SocketSet::iterator end = active.end(); + SocketSet::iterator mid = start; + // Start at a random position each time in order not to favorise the first sockets... + std::advance(mid, Util::rand(active.size())); + + for(SocketSet::iterator i = mid; i != end; ++i) { write(*i); } + for(SocketSet::iterator i = start; i != mid; ++i) { + write(*i); + } } - void disconnect(const ManagedSocketPtr& ms) throw() { - if(!(*ms)) - return; - + void disconnect(const ManagedSocketPtr& ms, int error) { if(disconnecting.find(ms) != disconnecting.end()) { return; } - + disconnecting.insert(ms); - ms->failSocket(); - write(ms); + + ms->failSocket(error); } - void checkDisconnects() throw() { - uint32_t now = GET_TICK(); + void removeDisconnected() { for(SocketSet::iterator i = disconnecting.begin(); i != disconnecting.end(); ++i) { - const ManagedSocketPtr& ms = *i; - if(ms->disc + (uint32_t)SETTING(DISCONNECT_TIMEOUT) < now) { - ms->shutdown(); - } + (*i)->close(); + active.erase(*i); } } - void handleShutdown() throw() { - srv.disconnect(); - - for(SocketSet::iterator i = active.begin(); i != active.end(); ++i) { - addRemove(*i); - } - } - - // This is needed because calling close() on the socket - // will remove it from the epoll set (so the main loop won't - // be notified) - void addRemove(const ManagedSocketPtr& ms) { - Event* ev = pool.get(); - *ev = Event(Event::REMOVE, ms); - ::write(event[0], &ev, sizeof(ev)); - } - - EPoll poller; + Poller poller; Socket srv; - FastMutex errorMutex; - SocketManager::ErrorMap acceptErrors; - SocketManager::ErrorMap readErrors; - SocketManager::ErrorMap writeErrors; - bool stop; - - int event[2]; - std::vector<uint8_t> ev; - Pool<Event, ClearEvent> pool; - - typedef std::tr1::unordered_set<ManagedSocketPtr, PointerHash<ManagedSocket> > SocketSet; + typedef unordered_set<ManagedSocketPtr, PointerHash<ManagedSocket> > SocketSet; /** Sockets that have a pending read */ SocketSet active; /** Sockets that are being written to but should be disconnected if timeout it reached */ SocketSet disconnecting; -}; - + +#ifdef _WIN32 + Pool<MSOverlapped, ClearOverlapped> pool; + static const size_t PREPARED_SOCKETS = 32; + + /** Sockets that have a pending accept */ + SocketSet accepting; #else -#error No socket implementation for your platform -#endif // _WIN32 + int event[2]; + +#endif +}; + SocketManager::SocketManager() : writer(new Writer()) { } @@ -998,10 +696,12 @@ writer->start(); writer->setThreadPriority(Thread::HIGH); + ProcessQueue workQueue; + while(true) { processSem.wait(); { - FastMutex::Lock l(processCS); + FastMutex::Lock l(processMutex); workQueue.swap(processQueue); } for(ProcessQueue::iterator i = workQueue.begin(); i != workQueue.end(); ++i) { @@ -1018,19 +718,16 @@ } void SocketManager::addWriter(const ManagedSocketPtr& ms) throw() { - writer->addWriter(ms); } void SocketManager::addAllWriters() throw() { - writer->addAllWriters(); } void SocketManager::addDisconnect(const ManagedSocketPtr& ms) throw() { - writer->addDisconnect(ms); } void SocketManager::addJob(const Callback& callback) throw() { - FastMutex::Lock l(processCS); + FastMutex::Lock l(processMutex); processQueue.push_back(callback); processSem.signal(); @@ -1045,8 +742,4 @@ writer.release(); } -void SocketManager::getErrors(ErrorMap& acceptErrors_, ErrorMap& readErrors_, ErrorMap& writeErrors_) { - writer->getErrors(acceptErrors_, readErrors_, writeErrors_); } - -} Modified: adchpp/trunk/adchpp/SocketManager.h =================================================================== --- adchpp/trunk/adchpp/SocketManager.h 2007-12-04 22:04:21 UTC (rev 98) +++ adchpp/trunk/adchpp/SocketManager.h 2007-12-09 18:44:45 UTC (rev 99) @@ -23,8 +23,8 @@ #include "forward.h" #include "Thread.h" -#include "Semaphores.h" #include "Mutex.h" +#include "Semaphores.h" #include "Singleton.h" namespace adchpp { @@ -37,15 +37,13 @@ void startup() throw(ThreadException) { start(); } void shutdown(); - void addWriter(const boost::intrusive_ptr<ManagedSocket>& ms) throw(); - void addDisconnect(const boost::intrusive_ptr<ManagedSocket>& ms) throw(); + void addWriter(const ManagedSocketPtr& ms) throw(); + void addDisconnect(const ManagedSocketPtr& ms) throw(); void addAllWriters() throw(); typedef std::tr1::function<void (const ManagedSocketPtr&)> IncomingHandler; void setIncomingHandler(const IncomingHandler& handler) { incomingHandler = handler; } - typedef std::tr1::unordered_map<int, size_t> ErrorMap; - ADCHPP_DLL void getErrors(ErrorMap& acceptErrors_, ErrorMap& readErrors_, ErrorMap& writeErrors_); private: friend class ManagedSocket; friend class Writer; @@ -54,10 +52,9 @@ typedef std::vector<Callback> ProcessQueue; - FastMutex processCS; + FastMutex processMutex; ProcessQueue processQueue; - ProcessQueue workQueue; Semaphore processSem; Modified: adchpp/trunk/adchpp/Util.cpp =================================================================== --- adchpp/trunk/adchpp/Util.cpp 2007-12-04 22:04:21 UTC (rev 98) +++ adchpp/trunk/adchpp/Util.cpp 2007-12-09 18:44:45 UTC (rev 99) @@ -123,6 +123,7 @@ // Only the server should be left now... aServer = url.substr(i, k-i); } + string Util::toAcp(const wstring& wString) { if(wString.empty()) return emptyString; Modified: adchpp/trunk/plugins/Script/examples/access.lua =================================================================== --- adchpp/trunk/plugins/Script/examples/access.lua 2007-12-04 22:04:21 UTC (rev 98) +++ adchpp/trunk/plugins/Script/examples/access.lua 2007-12-09 18:44:45 UTC (rev 99) @@ -483,27 +483,6 @@ end end - sm = adchpp.getSocketManager() - a = sm:getAcceptErrors() - r = sm:getReadErrors() - w = sm:getWriteErrors() - str = str .. "\nSocket errors: \n" - str = str .. " - Accept errors: \n" - for i = 0, a:size()-1 do - e = a[i] - str = str .. e.first .. "\t" .. e.second .. "\t" .. adchpp.Util_translateError(e.first) .. "\n" - end - str = str .. " - Read errors: \n" - for i = 0, r:size()-1 do - e = r[i] - str = str .. e.first .. "\t" .. e.second .. "\t" .. adchpp.Util_translateError(e.first) .. "\n" - end - str = str .. " - Write errors: \n" - for i = 0, w:size()-1 do - e = w[i] - str = str .. e.first .. "\t" .. e.second .. "\t" .. adchpp.Util_translateError(e.first) .. "\n" - end - local queued = cm:getQueuedBytes() local queueBytes = adchpp.Stats_queueBytes local queueCalls = adchpp.Stats_queueCalls Modified: adchpp/trunk/readme.txt =================================================================== --- adchpp/trunk/readme.txt 2007-12-04 22:04:21 UTC (rev 98) +++ adchpp/trunk/readme.txt 2007-12-09 18:44:45 UTC (rev 99) @@ -18,7 +18,7 @@ gcc 4.2+ (linux or mingw) boost (http://www.boost.org) scons (http://www.scons.org) -swig 1.3.31 +swig 1.3.33 ** Important!! The hub will _NOT_ run on Win9x/ME. ** Modified: adchpp/trunk/swig/adchpp.i =================================================================== --- adchpp/trunk/swig/adchpp.i 2007-12-04 22:04:21 UTC (rev 98) +++ adchpp/trunk/swig/adchpp.i 2007-12-09 18:44:45 UTC (rev 99) @@ -516,35 +516,6 @@ class SocketManager { public: - %extend { - std::vector<std::pair<int, size_t> > getAcceptErrors() { - std::vector<std::pair<int, size_t> > tmp; - adchpp::SocketManager::ErrorMap a, r, w; - self->getErrors(a, r, w); - for(SocketManager::ErrorMap::iterator i = a.begin(); i != a.end(); ++i) { - tmp.push_back(std::make_pair(i->first, i->second)); - } - return tmp; - } - std::vector<std::pair<int, size_t> > getReadErrors() { - std::vector<std::pair<int, size_t> > tmp; - adchpp::SocketManager::ErrorMap a, r, w; - self->getErrors(a, r, w); - for(SocketManager::ErrorMap::iterator i = r.begin(); i != r.end(); ++i) { - tmp.push_back(std::make_pair(i->first, i->second)); - } - return tmp; - } - std::vector<std::pair<int, size_t> > getWriteErrors() { - std::vector<std::pair<int, size_t> > tmp; - adchpp::SocketManager::ErrorMap a, r, w; - self->getErrors(a, r, w); - for(SocketManager::ErrorMap::iterator i = w.begin(); i != w.end(); ++i) { - tmp.push_back(std::make_pair(i->first, i->second)); - } - return tmp; - } - } }; class ClientManager Modified: adchpp/trunk/swig/lua.i =================================================================== --- adchpp/trunk/swig/lua.i 2007-12-04 22:04:21 UTC (rev 98) +++ adchpp/trunk/swig/lua.i 2007-12-09 18:44:45 UTC (rev 99) @@ -1,5 +1,6 @@ %module luadchpp + typedef unsigned int size_t; %wrapper %{ Modified: adchpp/trunk/swig/python.i =================================================================== --- adchpp/trunk/swig/python.i 2007-12-04 22:04:21 UTC (rev 98) +++ adchpp/trunk/swig/python.i 2007-12-09 18:44:45 UTC (rev 99) @@ -1,5 +1,6 @@ %module pyadchpp + %{ // Python pollution #undef socklen_t Modified: adchpp/trunk/test/PyClient.py =================================================================== --- adchpp/trunk/test/PyClient.py 2007-12-04 22:04:21 UTC (rev 98) +++ adchpp/trunk/test/PyClient.py 2007-12-09 18:44:45 UTC (rev 99) @@ -1,7 +1,7 @@ #!/usr/bin/python import sys -sys.path.append('../build/debug-mingw/bin') +sys.path.append('../build/debug-default/bin') CLIENTS = 100 @@ -60,7 +60,7 @@ def login(self, ipport): self.connect(ipport) cmd = AdcCommand(AdcCommand.CMD_SUP, AdcCommand.TYPE_HUB, 0) - cmd.addParam("ADBASE") + cmd.addParam("ADBASE").addParam("ADTIGR") self.command(cmd) self.expect(AdcCommand.CMD_SUP) sid = self.expect(AdcCommand.CMD_SID) Modified: adchpp/trunk/unix/po/adchppd.pot =================================================================== --- adchpp/trunk/unix/po/adchppd.pot 2007-12-04 22:04:21 UTC (rev 98) +++ adchpp/trunk/unix/po/adchppd.pot 2007-12-09 18:44:45 UTC (rev 99) @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: \"adchpp\"--copyright-holder=\"Jacek Sieka\"\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2007-11-25 22:39+0100\n" +"POT-Creation-Date: 2007-12-09 18:46+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL...@li...>\n" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2007-12-04 22:04:23
|
Revision: 98 http://adchpp.svn.sourceforge.net/adchpp/?rev=98&view=rev Author: arnetheduck Date: 2007-12-04 14:04:21 -0800 (Tue, 04 Dec 2007) Log Message: ----------- More access fixes Modified Paths: -------------- adchpp/trunk/adchpp/ClientManager.cpp adchpp/trunk/plugins/Script/examples/access.lua adchpp/trunk/swig/adchpp.i Modified: adchpp/trunk/adchpp/ClientManager.cpp =================================================================== --- adchpp/trunk/adchpp/ClientManager.cpp 2007-12-02 22:01:57 UTC (rev 97) +++ adchpp/trunk/adchpp/ClientManager.cpp 2007-12-04 22:04:21 UTC (rev 98) @@ -265,21 +265,22 @@ return true; } -bool ClientManager::verifyPassword(Client& c, const string& password, const vector<uint8_t>& salt, +bool ClientManager::verifyPassword(Client& c, const string& password, const ByteVector& salt, const string& suppliedHash) { TigerHash tiger; tiger.update(&password[0], password.size()); tiger.update(&salt[0], salt.size()); uint8_t tmp[TigerHash::HASH_SIZE]; Encoder::fromBase32(suppliedHash.c_str(), tmp, TigerHash::HASH_SIZE); - if (memcmp(tiger.finalize(), tmp, TigerHash::HASH_SIZE) == 0) + if (memcmp(tiger.finalize(), tmp, TigerHash::HASH_SIZE) == 0) { return true; + } if (!COMPATIBILITY) return false; TigerHash tiger2; - // Support dc++ 0.69 for a while + // Support dc++ <=0.703 for a while string cid = c.getCID().toBase32(); tiger2.update(c.getCID().data(), CID::SIZE); tiger2.update(&password[0], password.size()); Modified: adchpp/trunk/plugins/Script/examples/access.lua =================================================================== --- adchpp/trunk/plugins/Script/examples/access.lua 2007-12-02 22:01:57 UTC (rev 97) +++ adchpp/trunk/plugins/Script/examples/access.lua 2007-12-04 22:04:21 UTC (rev 98) @@ -158,14 +158,14 @@ end local function dump(c, code, msg) - answer = adchpp.AdcCommand(adchpp.CMD_STA, adchpp.TYPE_INFO, adchpp.HUB_SID) - answer:addParam("" .. adchpp.SEV_FATAL .. code):addParam(msg) + answer = adchpp.AdcCommand(adchpp.AdcCommand_CMD_STA, adchpp.AdcCommand_TYPE_INFO, adchpp.AdcCommand_HUB_SID) + answer:addParam("" .. tostring(adchpp.AdcCommand_SEV_FATAL) .. code):addParam(msg) c:send(answer) c:disconnect() end local function reply(c, msg) - answer = adchpp.AdcCommand(adchpp.CMD_MSG, adchpp.TYPE_INFO, adchpp.HUB_SID) + answer = adchpp.AdcCommand(adchpp.AdcCommand_CMD_MSG, adchpp.AdcCommand_TYPE_INFO, adchpp.AdcCommand_HUB_SID) answer:addParam(msg) c:send(answer) end @@ -248,31 +248,31 @@ end if #cmd:getParam("HI", 0) > 0 then - dump(c, adchpp.ERROR_PROTOCOL_GENERIC, "Don't hide") + dump(c, adchpp.AdcCommand_ERROR_PROTOCOL_GENERIC, "Don't hide") return command_processed end if #cmd:getParam("OP", 0) > 0 then - dump(c, adchpp.ERROR_PROTOCOL_GENERIC, "I decide who's an OP") + dump(c, adchpp.AdcCommand_ERROR_PROTOCOL_GENERIC, "I decide who's an OP") return command_processed end if #cmd:getParam("RG", 0) > 0 then - dump(c, adchpp.ERROR_PROTOCOL_GENERIC, "I decide who's registered") + dump(c, adchpp.AdcCommand_ERROR_PROTOCOL_GENERIC, "I decide who's registered") return command_processed end if #cmd:getParam("HU", 0) > 0 then - dump(c, adchpp.ERROR_PROTOCOL_GENERIC, "I'm the hub, not you") + dump(c, adchpp.AdcCommand_ERROR_PROTOCOL_GENERIC, "I'm the hub, not you") return command_processed end if #cmd:getParam("BO", 0) > 0 then - dump(c, adchpp.ERROR_PROTOCOL_GENERIC, "You're not a bot") + dump(c, adchpp.AdcCommand_ERROR_PROTOCOL_GENERIC, "You're not a bot") return command_processed end - if c:getState() == adchpp.STATE_NORMAL then + if c:getState() == adchpp.Client_STATE_NORMAL then return 0 end @@ -280,7 +280,7 @@ local cid = cmd:getParam("ID", 0) if #nick == 0 or #cid == 0 then - dump(c, adchpp.ERROR_PROTOCOL_GENERIC, "No valid nick/CID supplied") + dump(c, adchpp.AdcCommand_ERROR_PROTOCOL_GENERIC, "No valid nick/CID supplied") return command_processed end @@ -304,15 +304,15 @@ end local function onPAS(c, cmd) - if c:getState() ~= adchpp.STATE_VERIFY then - dump(c, adchpp.ERROR_PROTOCOL_GENERIC, "Not in VERIFY state") + if c:getState() ~= adchpp.Client_STATE_VERIFY then + dump(c, adchpp.AdcCommand_ERROR_PROTOCOL_GENERIC, "Not in VERIFY state") return command_processed end local salt = salts[c:getSID()] if not salt then - dump(c, adchpp.ERROR_PROTOCOL_GENERIC, "You didn't get any salt?") + dump(c, adchpp.AdcCommand_ERROR_PROTOCOL_GENERIC, "You didn't get any salt?") return command_processed end @@ -322,7 +322,7 @@ local user = get_user(c:getCID():toBase32(), c:getField("NI")) if not user then print("User sending PAS not found (?)") - dump(c, adchpp.ERROR_PROTOCOL_GENERIC, "Can't find you now") + dump(c, adchpp.AdcCommand_ERROR_PROTOCOL_GENERIC, "Can't find you now") return command_processed end @@ -332,13 +332,13 @@ end if not cm:verifyPassword(c, password, salt, cmd:getParam(0)) then - dump(c, adchpp.ERROR_BAD_PASSWORD, "Invalid password") + dump(c, adchpp.AdcCommand_ERROR_BAD_PASSWORD, "Invalid password") return command_processed end local updateOk, message = update_user(user, cid:toBase32(), nick) if not updateOk then - dump(c, adchpp.ERROR_PROTOCOL_GENERIC, message) + dump(c, adchpp.AdcCommand_ERROR_PROTOCOL_GENERIC, message) return command_processed end @@ -351,7 +351,7 @@ if user.level > 1 and c:supports("UCMD") then for k, v in pairs(user_commands) do - ucmd = adchpp.AdcCommand(adchpp.CMD_CMD, adchpp.TYPE_INFO, adchpp.HUB_SID) + ucmd = adchpp.AdcCommand(adchpp.AdcCommand_CMD_CMD, adchpp.AdcCommand_TYPE_INFO, adchpp.AdcCommand_HUB_SID) ucmd:addParam(k) ucmd:addParam("TT", v) ucmd:addParam("CT", "2") @@ -386,7 +386,7 @@ local function onMSG(c, cmd) msg = cmd:getParam(0) - + print("got message") local command, parameters = msg:match("^%+(%a+) ?(.*)") if not command then @@ -402,28 +402,28 @@ if command == "test" then reply(c, "Test ok") - return adchpp.DONT_SEND + return adchpp.AdcCommand_DONT_SEND elseif command == "error" then xxxxyyyy() - return adchpp.DONT_SEND + return adchpp.AdcCommand_DONT_SEND elseif command == "help" then reply(c, "+test, +help, +regme password, +regnick nick password level") - return adchpp.DONT_SEND + return adchpp.AdcCommand_DONT_SEND elseif command == "regme" then if not parameters:match("%S+") then reply(c, "You need to supply a password without whitespace") - return adchpp.DONT_SEND + return adchpp.AdcCommand_DONT_SEND end register_user(c:getCID():toBase32(), c:getField("NI"), parameters, 1) reply(c, "You're now registered") - return adchpp.DONT_SEND + return adchpp.AdcCommand_DONT_SEND elseif command == "regnick" then local nick, password, level = parameters:match("^(%S+) (%S+) (%d+)") if not nick or not password or not level then reply(c, "You must supply nick, password and level!") - return adchpp.DONT_SEND + return adchpp.AdcCommand_DONT_SEND end level = tonumber(level) @@ -439,17 +439,17 @@ if not my_user then reply(c, "Only registered users may register others") - return adchpp.DONT_SEND + return adchpp.AdcCommand_DONT_SEND end if level >= my_user.level then reply(c, "You may only register to a lower level than your own") - return adchpp.DONT_SEND + return adchpp.AdcCommand_DONT_SEND end if level < 1 then reply(c, "Level too low") - return adchpp.DONT_SEND + return adchpp.AdcCommand_DONT_SEND end register_user(cid, nick, password, level) @@ -460,7 +460,7 @@ reply(other, "You've been registered with password " .. password) end - return adchpp.DONT_SEND + return adchpp.AdcCommand_DONT_SEND elseif command == "stats" then local now = os.time() local scripttime = os.difftime(now, start_time) @@ -522,7 +522,7 @@ str = str .. recvCalls .. "\tReceive calls (" .. adchpp.Util_formatBytes(recvBytes/recvCalls) .. "/call)\n" reply(c, str) - return adchpp.DONT_SEND + return adchpp.AdcCommand_DONT_SEND end return 0 @@ -543,7 +543,6 @@ end local function onReceive(c, cmd, override) - cmdstr = cmd:getCommandString() if stats[cmdstr] then stats[cmdstr] = stats[cmdstr] + 1 @@ -564,7 +563,7 @@ end end - if c:getState() == adchpp.STATE_NORMAL then + if c:getState() == adchpp.Client_STATE_NORMAL then local allowed_level = command_min_levels[cmd:getCommand()] if allowed_level then user = get_user(c:getCID(), c:getField("NI")) @@ -575,12 +574,13 @@ end end end - - if cmd:getCommand() == adchpp.CMD_INF then + + print("command is " .. cmd:getCommand() .. " msg is " .. adchpp.AdcCommand_CMD_MSG) + if cmd:getCommand() == adchpp.AdcCommand_CMD_INF then return onINF(c, cmd) - elseif cmd:getCommand() == adchpp.CMD_PAS then + elseif cmd:getCommand() == adchpp.AdcCommand_CMD_PAS then return onPAS(c, cmd) - elseif cmd:getCommand() == adchpp.CMD_MSG then + elseif cmd:getCommand() == adchpp.AdcCommand_CMD_MSG then return onMSG(c, cmd) elseif cmd:getCommandString() == "DSC" then return onDSC(c, cmd) Modified: adchpp/trunk/swig/adchpp.i =================================================================== --- adchpp/trunk/swig/adchpp.i 2007-12-02 22:01:57 UTC (rev 97) +++ adchpp/trunk/swig/adchpp.i 2007-12-04 22:04:21 UTC (rev 98) @@ -69,12 +69,15 @@ namespace adchpp { class Client; } + %template(TErrorPair) std::pair<int, size_t>; %template(TErrorList) std::vector<std::pair<int, size_t> >; %template(TClientList) std::vector<adchpp::Client*>; %template(TStringList) std::vector<std::string>; +%template(TByteVector) std::vector<uint8_t>; + typedef std::vector<std::string> StringList; %inline%{ typedef std::vector<adchpp::Client*> ClientList; @@ -598,7 +601,7 @@ bool verifySUP(Client& c, AdcCommand& cmd) throw(); bool verifyINF(Client& c, AdcCommand& cmd) throw(); bool verifyNick(Client& c, const AdcCommand& cmd) throw(); - bool verifyPassword(Client& c, const std::string& password, const vector<uint8_t>& salt, const std::string& suppliedHash); + bool verifyPassword(Client& c, const std::string& password, const ByteVector& salt, const std::string& suppliedHash); bool verifyIp(Client& c, AdcCommand& cmd) throw(); bool verifyCID(Client& c, AdcCommand& cmd) throw(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2007-12-04 21:17:21
|
Revision: 928 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=928&view=rev Author: arnetheduck Date: 2007-12-04 13:17:15 -0800 (Tue, 04 Dec 2007) Log Message: ----------- Adc fixes Modified Paths: -------------- dcplusplus/trunk/changelog.txt dcplusplus/trunk/dcpp/AdcCommand.h dcplusplus/trunk/dcpp/AdcHub.cpp dcplusplus/trunk/dcpp/AdcHub.h dcplusplus/trunk/dcpp/BloomFilter.h Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2007-12-04 18:38:49 UTC (rev 927) +++ dcplusplus/trunk/changelog.txt 2007-12-04 21:17:15 UTC (rev 928) @@ -24,6 +24,7 @@ * Fixed socket ip bind (thanks garg's quasi-friend) * Finished UCMD extension draft implementation * Fixed status bars (poy) +* Fixed protocol error STA being sent as type C -- 0.703 2007-11-08 -- * Fixed invalid strings (thanks james ross) Modified: dcplusplus/trunk/dcpp/AdcCommand.h =================================================================== --- dcplusplus/trunk/dcpp/AdcCommand.h 2007-12-04 18:38:49 UTC (rev 927) +++ dcplusplus/trunk/dcpp/AdcCommand.h 2007-12-04 21:17:15 UTC (rev 928) @@ -106,7 +106,7 @@ C(CMD, 'C','M','D'); #undef C - static const uint32_t HUB_SID = 0x41414141; // AAAA in base32 + static const uint32_t HUB_SID = 0xffffffff; // No client will have this sid explicit AdcCommand(uint32_t aCmd, char aType = TYPE_CLIENT); explicit AdcCommand(uint32_t aCmd, const uint32_t aTarget, char aType); Modified: dcplusplus/trunk/dcpp/AdcHub.cpp =================================================================== --- dcplusplus/trunk/dcpp/AdcHub.cpp 2007-12-04 18:38:49 UTC (rev 927) +++ dcplusplus/trunk/dcpp/AdcHub.cpp 2007-12-04 21:17:15 UTC (rev 928) @@ -45,7 +45,7 @@ const string AdcHub::TIGR_SUPPORT("ADTIGR"); const string AdcHub::UCM0_SUPPORT("ADUCM0"); -AdcHub::AdcHub(const string& aHubURL, bool secure) : Client(aHubURL, '\n', secure), sid(0) { +AdcHub::AdcHub(const string& aHubURL, bool secure) : Client(aHubURL, '\n', secure), oldPassword(false), sid(0) { TimerManager::getInstance()->addListener(this); } @@ -54,7 +54,6 @@ clearUsers(); } - OnlineUser& AdcHub::getUser(const uint32_t aSID, const CID& aCID) { OnlineUser* ou = findUser(aSID); if(ou) { @@ -208,6 +207,7 @@ socket->disconnect(false); return; } else if(!tigrOk) { + oldPassword = true; // What now? Some hubs fake BASE support without TIGR support =/ fire(ClientListener::StatusMessage(), this, "Hub probably uses an old version of ADC, please encourage the owner to upgrade"); } @@ -266,7 +266,7 @@ putUser(s); // No use to hammer if we're banned - if(s == sid && c.hasFlag("TL", 1)) { + if(s == sid && c.hasFlag("TL", 1)) { setAutoReconnect(false); } } @@ -295,7 +295,7 @@ } else if(protocol == SECURE_CLIENT_PROTOCOL_TEST && CryptoManager::getInstance()->TLSOk()) { secure = true; } else { - AdcCommand cmd(AdcCommand::SEV_FATAL, AdcCommand::ERROR_PROTOCOL_UNSUPPORTED, "Protocol unknown"); + AdcCommand cmd(AdcCommand::SEV_FATAL, AdcCommand::ERROR_PROTOCOL_UNSUPPORTED, "Protocol unknown", AdcCommand::TYPE_DIRECT); cmd.setTo(c.getFrom()); cmd.addParam("PR", protocol); @@ -334,7 +334,7 @@ } else if(protocol == SECURE_CLIENT_PROTOCOL_TEST && CryptoManager::getInstance()->TLSOk()) { secure = true; } else { - AdcCommand cmd(AdcCommand::SEV_FATAL, AdcCommand::ERROR_PROTOCOL_UNSUPPORTED, "Protocol unknown"); + AdcCommand cmd(AdcCommand::SEV_FATAL, AdcCommand::ERROR_PROTOCOL_UNSUPPORTED, "Protocol unknown", AdcCommand::TYPE_DIRECT); cmd.setTo(c.getFrom()); cmd.addParam("PR", protocol); @@ -460,7 +460,7 @@ if(state != STATE_NORMAL) return; - const string* proto = 0; + const string* proto; if(secure) { if(user.getUser()->isSet(User::NO_ADCS_0_10_PROTOCOL)) { /// @todo log @@ -468,7 +468,8 @@ } proto = &SECURE_CLIENT_PROTOCOL_TEST; } else { - if(user.getUser()->isSet(User::NO_ADC_1_0_PROTOCOL)) { + // dc++ <= 0.703 has a bug which makes it respond with CSTA to the hub if an unrecognised protocol is used *sigh* + if(true || user.getUser()->isSet(User::NO_ADC_1_0_PROTOCOL)) { if(user.getUser()->isSet(User::NO_ADC_0_10_PROTOCOL)) { /// @todo log return; @@ -547,8 +548,10 @@ AutoArray<uint8_t> buf(saltBytes); Encoder::fromBase32(salt.c_str(), buf, saltBytes); TigerHash th; - CID cid = getMyIdentity().getUser()->getCID(); - th.update(cid.data(), CID::SIZE); + if(oldPassword) { + CID cid = getMyIdentity().getUser()->getCID(); + th.update(cid.data(), CID::SIZE); + } th.update(pwd.data(), pwd.length()); th.update(buf, saltBytes); send(AdcCommand(AdcCommand::CMD_PAS, AdcCommand::TYPE_HUB).addParam(Encoder::toBase32(th.finalize(), TigerHash::HASH_SIZE))); @@ -659,8 +662,8 @@ send(cmd.toString(sid)); } -void AdcHub::on(Connected) throw() { - Client::on(Connected()); +void AdcHub::on(Connected c) throw() { + Client::on(c); lastInfoMap.clear(); sid = 0; @@ -674,8 +677,8 @@ send(cmd); } -void AdcHub::on(Line, const string& aLine) throw() { - Client::on(Line(), aLine); +void AdcHub::on(Line l, const string& aLine) throw() { + Client::on(l, aLine); if(BOOLSETTING(ADC_DEBUG)) { fire(ClientListener::StatusMessage(), this, "<ADC>" + aLine + "</ADC>"); @@ -683,13 +686,13 @@ dispatch(aLine); } -void AdcHub::on(Failed, const string& aLine) throw() { +void AdcHub::on(Failed f, const string& aLine) throw() { clearUsers(); - Client::on(Failed(), aLine); + Client::on(f, aLine); } -void AdcHub::on(Second, uint32_t aTick) throw() { - Client::on(Second(), aTick); +void AdcHub::on(Second s, uint32_t aTick) throw() { + Client::on(s, aTick); if(state == STATE_NORMAL && (aTick > (getLastActivity() + 120*1000)) ) { send("\n", 1); } Modified: dcplusplus/trunk/dcpp/AdcHub.h =================================================================== --- dcplusplus/trunk/dcpp/AdcHub.h 2007-12-04 18:38:49 UTC (rev 927) +++ dcplusplus/trunk/dcpp/AdcHub.h 2007-12-04 21:17:15 UTC (rev 928) @@ -64,6 +64,7 @@ typedef unordered_map<uint32_t, OnlineUser*> SIDMap; typedef SIDMap::iterator SIDIter; + bool oldPassword; Socket udp; SIDMap users; StringMap lastInfoMap; Modified: dcplusplus/trunk/dcpp/BloomFilter.h =================================================================== --- dcplusplus/trunk/dcpp/BloomFilter.h 2007-12-04 18:38:49 UTC (rev 927) +++ dcplusplus/trunk/dcpp/BloomFilter.h 2007-12-04 21:17:15 UTC (rev 928) @@ -16,8 +16,8 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#if !defined(BLOOM_FILTER_H) -#define BLOOM_FILTER_H +#ifndef DCPLUSPLUS_DCPP_BLOOM_FILTER_H +#define DCPLUSPLUS_DCPP_BLOOM_FILTER_H #include "ZUtils.h" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <zou...@us...> - 2007-12-04 18:38:56
|
Revision: 927 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=927&view=rev Author: zouzou123gen Date: 2007-12-04 10:38:49 -0800 (Tue, 04 Dec 2007) Log Message: ----------- actually use the seed made for status bars; fixes size grips Modified Paths: -------------- dcplusplus/trunk/changelog.txt dcplusplus/trunk/win32/AspectStatus.h Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2007-12-03 22:25:40 UTC (rev 926) +++ dcplusplus/trunk/changelog.txt 2007-12-04 18:38:49 UTC (rev 927) @@ -23,6 +23,7 @@ * Close tab with middle mouse button (thanks poy) * Fixed socket ip bind (thanks garg's quasi-friend) * Finished UCMD extension draft implementation +* Fixed status bars (poy) -- 0.703 2007-11-08 -- * Fixed invalid strings (thanks james ross) Modified: dcplusplus/trunk/win32/AspectStatus.h =================================================================== --- dcplusplus/trunk/win32/AspectStatus.h 2007-12-03 22:25:40 UTC (rev 926) +++ dcplusplus/trunk/win32/AspectStatus.h 2007-12-04 18:38:49 UTC (rev 927) @@ -41,7 +41,7 @@ if(sizeGrip) { cs.style |= SBARS_SIZEGRIP; } - status = static_cast<WidgetType*>(this)->createStatusBarSections(); + status = static_cast<WidgetType*>(this)->createStatusBarSections(cs); statusTip = static_cast<WidgetType*>(this)->createToolTip(); statusTip->setTool(status, std::tr1::bind(&ThisType::handleToolTip, this)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |