o2on svn commit
o2on-****@lists*****
2009年 8月 13日 (木) 09:57:06 JST
Revision: 163 http://sourceforge.jp/projects/o2on/svn/view?view=rev&revision=163 Author: osa_p Date: 2009-08-13 09:57:06 +0900 (Thu, 13 Aug 2009) Log Message: ----------- FIX: #18169 opy2onãæ°ãã¼ã¸ã§ã³ã¨èª¤èªãã Ticket Links: :----------- http://sourceforge.jp/projects/o2on/tracker/detail/18169 Modified Paths: -------------- trunk/o2on/src.o2on/O2Node.h trunk/o2on/src.o2on/O2NodeDB.cpp trunk/o2on/src.o2on/O2Protocol.h Modified: trunk/o2on/src.o2on/O2Node.h =================================================================== --- trunk/o2on/src.o2on/O2Node.h 2009-08-09 12:21:34 UTC (rev 162) +++ trunk/o2on/src.o2on/O2Node.h 2009-08-13 00:57:06 UTC (rev 163) @@ -41,6 +41,9 @@ pubT pubkey; //local wstring ua; + wstring proto_ver; + wstring app_name; + wstring app_ver; uint status; wstring flags; time_t lastlink; Modified: trunk/o2on/src.o2on/O2NodeDB.cpp =================================================================== --- trunk/o2on/src.o2on/O2NodeDB.cpp 2009-08-09 12:21:34 UTC (rev 162) +++ trunk/o2on/src.o2on/O2NodeDB.cpp 2009-08-13 00:57:06 UTC (rev 163) @@ -53,12 +53,15 @@ O2NodeDB:: touch_preprocessor(O2Node &node) { - // O2/0.2 (o2on/0.02.0027; Win32) - if (node.ua.size() > 13) { - wstring node_ver = node.ua.substr(13, 9); - if (wcscmp(node_ver.c_str(), ver) > 0) + if (wcscmp(node.app_name.c_str(), _T(APP_NAME)) == 0) { + // ¯¶AvÈço[WÔðär + wchar_t tmpW[64]; + swprintf_s(tmpW, 64, L"%1d.%02d.%04d", APP_VER_MAJOR, APP_VER_MINOR, APP_BUILDNO); + + if (wcscmp(node.app_ver.c_str(), tmpW) > 0) NewVerDetectionFlag = true; } + if (node.port == 0) { AddPort0Node(node); return false; Modified: trunk/o2on/src.o2on/O2Protocol.h =================================================================== --- trunk/o2on/src.o2on/O2Protocol.h 2009-08-09 12:21:34 UTC (rev 162) +++ trunk/o2on/src.o2on/O2Protocol.h 2009-08-13 00:57:06 UTC (rev 163) @@ -13,6 +13,7 @@ #include "httpheader.h" #include "O2Profile.h" #include "O2Node.h" +#include "O2Version.h" @@ -230,6 +231,51 @@ return false; ascii2unicode(it->second, node.ua); + // m[hÌ[U[G[WFg©çîñðæ¾ + // O2/0.2 (o2on/0.02.0027; Win32) + // O2/0.2 (opy2on/0.00.0001; Linux x86_64) + //ÈÇuO2/vgRo[W (Av¼/Avo[W; «)v`®Å é±Æ + size_t ProtoNamePos = node.ua.find(L"O2/", 0); + if (ProtoNamePos != 0) { + // vgR¼ª©Â©çÈ¢ + return false; + } + size_t AppNamePeriodPos = node.ua.find(L" ", ProtoNamePos); + if ( AppNamePeriodPos == wstring::npos ) { + // vgREAv¼ÌæØ誩©çÈ¢ + return false; + } + node.proto_ver = node.ua.substr( 3, AppNamePeriodPos - 3 ); + size_t AppNameStartPos = node.ua.find(L"(", AppNamePeriodPos); + if (( AppNameStartPos == wstring::npos ) || ((AppNameStartPos + 1) == node.ua.size() )) { + // Av¼ÌJnÊuª©Â©çÈ¢ + return false; + } + AppNameStartPos++; + size_t AppNameEndPos = node.ua.find(L"/", AppNameStartPos); + if ( AppNameEndPos == wstring::npos ) { + // Av¼ÌI¹Êuª©Â©çÈ¢ + return false; + } + node.app_name = node.ua.substr( AppNameStartPos, AppNameEndPos - AppNameStartPos ); + if ((wcscmp(node.app_name.c_str(), _T(APP_NAME)) == 0) && ((AppNameEndPos + 1) < node.ua.size() )) { + // ¯¶AvÈço[WÔðæ¾ + AppNameEndPos++; + size_t VerEndPos = node.ua.find(L";", AppNameEndPos); + if ( VerEndPos == wstring::npos ) { + // o[WÔÌI¹Êuª©Â©çÈ¢ + return false; + } + node.app_ver = node.ua.substr(AppNameEndPos, VerEndPos - AppNameEndPos); + } +#ifdef O2DEBUG + else { + wchar_t tmpW[128]; + swprintf_s(tmpW, 128, L"ÙÈéAv:%s\n", node.app_name.c_str()); + TRACEW(tmpW); + } +#endif + return true; }