opalvoip-svn Mailing List for OpalVOIP
Brought to you by:
csoutheren,
rjongbloed
You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(71) |
Nov
(241) |
Dec
(143) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(210) |
Feb
(263) |
Mar
(214) |
Apr
(290) |
May
(203) |
Jun
(160) |
Jul
(128) |
Aug
(158) |
Sep
(376) |
Oct
(234) |
Nov
(227) |
Dec
(216) |
2009 |
Jan
(99) |
Feb
(151) |
Mar
(234) |
Apr
(143) |
May
(271) |
Jun
(244) |
Jul
(173) |
Aug
(124) |
Sep
(246) |
Oct
(178) |
Nov
(85) |
Dec
(77) |
2010 |
Jan
(101) |
Feb
(79) |
Mar
(92) |
Apr
(134) |
May
(125) |
Jun
(121) |
Jul
(61) |
Aug
(70) |
Sep
(86) |
Oct
(81) |
Nov
(65) |
Dec
(75) |
2011 |
Jan
(110) |
Feb
(119) |
Mar
(267) |
Apr
(154) |
May
(296) |
Jun
(177) |
Jul
(149) |
Aug
(124) |
Sep
(120) |
Oct
(116) |
Nov
(99) |
Dec
(121) |
2012 |
Jan
(78) |
Feb
(161) |
Mar
(323) |
Apr
(154) |
May
(190) |
Jun
(207) |
Jul
(176) |
Aug
(165) |
Sep
(137) |
Oct
(85) |
Nov
(112) |
Dec
(100) |
2013 |
Jan
(341) |
Feb
(102) |
Mar
(240) |
Apr
(216) |
May
(233) |
Jun
(226) |
Jul
(139) |
Aug
(192) |
Sep
(183) |
Oct
(211) |
Nov
(220) |
Dec
(110) |
2014 |
Jan
(203) |
Feb
(205) |
Mar
(100) |
Apr
(178) |
May
(194) |
Jun
(249) |
Jul
(136) |
Aug
(241) |
Sep
(226) |
Oct
(200) |
Nov
(94) |
Dec
(46) |
2015 |
Jan
(94) |
Feb
(74) |
Mar
(89) |
Apr
(78) |
May
(65) |
Jun
(70) |
Jul
(113) |
Aug
(176) |
Sep
(140) |
Oct
(154) |
Nov
(99) |
Dec
(115) |
2016 |
Jan
(102) |
Feb
(69) |
Mar
(97) |
Apr
(53) |
May
(42) |
Jun
(13) |
Jul
(42) |
Aug
(30) |
Sep
|
Oct
|
Nov
|
Dec
|
From: <rjo...@us...> - 2016-08-22 16:32:03
|
Revision: 34926 http://sourceforge.net/p/opalvoip/code/34926 Author: rjongbloed Date: 2016-08-22 16:32:00 +0000 (Mon, 22 Aug 2016) Log Message: ----------- Merged revision(s) 34920-34925 from ptlib/branches/v2_16: --------------------- r34924 Fixed various functions for PFilePath, in particular the Unix SetType(), while normalising behaviour for Unix/windows platforms. --------------------- r34923 Tweaked the factories to deal with static destructors being called twice with certain combinations of debug/static/plugin shared library nightmare that is glibc. --------------------- r34922 Print PTrace options in hex --------------------- r34921 Fixed GNU warning and added error message if can/cannot set file handles in service process. Revision Links: -------------- http://sourceforge.net/p/opalvoip/code/34924 http://sourceforge.net/p/opalvoip/code/34923 http://sourceforge.net/p/opalvoip/code/34922 http://sourceforge.net/p/opalvoip/code/34921 Modified Paths: -------------- ptlib/trunk/include/ptlib/filepath.h ptlib/trunk/include/ptlib/msos/ptlib/pdirect.h ptlib/trunk/include/ptlib/pfactory.h ptlib/trunk/include/ptlib/unix/ptlib/ptlib.inl ptlib/trunk/src/ptlib/common/osutils.cxx ptlib/trunk/src/ptlib/msos/ptlib.cxx ptlib/trunk/src/ptlib/msos/win32.cxx ptlib/trunk/src/ptlib/unix/osutil.cxx ptlib/trunk/src/ptlib/unix/svcproc.cxx Property Changed: ---------------- ptlib/trunk/ Index: ptlib/trunk =================================================================== --- ptlib/trunk 2016-08-22 16:17:34 UTC (rev 34925) +++ ptlib/trunk 2016-08-22 16:32:00 UTC (rev 34926) Property changes on: ptlib/trunk ___________________________________________________________________ Modified: svn:mergeinfo ## -6,7 +6,7 ## /ptlib/branches/v2_10:25177-29189,32921,32947 /ptlib/branches/v2_12:28485-31603 /ptlib/branches/v2_14:31501-33720 -/ptlib/branches/v2_16:34085-34919 +/ptlib/branches/v2_16:34085-34925 /ptlib/branches/v2_2:20746,20791,20827,22014,22942 /ptlib/branches/v2_4:21086,21094,21147,21160,21185,21281,21296,21305,21322,21337,21363,21467,21471-21472,21506,21508,21623,21695,21744,21746,21763,22241,22958,23045-23046,23061,23066,23712 /ptlib/branches/v2_6:22195,22243,22295,22304,22311,22317,22320,22356,22458,22509,22587,22601-22602,22611,22629,22633,22673,22681,22729,22731-22732,22736,22742,22848,22960,22992,23161,23163,23167,23169,23177,23239,23291,23298,23336,23429,23595,23823,23827,23873,24816 \ No newline at end of property Modified: ptlib/trunk/include/ptlib/filepath.h =================================================================== --- ptlib/trunk/include/ptlib/filepath.h 2016-08-22 16:17:34 UTC (rev 34925) +++ ptlib/trunk/include/ptlib/filepath.h 2016-08-22 16:32:00 UTC (rev 34926) @@ -291,6 +291,8 @@ ); //@} + // Internal function to take partial path and make a full canonoical path form it. + static PFilePathString Canonicalise(const PFilePathString & path, bool isDirectory); protected: virtual void AssignContents(const PContainer & cont); Modified: ptlib/trunk/include/ptlib/msos/ptlib/pdirect.h =================================================================== --- ptlib/trunk/include/ptlib/msos/ptlib/pdirect.h 2016-08-22 16:17:34 UTC (rev 34925) +++ ptlib/trunk/include/ptlib/msos/ptlib/pdirect.h 2016-08-22 16:32:00 UTC (rev 34926) @@ -39,7 +39,4 @@ WIN32_FIND_DATA fileinfo; bool InternalEntryCheck(); - public: - static PString CreateFullPath(const PString & path, PBoolean isDirectory); - // End Of File /////////////////////////////////////////////////////////////// Modified: ptlib/trunk/include/ptlib/pfactory.h =================================================================== --- ptlib/trunk/include/ptlib/pfactory.h 2016-08-22 16:17:34 UTC (rev 34925) +++ ptlib/trunk/include/ptlib/pfactory.h 2016-08-22 16:32:00 UTC (rev 34926) @@ -408,21 +408,25 @@ class Worker : protected WorkerBase_T { private: - Key_T m_key; + Key_T * m_key; public: Worker(const Key_T & key, bool singleton = false) : WorkerBase_T(singleton) - , m_key(key) + , m_key(new Key_T(key)) { PAssert(Register(key, this), "Factory Worker already registered"); } ~Worker() { - Unregister(m_key); + if (m_key == NULL) + return; + Unregister(*m_key); + delete m_key; + m_key = NULL; } - const Key_T & GetKey() const { return m_key; } + const Key_T & GetKey() const { return *m_key; } protected: virtual Abstract_T * Create(Param_T) const @@ -469,21 +473,25 @@ class Worker : protected WorkerBase_T { private: - Key_T m_key; + Key_T * m_key; public: Worker(const Key_T & key, bool singleton = false) : WorkerBase_T(singleton) - , m_key(key) + , m_key(new Key_T(key)) { PAssert(Register(key, this), "Factory Worker already registered"); } ~Worker() { - Unregister(m_key); + if (m_key == NULL) + return; + Unregister(*m_key); + delete m_key; + m_key = NULL; } - const Key_T & GetKey() const { return m_key; } + const Key_T & GetKey() const { return *m_key; } protected: virtual Abstract_T * Create(Param_T param) const Modified: ptlib/trunk/include/ptlib/unix/ptlib/ptlib.inl =================================================================== --- ptlib/trunk/include/ptlib/unix/ptlib/ptlib.inl 2016-08-22 16:17:34 UTC (rev 34925) +++ ptlib/trunk/include/ptlib/unix/ptlib/ptlib.inl 2016-08-22 16:32:00 UTC (rev 34926) @@ -79,6 +79,9 @@ PINLINE PString PFilePath::GetVolume() const { return PString::Empty(); } +PINLINE PString PFilePath::GetPath() const + { return GetDirectory(); } + /////////////////////////////////////////////////////////////////////////////// PINLINE bool PFile::Remove(const PFilePath & name, bool) Modified: ptlib/trunk/src/ptlib/common/osutils.cxx =================================================================== --- ptlib/trunk/src/ptlib/common/osutils.cxx 2016-08-22 16:17:34 UTC (rev 34925) +++ ptlib/trunk/src/ptlib/common/osutils.cxx 2016-08-22 16:32:00 UTC (rev 34926) @@ -659,7 +659,7 @@ { PTraceInfo & info = PTraceInfo::Instance(); if (info.AdjustOptions(options, 0)) { - PTRACE(2, "Trace options set to " << info.m_options); + PTRACE(2, "Trace options 0x" << hex << options << " added, now 0x" << info.m_options); } } @@ -668,7 +668,7 @@ { PTraceInfo & info = PTraceInfo::Instance(); if (info.AdjustOptions(0, options)) { - PTRACE(2, "Trace options set to " << info.m_options); + PTRACE(2, "Trace options 0x" << hex << options << " removed, now 0x" << info.m_options); } } @@ -3667,4 +3667,72 @@ return m_inUse.find(id) != m_inUse.end(); } + +/////////////////////////////////////////////////////////////////////// + +PFilePath::PFilePath(const PString & str) + : PFilePathString(Canonicalise(str, false)) +{ +} + + +PFilePath::PFilePath(const char * cstr) + : PFilePathString(Canonicalise(cstr, false)) +{ +} + + +void PFilePath::AssignContents(const PContainer & cont) +{ + PFilePathString::AssignContents(cont); + PFilePathString::AssignContents(Canonicalise(*this, false)); +} + + +PDirectory PFilePath::GetDirectory() const +{ + if (!IsEmpty()) { + PINDEX sep = FindLast(PDIR_SEPARATOR); + if (PAssert(sep != P_MAX_INDEX, "Bad file path")) + return Left(sep); + } + return PString::Empty(); +} + + +PFilePathString PFilePath::GetFileName() const +{ + if (!IsEmpty()) { + PINDEX sep = FindLast(PDIR_SEPARATOR); + if (PAssert(sep != P_MAX_INDEX, "Bad file path")) + return Mid(sep+1); + } + return PString::Empty(); +} + + +PFilePathString PFilePath::GetTitle() const +{ + PFilePathString filename = GetFileName(); + return filename.Left(filename.FindLast('.')); +} + + +PFilePathString PFilePath::GetType() const +{ + PFilePathString filename = GetFileName(); + return filename.Mid(filename.FindLast('.')); +} + + +void PFilePath::SetType(const PFilePathString & newType) +{ + PFilePathString oldType = GetType(); + if (oldType.IsEmpty()) + *this += newType; + else + Splice(newType, GetLength() - oldType.GetLength(), oldType.GetLength()); +} + + // End Of File /////////////////////////////////////////////////////////////// Modified: ptlib/trunk/src/ptlib/msos/ptlib.cxx =================================================================== --- ptlib/trunk/src/ptlib/msos/ptlib.cxx 2016-08-22 16:17:34 UTC (rev 34925) +++ ptlib/trunk/src/ptlib/msos/ptlib.cxx 2016-08-22 16:32:00 UTC (rev 34926) @@ -359,18 +359,6 @@ /////////////////////////////////////////////////////////////////////////////// // File Path -PFilePath::PFilePath(const PString & str) - : PCaselessString(PDirectory::CreateFullPath(str, false)) -{ -} - - -PFilePath::PFilePath(const char * cstr) - : PCaselessString(PDirectory::CreateFullPath(cstr, false)) -{ -} - - PFilePath::PFilePath(const char * prefix, const char * dir) { if (dir != NULL) { @@ -397,13 +385,6 @@ } -void PFilePath::AssignContents(const PContainer & cont) -{ - PCaselessString::AssignContents(cont); - PCaselessString::AssignContents(PDirectory::CreateFullPath(*this, false)); -} - - static PINDEX GetVolumeSubStringLength(const PString & path) { if (path[1] == ':') @@ -432,72 +413,12 @@ } -PDirectory PFilePath::GetDirectory() const -{ - PINDEX backslash = FindLast('\\'); - if (backslash != P_MAX_INDEX) - return Left(backslash+1); - - return PCaselessString(); -} - - PCaselessString PFilePath::GetPath() const { return operator()(GetVolumeSubStringLength(*this), FindLast('\\', GetLength()-2)); } -PCaselessString PFilePath::GetFileName() const -{ - PINDEX backslash = FindLast('\\', GetLength()-2); - if (backslash == P_MAX_INDEX) - backslash = 0; - else - backslash++; - - return Mid(backslash); -} - - -PCaselessString PFilePath::GetTitle() const -{ - PINDEX backslash = FindLast('\\', GetLength()-2); - if (backslash == P_MAX_INDEX) - backslash = 0; - else - backslash++; - - PINDEX last_dot = FindLast('.'); - if (last_dot < backslash) - last_dot = P_MAX_INDEX; - - return operator()(backslash, last_dot-1); -} - - -PCaselessString PFilePath::GetType() const -{ - PINDEX slash = FindLast('\\'); - if (slash == P_MAX_INDEX) - slash = 0; - PINDEX dot = FindLast('.'); - if (dot < slash) - return PCaselessString(); - return operator()(dot, P_MAX_INDEX); -} - - -void PFilePath::SetType(const PCaselessString & type) -{ - PINDEX dot = Find('.', FindLast('\\')); - if (dot != P_MAX_INDEX) - Splice(type, dot, GetLength()-dot); - else - *this += type; -} - - /////////////////////////////////////////////////////////////////////////////// // PFile Modified: ptlib/trunk/src/ptlib/msos/win32.cxx =================================================================== --- ptlib/trunk/src/ptlib/msos/win32.cxx 2016-08-22 16:17:34 UTC (rev 34925) +++ ptlib/trunk/src/ptlib/msos/win32.cxx 2016-08-22 16:32:00 UTC (rev 34926) @@ -273,7 +273,7 @@ { hFindFile = INVALID_HANDLE_VALUE; fileinfo.cFileName[0] = '\0'; - PCaselessString::AssignContents(CreateFullPath(*this, true)); + PCaselessString::AssignContents(PFilePath::Canonicalise(*this, true)); } @@ -348,7 +348,7 @@ } -PString PDirectory::CreateFullPath(const PString & path, PBoolean isDirectory) +PFilePathString PFilePath::Canonicalise(const PFilePathString & path, bool isDirectory) { if (path.IsEmpty()) return path; Modified: ptlib/trunk/src/ptlib/unix/osutil.cxx =================================================================== --- ptlib/trunk/src/ptlib/unix/osutil.cxx 2016-08-22 16:17:34 UTC (rev 34925) +++ ptlib/trunk/src/ptlib/unix/osutil.cxx 2016-08-22 16:32:00 UTC (rev 34926) @@ -329,23 +329,27 @@ } -static PString CanonicaliseFilename(const PString & filename) +PFilePathString PFilePath::Canonicalise(const PFilePathString & path, bool isDirectory) { - if (filename.IsEmpty()) - return filename; + if (path.IsEmpty()) + return path; - PINDEX p; + if (isDirectory) + return CanonicaliseDirectory(path); + + PINDEX pos; PString dirname; // if there is a slash in the string, extract the dirname - if ((p = filename.FindLast('/')) != P_MAX_INDEX) { - dirname = filename(0,p); - while (filename[p] == '/') - p++; - } else - p = 0; + if ((pos = path.FindLast('/')) == P_MAX_INDEX) + pos = 0; + else { + dirname = path(0, pos); + while (path[pos] == '/') + pos++; + } - return CanonicaliseDirectory(dirname) + filename(p, P_MAX_INDEX); + return CanonicaliseDirectory(dirname) + path(pos, P_MAX_INDEX); } @@ -987,20 +991,7 @@ /////////////////////////////////////////////////////////////////////////////// // PFilePath -PFilePath::PFilePath(const PString & str) - : PString(CanonicaliseFilename(str)) -{ -} - - -PFilePath::PFilePath(const char * cstr) - : PString(CanonicaliseFilename(cstr)) -{ -} - - PFilePath::PFilePath(const char * prefix, const char * dir) - : PString() { if (prefix == NULL) prefix = "tmp"; @@ -1028,60 +1019,6 @@ } -void PFilePath::AssignContents(const PContainer & cont) -{ - PString::AssignContents(cont); - PString::AssignContents(CanonicaliseFilename(*this)); -} - - -PString PFilePath::GetPath() const -{ - PINDEX pos = FindLast('/'); - PAssert(pos != P_MAX_INDEX, PInvalidArrayIndex); - return Left(pos+1); -} - - -PString PFilePath::GetTitle() const -{ - PString fn(GetFileName()); - return fn(0, fn.FindLast('.')-1); -} - - -PString PFilePath::GetType() const -{ - PINDEX pos = FindLast('.'); - return pos == P_MAX_INDEX || (GetLength()-pos) < 2 ? PString::Empty() : Mid(pos); -} - - -void PFilePath::SetType(const PString & type) -{ - PINDEX dot = Find('.', FindLast('/')); - if (dot != P_MAX_INDEX) - Splice(type, dot, GetLength()-dot); - else - *this += type; -} - - -PString PFilePath::GetFileName() const - -{ - PINDEX pos = FindLast('/'); - return pos == P_MAX_INDEX ? static_cast<PString>(*this) : Mid(pos+1); -} - - -PDirectory PFilePath::GetDirectory() const -{ - PINDEX pos = FindLast('/'); - return pos == P_MAX_INDEX ? PString("./") : Left(pos); -} - - PBoolean PFilePath::IsValid(char c) { return c != '/'; Modified: ptlib/trunk/src/ptlib/unix/svcproc.cxx =================================================================== --- ptlib/trunk/src/ptlib/unix/svcproc.cxx 2016-08-22 16:17:34 UTC (rev 34925) +++ ptlib/trunk/src/ptlib/unix/svcproc.cxx 2016-08-22 16:32:00 UTC (rev 34926) @@ -405,9 +405,13 @@ if (args.HasOption('H')) { int uid = geteuid(); - PIGNORE_RETURN(int,seteuid(getuid())); // Switch back to starting uid for next call - SetMaxHandles(args.GetOptionString('H').AsInteger()); - PIGNORE_RETURN(int,seteuid(uid)); + PAssertOS(seteuid(getuid()) == 0); // Switch back to starting uid for next call + unsigned maxHandles = args.GetOptionString('H').AsUnsigned(); + if (SetMaxHandles(maxHandles)) + cout << "Maximum handles set to " << maxHandles << endl; + else + cout << "Could not set maximum handles to " << maxHandles << endl; + PAssertOS(seteuid(uid) == 0); } #ifdef P_LINUX @@ -418,7 +422,7 @@ cout << "Could not get current core file size : error = " << errno << endl; else { int uid = geteuid(); - PIGNORE_RETURN(int,seteuid(getuid())); // Switch back to starting uid for next call + PAssertOS(seteuid(getuid()) == 0); // Switch back to starting uid for next call int v = args.GetOptionString('C').AsInteger(); rlim.rlim_cur = v; if (setrlimit(RLIMIT_CORE, &rlim) != 0) @@ -427,7 +431,7 @@ getrlimit(RLIMIT_CORE, &rlim); cout << "Core file size set to " << rlim.rlim_cur << "/" << rlim.rlim_max << endl; } - PIGNORE_RETURN(int,seteuid(uid)); + PAssertOS(seteuid(uid) == 0); } } #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-08-22 16:17:36
|
Revision: 34925 http://sourceforge.net/p/opalvoip/code/34925 Author: rjongbloed Date: 2016-08-22 16:17:34 +0000 (Mon, 22 Aug 2016) Log Message: ----------- Fixed Unix build Modified Paths: -------------- ptlib/branches/v2_16/src/ptlib/common/osutils.cxx Modified: ptlib/branches/v2_16/src/ptlib/common/osutils.cxx =================================================================== --- ptlib/branches/v2_16/src/ptlib/common/osutils.cxx 2016-08-22 16:11:56 UTC (rev 34924) +++ ptlib/branches/v2_16/src/ptlib/common/osutils.cxx 2016-08-22 16:17:34 UTC (rev 34925) @@ -3554,21 +3554,21 @@ /////////////////////////////////////////////////////////////////////// PFilePath::PFilePath(const PString & str) - : PCaselessString(Canonicalise(str, false)) + : PFilePathString(Canonicalise(str, false)) { } PFilePath::PFilePath(const char * cstr) - : PCaselessString(Canonicalise(cstr, false)) + : PFilePathString(Canonicalise(cstr, false)) { } void PFilePath::AssignContents(const PContainer & cont) { - PCaselessString::AssignContents(cont); - PCaselessString::AssignContents(Canonicalise(*this, false)); + PFilePathString::AssignContents(cont); + PFilePathString::AssignContents(Canonicalise(*this, false)); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-08-22 16:11:59
|
Revision: 34924 http://sourceforge.net/p/opalvoip/code/34924 Author: rjongbloed Date: 2016-08-22 16:11:56 +0000 (Mon, 22 Aug 2016) Log Message: ----------- Fixed various functions for PFilePath, in particular the Unix SetType(), while normalising behaviour for Unix/windows platforms. Modified Paths: -------------- ptlib/branches/v2_16/include/ptlib/filepath.h ptlib/branches/v2_16/include/ptlib/msos/ptlib/pdirect.h ptlib/branches/v2_16/include/ptlib/unix/ptlib/ptlib.inl ptlib/branches/v2_16/src/ptlib/common/osutils.cxx ptlib/branches/v2_16/src/ptlib/msos/ptlib.cxx ptlib/branches/v2_16/src/ptlib/msos/win32.cxx ptlib/branches/v2_16/src/ptlib/unix/osutil.cxx Modified: ptlib/branches/v2_16/include/ptlib/filepath.h =================================================================== --- ptlib/branches/v2_16/include/ptlib/filepath.h 2016-08-18 20:58:44 UTC (rev 34923) +++ ptlib/branches/v2_16/include/ptlib/filepath.h 2016-08-22 16:11:56 UTC (rev 34924) @@ -291,6 +291,8 @@ ); //@} + // Internal function to take partial path and make a full canonoical path form it. + static PFilePathString Canonicalise(const PFilePathString & path, bool isDirectory); protected: virtual void AssignContents(const PContainer & cont); Modified: ptlib/branches/v2_16/include/ptlib/msos/ptlib/pdirect.h =================================================================== --- ptlib/branches/v2_16/include/ptlib/msos/ptlib/pdirect.h 2016-08-18 20:58:44 UTC (rev 34923) +++ ptlib/branches/v2_16/include/ptlib/msos/ptlib/pdirect.h 2016-08-22 16:11:56 UTC (rev 34924) @@ -39,7 +39,4 @@ WIN32_FIND_DATA fileinfo; bool InternalEntryCheck(); - public: - static PString CreateFullPath(const PString & path, PBoolean isDirectory); - // End Of File /////////////////////////////////////////////////////////////// Modified: ptlib/branches/v2_16/include/ptlib/unix/ptlib/ptlib.inl =================================================================== --- ptlib/branches/v2_16/include/ptlib/unix/ptlib/ptlib.inl 2016-08-18 20:58:44 UTC (rev 34923) +++ ptlib/branches/v2_16/include/ptlib/unix/ptlib/ptlib.inl 2016-08-22 16:11:56 UTC (rev 34924) @@ -79,6 +79,9 @@ PINLINE PString PFilePath::GetVolume() const { return PString::Empty(); } +PINLINE PString PFilePath::GetPath() const + { return GetDirectory(); } + /////////////////////////////////////////////////////////////////////////////// PINLINE bool PFile::Remove(const PFilePath & name, bool) Modified: ptlib/branches/v2_16/src/ptlib/common/osutils.cxx =================================================================== --- ptlib/branches/v2_16/src/ptlib/common/osutils.cxx 2016-08-18 20:58:44 UTC (rev 34923) +++ ptlib/branches/v2_16/src/ptlib/common/osutils.cxx 2016-08-22 16:11:56 UTC (rev 34924) @@ -3550,4 +3550,72 @@ return m_inUse.find(id) != m_inUse.end(); } + +/////////////////////////////////////////////////////////////////////// + +PFilePath::PFilePath(const PString & str) + : PCaselessString(Canonicalise(str, false)) +{ +} + + +PFilePath::PFilePath(const char * cstr) + : PCaselessString(Canonicalise(cstr, false)) +{ +} + + +void PFilePath::AssignContents(const PContainer & cont) +{ + PCaselessString::AssignContents(cont); + PCaselessString::AssignContents(Canonicalise(*this, false)); +} + + +PDirectory PFilePath::GetDirectory() const +{ + if (!IsEmpty()) { + PINDEX sep = FindLast(PDIR_SEPARATOR); + if (PAssert(sep != P_MAX_INDEX, "Bad file path")) + return Left(sep); + } + return PString::Empty(); +} + + +PFilePathString PFilePath::GetFileName() const +{ + if (!IsEmpty()) { + PINDEX sep = FindLast(PDIR_SEPARATOR); + if (PAssert(sep != P_MAX_INDEX, "Bad file path")) + return Mid(sep+1); + } + return PString::Empty(); +} + + +PFilePathString PFilePath::GetTitle() const +{ + PFilePathString filename = GetFileName(); + return filename.Left(filename.FindLast('.')); +} + + +PFilePathString PFilePath::GetType() const +{ + PFilePathString filename = GetFileName(); + return filename.Mid(filename.FindLast('.')); +} + + +void PFilePath::SetType(const PFilePathString & newType) +{ + PFilePathString oldType = GetType(); + if (oldType.IsEmpty()) + *this += newType; + else + Splice(newType, GetLength() - oldType.GetLength(), oldType.GetLength()); +} + + // End Of File /////////////////////////////////////////////////////////////// Modified: ptlib/branches/v2_16/src/ptlib/msos/ptlib.cxx =================================================================== --- ptlib/branches/v2_16/src/ptlib/msos/ptlib.cxx 2016-08-18 20:58:44 UTC (rev 34923) +++ ptlib/branches/v2_16/src/ptlib/msos/ptlib.cxx 2016-08-22 16:11:56 UTC (rev 34924) @@ -359,18 +359,6 @@ /////////////////////////////////////////////////////////////////////////////// // File Path -PFilePath::PFilePath(const PString & str) - : PCaselessString(PDirectory::CreateFullPath(str, false)) -{ -} - - -PFilePath::PFilePath(const char * cstr) - : PCaselessString(PDirectory::CreateFullPath(cstr, false)) -{ -} - - PFilePath::PFilePath(const char * prefix, const char * dir) { if (dir != NULL) { @@ -397,13 +385,6 @@ } -void PFilePath::AssignContents(const PContainer & cont) -{ - PCaselessString::AssignContents(cont); - PCaselessString::AssignContents(PDirectory::CreateFullPath(*this, false)); -} - - static PINDEX GetVolumeSubStringLength(const PString & path) { if (path[1] == ':') @@ -432,72 +413,12 @@ } -PDirectory PFilePath::GetDirectory() const -{ - PINDEX backslash = FindLast('\\'); - if (backslash != P_MAX_INDEX) - return Left(backslash+1); - - return PCaselessString(); -} - - PCaselessString PFilePath::GetPath() const { return operator()(GetVolumeSubStringLength(*this), FindLast('\\', GetLength()-2)); } -PCaselessString PFilePath::GetFileName() const -{ - PINDEX backslash = FindLast('\\', GetLength()-2); - if (backslash == P_MAX_INDEX) - backslash = 0; - else - backslash++; - - return Mid(backslash); -} - - -PCaselessString PFilePath::GetTitle() const -{ - PINDEX backslash = FindLast('\\', GetLength()-2); - if (backslash == P_MAX_INDEX) - backslash = 0; - else - backslash++; - - PINDEX last_dot = FindLast('.'); - if (last_dot < backslash) - last_dot = P_MAX_INDEX; - - return operator()(backslash, last_dot-1); -} - - -PCaselessString PFilePath::GetType() const -{ - PINDEX slash = FindLast('\\'); - if (slash == P_MAX_INDEX) - slash = 0; - PINDEX dot = FindLast('.'); - if (dot < slash) - return PCaselessString(); - return operator()(dot, P_MAX_INDEX); -} - - -void PFilePath::SetType(const PCaselessString & type) -{ - PINDEX dot = Find('.', FindLast('\\')); - if (dot != P_MAX_INDEX) - Splice(type, dot, GetLength()-dot); - else - *this += type; -} - - /////////////////////////////////////////////////////////////////////////////// // PFile Modified: ptlib/branches/v2_16/src/ptlib/msos/win32.cxx =================================================================== --- ptlib/branches/v2_16/src/ptlib/msos/win32.cxx 2016-08-18 20:58:44 UTC (rev 34923) +++ ptlib/branches/v2_16/src/ptlib/msos/win32.cxx 2016-08-22 16:11:56 UTC (rev 34924) @@ -273,7 +273,7 @@ { hFindFile = INVALID_HANDLE_VALUE; fileinfo.cFileName[0] = '\0'; - PCaselessString::AssignContents(CreateFullPath(*this, true)); + PCaselessString::AssignContents(PFilePath::Canonicalise(*this, true)); } @@ -348,7 +348,7 @@ } -PString PDirectory::CreateFullPath(const PString & path, PBoolean isDirectory) +PFilePathString PFilePath::Canonicalise(const PFilePathString & path, bool isDirectory) { if (path.IsEmpty()) return path; Modified: ptlib/branches/v2_16/src/ptlib/unix/osutil.cxx =================================================================== --- ptlib/branches/v2_16/src/ptlib/unix/osutil.cxx 2016-08-18 20:58:44 UTC (rev 34923) +++ ptlib/branches/v2_16/src/ptlib/unix/osutil.cxx 2016-08-22 16:11:56 UTC (rev 34924) @@ -328,23 +328,27 @@ } -static PString CanonicaliseFilename(const PString & filename) +PFilePathString PFilePath::Canonicalise(const PFilePathString & path, bool isDirectory) { - if (filename.IsEmpty()) - return filename; + if (path.IsEmpty()) + return path; - PINDEX p; + if (isDirectory) + return CanonicaliseDirectory(path); + + PINDEX pos; PString dirname; // if there is a slash in the string, extract the dirname - if ((p = filename.FindLast('/')) != P_MAX_INDEX) { - dirname = filename(0,p); - while (filename[p] == '/') - p++; - } else - p = 0; + if ((pos = path.FindLast('/')) == P_MAX_INDEX) + pos = 0; + else { + dirname = path(0, pos); + while (path[pos] == '/') + pos++; + } - return CanonicaliseDirectory(dirname) + filename(p, P_MAX_INDEX); + return CanonicaliseDirectory(dirname) + path(pos, P_MAX_INDEX); } @@ -986,20 +990,7 @@ /////////////////////////////////////////////////////////////////////////////// // PFilePath -PFilePath::PFilePath(const PString & str) - : PString(CanonicaliseFilename(str)) -{ -} - - -PFilePath::PFilePath(const char * cstr) - : PString(CanonicaliseFilename(cstr)) -{ -} - - PFilePath::PFilePath(const char * prefix, const char * dir) - : PString() { if (prefix == NULL) prefix = "tmp"; @@ -1027,77 +1018,6 @@ } -void PFilePath::AssignContents(const PContainer & cont) -{ - PString::AssignContents(cont); - PString::AssignContents(CanonicaliseFilename(*this)); -} - - -PString PFilePath::GetPath() const - -{ - int i; - - PAssert((i = FindLast('/')) != P_MAX_INDEX, PInvalidArrayIndex); - return Left(i+1); -} - - -PString PFilePath::GetTitle() const - -{ - PString fn(GetFileName()); - return fn(0, fn.FindLast('.')-1); -} - - -PString PFilePath::GetType() const - -{ - int p = FindLast('.'); - int l = (p == P_MAX_INDEX) ? 0 : (GetLength() - p); - - if (p < 0 || l < 2) - return PString(""); - else - return (*this)(p, P_MAX_INDEX); -} - - -void PFilePath::SetType(const PString & type) -{ - PINDEX dot = Find('.', FindLast('/')); - if (dot != P_MAX_INDEX) - Splice(type, dot, GetLength()-dot); - else - *this += type; -} - - -PString PFilePath::GetFileName() const - -{ - int i; - - if ((i = FindLast('/')) == P_MAX_INDEX) - return *this; - else - return Right(GetLength()-i-1); -} - - -PDirectory PFilePath::GetDirectory() const -{ - int i; - - if ((i = FindLast('/')) == P_MAX_INDEX) - return "./"; - else - return Left(i); -} - - PBoolean PFilePath::IsValid(char c) { return c != '/'; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-08-18 20:58:47
|
Revision: 34923 http://sourceforge.net/p/opalvoip/code/34923 Author: rjongbloed Date: 2016-08-18 20:58:44 +0000 (Thu, 18 Aug 2016) Log Message: ----------- Tweaked the factories to deal with static destructors being called twice with certain combinations of debug/static/plugin shared library nightmare that is glibc. Modified Paths: -------------- ptlib/branches/v2_16/include/ptlib/pfactory.h Modified: ptlib/branches/v2_16/include/ptlib/pfactory.h =================================================================== --- ptlib/branches/v2_16/include/ptlib/pfactory.h 2016-08-18 12:37:51 UTC (rev 34922) +++ ptlib/branches/v2_16/include/ptlib/pfactory.h 2016-08-18 20:58:44 UTC (rev 34923) @@ -408,21 +408,25 @@ class Worker : protected WorkerBase_T { private: - Key_T m_key; + Key_T * m_key; public: Worker(const Key_T & key, bool singleton = false) : WorkerBase_T(singleton) - , m_key(key) + , m_key(new Key_T(key)) { PAssert(Register(key, this), "Factory Worker already registered"); } ~Worker() { - Unregister(m_key); + if (m_key == NULL) + return; + Unregister(*m_key); + delete m_key; + m_key = NULL; } - const Key_T & GetKey() const { return m_key; } + const Key_T & GetKey() const { return *m_key; } protected: virtual Abstract_T * Create(Param_T) const @@ -469,21 +473,25 @@ class Worker : protected WorkerBase_T { private: - Key_T m_key; + Key_T * m_key; public: Worker(const Key_T & key, bool singleton = false) : WorkerBase_T(singleton) - , m_key(key) + , m_key(new Key_T(key)) { PAssert(Register(key, this), "Factory Worker already registered"); } ~Worker() { - Unregister(m_key); + if (m_key == NULL) + return; + Unregister(*m_key); + delete m_key; + m_key = NULL; } - const Key_T & GetKey() const { return m_key; } + const Key_T & GetKey() const { return *m_key; } protected: virtual Abstract_T * Create(Param_T param) const This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-08-18 12:37:53
|
Revision: 34922 http://sourceforge.net/p/opalvoip/code/34922 Author: rjongbloed Date: 2016-08-18 12:37:51 +0000 (Thu, 18 Aug 2016) Log Message: ----------- Print PTrace options in hex Modified Paths: -------------- ptlib/branches/v2_16/src/ptlib/common/osutils.cxx Modified: ptlib/branches/v2_16/src/ptlib/common/osutils.cxx =================================================================== --- ptlib/branches/v2_16/src/ptlib/common/osutils.cxx 2016-08-16 07:26:40 UTC (rev 34921) +++ ptlib/branches/v2_16/src/ptlib/common/osutils.cxx 2016-08-18 12:37:51 UTC (rev 34922) @@ -664,7 +664,7 @@ { PTraceInfo & info = PTraceInfo::Instance(); if (info.AdjustOptions(options, 0)) { - PTRACE(2, "Trace options set to " << info.m_options); + PTRACE(2, "Trace options 0x" << hex << options << " added, now 0x" << info.m_options); } } @@ -673,7 +673,7 @@ { PTraceInfo & info = PTraceInfo::Instance(); if (info.AdjustOptions(0, options)) { - PTRACE(2, "Trace options set to " << info.m_options); + PTRACE(2, "Trace options 0x" << hex << options << " removed, now 0x" << info.m_options); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-08-16 07:26:43
|
Revision: 34921 http://sourceforge.net/p/opalvoip/code/34921 Author: rjongbloed Date: 2016-08-16 07:26:40 +0000 (Tue, 16 Aug 2016) Log Message: ----------- Fixed GNU warning and added error message if can/cannot set file handles in service process. Modified Paths: -------------- ptlib/branches/v2_16/src/ptlib/unix/svcproc.cxx Modified: ptlib/branches/v2_16/src/ptlib/unix/svcproc.cxx =================================================================== --- ptlib/branches/v2_16/src/ptlib/unix/svcproc.cxx 2016-08-13 18:20:28 UTC (rev 34920) +++ ptlib/branches/v2_16/src/ptlib/unix/svcproc.cxx 2016-08-16 07:26:40 UTC (rev 34921) @@ -405,9 +405,13 @@ if (args.HasOption('H')) { int uid = geteuid(); - (void)seteuid(getuid()); // Switch back to starting uid for next call - SetMaxHandles(args.GetOptionString('H').AsInteger()); - (void)seteuid(uid); + PAssertOS(seteuid(getuid()) == 0); // Switch back to starting uid for next call + unsigned maxHandles = args.GetOptionString('H').AsUnsigned(); + if (SetMaxHandles(maxHandles)) + cout << "Maximum handles set to " << maxHandles << endl; + else + cout << "Could not set maximum handles to " << maxHandles << endl; + PAssertOS(seteuid(uid) == 0); } #ifdef P_LINUX @@ -418,7 +422,7 @@ cout << "Could not get current core file size : error = " << errno << endl; else { int uid = geteuid(); - (void)seteuid(getuid()); // Switch back to starting uid for next call + PAssertOS(seteuid(getuid()) == 0); // Switch back to starting uid for next call int v = args.GetOptionString('C').AsInteger(); rlim.rlim_cur = v; if (setrlimit(RLIMIT_CORE, &rlim) != 0) @@ -427,7 +431,7 @@ getrlimit(RLIMIT_CORE, &rlim); cout << "Core file size set to " << rlim.rlim_cur << "/" << rlim.rlim_max << endl; } - (void)seteuid(uid); + PAssertOS(seteuid(uid) == 0); } } #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-08-13 18:20:30
|
Revision: 34920 http://sourceforge.net/p/opalvoip/code/34920 Author: rjongbloed Date: 2016-08-13 18:20:28 +0000 (Sat, 13 Aug 2016) Log Message: ----------- Merged revision(s) 34918-34919 from ptlib/branches/v2_16: Fixed bizarre error on some platforms/compilers where Command Line Interpreter output ceased to be emitted. Also cosmetic change to avoid prompt being output when CLI is stopped. Modified Paths: -------------- ptlib/trunk/src/ptclib/cli.cxx Property Changed: ---------------- ptlib/trunk/ Index: ptlib/trunk =================================================================== --- ptlib/trunk 2016-08-13 18:17:12 UTC (rev 34919) +++ ptlib/trunk 2016-08-13 18:20:28 UTC (rev 34920) Property changes on: ptlib/trunk ___________________________________________________________________ Modified: svn:mergeinfo ## -6,7 +6,7 ## /ptlib/branches/v2_10:25177-29189,32921,32947 /ptlib/branches/v2_12:28485-31603 /ptlib/branches/v2_14:31501-33720 -/ptlib/branches/v2_16:34085-34917 +/ptlib/branches/v2_16:34085-34919 /ptlib/branches/v2_2:20746,20791,20827,22014,22942 /ptlib/branches/v2_4:21086,21094,21147,21160,21185,21281,21296,21305,21322,21337,21363,21467,21471-21472,21506,21508,21623,21695,21744,21746,21763,22241,22958,23045-23046,23061,23066,23712 /ptlib/branches/v2_6:22195,22243,22295,22304,22311,22317,22320,22356,22458,22509,22587,22601-22602,22611,22629,22633,22673,22681,22729,22731-22732,22736,22742,22848,22960,22992,23161,23163,23167,23169,23177,23239,23291,23298,23336,23429,23595,23823,23827,23873,24816 \ No newline at end of property Modified: ptlib/trunk/src/ptclib/cli.cxx =================================================================== --- ptlib/trunk/src/ptclib/cli.cxx 2016-08-13 18:17:12 UTC (rev 34919) +++ ptlib/trunk/src/ptclib/cli.cxx 2016-08-13 18:20:28 UTC (rev 34920) @@ -410,6 +410,8 @@ if (CheckInternalCommand(line, m_cli.GetCommentCommand(), true)) return; + clear(); + if (CheckInternalCommand(line, m_cli.GetRepeatCommand())) { if (m_commandHistory.IsEmpty()) { *this << m_cli.GetNoHistoryError() << endl; @@ -601,6 +603,8 @@ void PCLI::Stop() { + SetPrompt(PString::Empty()); + m_contextMutex.Wait(); for (ContextList_t::iterator iter = m_contextList.begin(); iter != m_contextList.end(); ++iter) (*iter)->Stop(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-08-13 18:17:15
|
Revision: 34919 http://sourceforge.net/p/opalvoip/code/34919 Author: rjongbloed Date: 2016-08-13 18:17:12 +0000 (Sat, 13 Aug 2016) Log Message: ----------- Fixed bizarre error on some platforms/compilers where Command Line Interpreter output ceased to be emitted. Also cosmetic change to avoid prompt being output when CLI is stopped. Modified Paths: -------------- ptlib/branches/v2_16/src/ptclib/cli.cxx Modified: ptlib/branches/v2_16/src/ptclib/cli.cxx =================================================================== --- ptlib/branches/v2_16/src/ptclib/cli.cxx 2016-08-13 14:50:51 UTC (rev 34918) +++ ptlib/branches/v2_16/src/ptclib/cli.cxx 2016-08-13 18:17:12 UTC (rev 34919) @@ -410,6 +410,8 @@ if (CheckInternalCommand(line, m_cli.GetCommentCommand(), true)) return; + clear(); + if (CheckInternalCommand(line, m_cli.GetRepeatCommand())) { if (m_commandHistory.IsEmpty()) { *this << m_cli.GetNoHistoryError() << endl; @@ -601,6 +603,8 @@ void PCLI::Stop() { + SetPrompt(PString::Empty()); + m_contextMutex.Wait(); for (ContextList_t::iterator iter = m_contextList.begin(); iter != m_contextList.end(); ++iter) (*iter)->Stop(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-08-13 14:50:53
|
Revision: 34918 http://sourceforge.net/p/opalvoip/code/34918 Author: rjongbloed Date: 2016-08-13 14:50:51 +0000 (Sat, 13 Aug 2016) Log Message: ----------- Merged revision(s) 34914-34917 from ptlib/branches/v2_16: --------------------- r34917 Small code tidy up, using normalised function on call when channel closed. --------------------- r34916 Do test for closed file handle in Unix PThread::PXBlockOnIO() for bot select() and poll() versions. Fixing a tiny race condition where a socket could block forever when closed. --------------------- r34915 Cleaned up the "Thread failed to terminate" assert output. Revision Links: -------------- http://sourceforge.net/p/opalvoip/code/34917 http://sourceforge.net/p/opalvoip/code/34916 http://sourceforge.net/p/opalvoip/code/34915 Modified Paths: -------------- ptlib/trunk/src/ptlib/common/osutils.cxx ptlib/trunk/src/ptlib/unix/channel.cxx ptlib/trunk/src/ptlib/unix/tlibthrd.cxx Property Changed: ---------------- ptlib/trunk/ Index: ptlib/trunk =================================================================== --- ptlib/trunk 2016-08-13 14:48:08 UTC (rev 34917) +++ ptlib/trunk 2016-08-13 14:50:51 UTC (rev 34918) Property changes on: ptlib/trunk ___________________________________________________________________ Modified: svn:mergeinfo ## -6,7 +6,7 ## /ptlib/branches/v2_10:25177-29189,32921,32947 /ptlib/branches/v2_12:28485-31603 /ptlib/branches/v2_14:31501-33720 -/ptlib/branches/v2_16:34085-34913 +/ptlib/branches/v2_16:34085-34917 /ptlib/branches/v2_2:20746,20791,20827,22014,22942 /ptlib/branches/v2_4:21086,21094,21147,21160,21185,21281,21296,21305,21322,21337,21363,21467,21471-21472,21506,21508,21623,21695,21744,21746,21763,22241,22958,23045-23046,23061,23066,23712 /ptlib/branches/v2_6:22195,22243,22295,22304,22311,22317,22320,22356,22458,22509,22587,22601-22602,22611,22629,22633,22673,22681,22729,22731-22732,22736,22742,22848,22960,22992,23161,23163,23167,23169,23177,23239,23291,23298,23336,23429,23595,23823,23827,23873,24816 \ No newline at end of property Modified: ptlib/trunk/src/ptlib/common/osutils.cxx =================================================================== --- ptlib/trunk/src/ptlib/common/osutils.cxx 2016-08-13 14:48:08 UTC (rev 34917) +++ ptlib/trunk/src/ptlib/common/osutils.cxx 2016-08-13 14:50:51 UTC (rev 34918) @@ -2858,13 +2858,13 @@ } ostringstream strm; - strm << "Thread \"" << *thread << "\"" + strm << "Thread \"" << *thread << "\" failed to terminate" #if PTRACING - "\n"; + " at stack location:"; PTrace::WalkStack(strm, thread->GetThreadId(), thread->GetUniqueIdentifier()); - strm << " " + strm << "\n " #endif - " failed to terminate in " << maxWait << " seconds"; + " in " << maxWait << " seconds"; PAssertAlways(strm.str().c_str()); delete thread; Modified: ptlib/trunk/src/ptlib/unix/channel.cxx =================================================================== --- ptlib/trunk/src/ptlib/unix/channel.cxx 2016-08-13 14:48:08 UTC (rev 34917) +++ ptlib/trunk/src/ptlib/unix/channel.cxx 2016-08-13 14:50:51 UTC (rev 34918) @@ -67,6 +67,9 @@ PBoolean PChannel::PXSetIOBlock(PXBlockType type, const PTimeInterval & timeout) { + if (CheckNotOpen()) + return false; + ErrorGroup group; switch (type) { case PXReadBlock : @@ -79,9 +82,6 @@ group = LastGeneralError; } - if (os_handle < 0) - return SetErrorValues(NotOpen, EBADF, group); - PThread * blockedThread = PThread::Current(); { @@ -150,8 +150,8 @@ { SetLastReadCount(0); - if (os_handle < 0) - return SetErrorValues(NotOpen, EBADF, LastReadError); + if (CheckNotOpen()) + return false; for (;;) { PPROFILE_SYSTEM( @@ -183,9 +183,8 @@ { SetLastWriteCount(0); - // if the os_handle isn't open, no can do - if (os_handle < 0) - return SetErrorValues(NotOpen, EBADF, LastWriteError); + if (CheckNotOpen()) + return false; // flush the buffer before doing a write flush(); @@ -306,9 +305,9 @@ PBoolean PChannel::Close() { - if (os_handle < 0) - return SetErrorValues(NotOpen, EBADF); - + if (CheckNotOpen()) + return false; + return ConvertOSError(PXClose()); } Modified: ptlib/trunk/src/ptlib/unix/tlibthrd.cxx =================================================================== --- ptlib/trunk/src/ptlib/unix/tlibthrd.cxx 2016-08-13 14:48:08 UTC (rev 34917) +++ ptlib/trunk/src/ptlib/unix/tlibthrd.cxx 2016-08-13 14:50:51 UTC (rev 34918) @@ -911,6 +911,12 @@ { PTRACE(7, "PTLib\tPThread::PXBlockOnIO(" << handle << ',' << type << ')'); + if ((handle < 0) || (handle >= PProcess::Current().GetMaxHandles())) { + PTRACE(2, "PTLib\tAttempt to use illegal handle in PThread::PXBlockOnIO, handle=" << handle); + errno = EBADF; + return -1; + } + int retval; #if P_HAS_POLL @@ -945,13 +951,6 @@ #else // P_HAS_POLL - if ((handle < 0) || (handle >= PProcess::Current().GetMaxHandles())) { - PTRACE(2, "PTLib\tAttempt to use illegal handle in PThread::PXBlockOnIO, handle=" << handle); - errno = EBADF; - return -1; - } - - // make sure we flush the buffer before doing a write P_fd_set read_fds; P_fd_set write_fds; P_fd_set exception_fds; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-08-13 14:48:10
|
Revision: 34917 http://sourceforge.net/p/opalvoip/code/34917 Author: rjongbloed Date: 2016-08-13 14:48:08 +0000 (Sat, 13 Aug 2016) Log Message: ----------- Small code tidy up, using normalised function on call when channel closed. Modified Paths: -------------- ptlib/branches/v2_16/src/ptlib/unix/channel.cxx Modified: ptlib/branches/v2_16/src/ptlib/unix/channel.cxx =================================================================== --- ptlib/branches/v2_16/src/ptlib/unix/channel.cxx 2016-08-13 14:43:22 UTC (rev 34916) +++ ptlib/branches/v2_16/src/ptlib/unix/channel.cxx 2016-08-13 14:48:08 UTC (rev 34917) @@ -77,6 +77,9 @@ PBoolean PChannel::PXSetIOBlock(PXBlockType type, const PTimeInterval & timeout) { + if (CheckNotOpen()) + return false; + ErrorGroup group; switch (type) { case PXReadBlock : @@ -89,9 +92,6 @@ group = LastGeneralError; } - if (os_handle < 0) - return SetErrorValues(NotOpen, EBADF, group); - PThread * blockedThread = PThread::Current(); { @@ -160,8 +160,8 @@ { lastReadCount = 0; - if (os_handle < 0) - return SetErrorValues(NotOpen, EBADF, LastReadError); + if (CheckNotOpen()) + return false; for (;;) { PPROFILE_SYSTEM( @@ -193,9 +193,8 @@ { lastWriteCount = 0; - // if the os_handle isn't open, no can do - if (os_handle < 0) - return SetErrorValues(NotOpen, EBADF, LastWriteError); + if (CheckNotOpen()) + return false; // flush the buffer before doing a write IOSTREAM_MUTEX_WAIT(); @@ -317,9 +316,9 @@ PBoolean PChannel::Close() { - if (os_handle < 0) - return SetErrorValues(NotOpen, EBADF); - + if (CheckNotOpen()) + return false; + return ConvertOSError(PXClose()); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-08-13 14:43:24
|
Revision: 34916 http://sourceforge.net/p/opalvoip/code/34916 Author: rjongbloed Date: 2016-08-13 14:43:22 +0000 (Sat, 13 Aug 2016) Log Message: ----------- Do test for closed file handle in Unix PThread::PXBlockOnIO() for bot select() and poll() versions. Fixing a tiny race condition where a socket could block forever when closed. Modified Paths: -------------- ptlib/branches/v2_16/src/ptlib/unix/tlibthrd.cxx Modified: ptlib/branches/v2_16/src/ptlib/unix/tlibthrd.cxx =================================================================== --- ptlib/branches/v2_16/src/ptlib/unix/tlibthrd.cxx 2016-08-13 14:39:22 UTC (rev 34915) +++ ptlib/branches/v2_16/src/ptlib/unix/tlibthrd.cxx 2016-08-13 14:43:22 UTC (rev 34916) @@ -911,6 +911,12 @@ { PTRACE(7, "PTLib\tPThread::PXBlockOnIO(" << handle << ',' << type << ')'); + if ((handle < 0) || (handle >= PProcess::Current().GetMaxHandles())) { + PTRACE(2, "PTLib\tAttempt to use illegal handle in PThread::PXBlockOnIO, handle=" << handle); + errno = EBADF; + return -1; + } + int retval; #if P_HAS_POLL @@ -945,13 +951,6 @@ #else // P_HAS_POLL - if ((handle < 0) || (handle >= PProcess::Current().GetMaxHandles())) { - PTRACE(2, "PTLib\tAttempt to use illegal handle in PThread::PXBlockOnIO, handle=" << handle); - errno = EBADF; - return -1; - } - - // make sure we flush the buffer before doing a write P_fd_set read_fds; P_fd_set write_fds; P_fd_set exception_fds; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-08-13 14:39:25
|
Revision: 34915 http://sourceforge.net/p/opalvoip/code/34915 Author: rjongbloed Date: 2016-08-13 14:39:22 +0000 (Sat, 13 Aug 2016) Log Message: ----------- Cleaned up the "Thread failed to terminate" assert output. Modified Paths: -------------- ptlib/branches/v2_16/src/ptlib/common/osutils.cxx Modified: ptlib/branches/v2_16/src/ptlib/common/osutils.cxx =================================================================== --- ptlib/branches/v2_16/src/ptlib/common/osutils.cxx 2016-08-12 15:50:03 UTC (rev 34914) +++ ptlib/branches/v2_16/src/ptlib/common/osutils.cxx 2016-08-13 14:39:22 UTC (rev 34915) @@ -2843,13 +2843,13 @@ } ostringstream strm; - strm << "Thread \"" << *thread << "\"" + strm << "Thread \"" << *thread << "\" failed to terminate" #if PTRACING - "\n"; + " at stack location:"; PTrace::WalkStack(strm, thread->GetThreadId()); - strm << " " + strm << "\n " #endif - " failed to terminate in " << maxWait << " seconds"; + " in " << maxWait << " seconds"; PAssertAlways(strm.str().c_str()); delete thread; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-08-12 15:50:06
|
Revision: 34914 http://sourceforge.net/p/opalvoip/code/34914 Author: rjongbloed Date: 2016-08-12 15:50:03 +0000 (Fri, 12 Aug 2016) Log Message: ----------- Merged revision(s) 34901-34913 from ptlib/branches/v2_16: Fixed !! command in Command Line Interpreter. Modified Paths: -------------- ptlib/trunk/src/ptclib/cli.cxx Property Changed: ---------------- ptlib/trunk/ Index: ptlib/trunk =================================================================== --- ptlib/trunk 2016-08-12 15:48:36 UTC (rev 34913) +++ ptlib/trunk 2016-08-12 15:50:03 UTC (rev 34914) Property changes on: ptlib/trunk ___________________________________________________________________ Modified: svn:mergeinfo ## -6,7 +6,7 ## /ptlib/branches/v2_10:25177-29189,32921,32947 /ptlib/branches/v2_12:28485-31603 /ptlib/branches/v2_14:31501-33720 -/ptlib/branches/v2_16:34085-34900 +/ptlib/branches/v2_16:34085-34913 /ptlib/branches/v2_2:20746,20791,20827,22014,22942 /ptlib/branches/v2_4:21086,21094,21147,21160,21185,21281,21296,21305,21322,21337,21363,21467,21471-21472,21506,21508,21623,21695,21744,21746,21763,22241,22958,23045-23046,23061,23066,23712 /ptlib/branches/v2_6:22195,22243,22295,22304,22311,22317,22320,22356,22458,22509,22587,22601-22602,22611,22629,22633,22673,22681,22729,22731-22732,22736,22742,22848,22960,22992,23161,23163,23167,23169,23177,23239,23291,23298,23336,23429,23595,23823,23827,23873,24816 \ No newline at end of property Modified: ptlib/trunk/src/ptclib/cli.cxx =================================================================== --- ptlib/trunk/src/ptclib/cli.cxx 2016-08-12 15:48:36 UTC (rev 34913) +++ ptlib/trunk/src/ptclib/cli.cxx 2016-08-12 15:50:03 UTC (rev 34914) @@ -466,6 +466,8 @@ line = m_commandHistory[cmdNum-1]; } + m_commandHistory += line; + if (CheckInternalCommand(line, m_cli.GetHelpCommand())) m_cli.ShowHelp(*this, line); else { @@ -474,8 +476,6 @@ m_cli.OnReceivedLine(args); m_state = e_CommandEntry; } - - m_commandHistory += line; } @@ -554,7 +554,7 @@ "\n" "Commands available are:") , m_repeatCommand("!!") - , m_historyCommand("!") + , m_historyCommand("!\nhistory") , m_noHistoryError("No command history") , m_commandUsagePrefix("Usage: ") , m_commandErrorPrefix(": error: ") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-08-12 15:48:38
|
Revision: 34913 http://sourceforge.net/p/opalvoip/code/34913 Author: rjongbloed Date: 2016-08-12 15:48:36 +0000 (Fri, 12 Aug 2016) Log Message: ----------- Fixed !! command in Command Line Interpreter. Modified Paths: -------------- ptlib/branches/v2_16/src/ptclib/cli.cxx Modified: ptlib/branches/v2_16/src/ptclib/cli.cxx =================================================================== --- ptlib/branches/v2_16/src/ptclib/cli.cxx 2016-08-09 14:27:35 UTC (rev 34912) +++ ptlib/branches/v2_16/src/ptclib/cli.cxx 2016-08-12 15:48:36 UTC (rev 34913) @@ -466,6 +466,8 @@ line = m_commandHistory[cmdNum-1]; } + m_commandHistory += line; + if (CheckInternalCommand(line, m_cli.GetHelpCommand())) m_cli.ShowHelp(*this, line); else { @@ -474,8 +476,6 @@ m_cli.OnReceivedLine(args); m_state = e_CommandEntry; } - - m_commandHistory += line; } @@ -554,7 +554,7 @@ "\n" "Commands available are:") , m_repeatCommand("!!") - , m_historyCommand("!") + , m_historyCommand("!\nhistory") , m_noHistoryError("No command history") , m_commandUsagePrefix("Usage: ") , m_commandErrorPrefix(": error: ") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-08-09 14:27:37
|
Revision: 34912 http://sourceforge.net/p/opalvoip/code/34912 Author: rjongbloed Date: 2016-08-09 14:27:35 +0000 (Tue, 09 Aug 2016) Log Message: ----------- Make sure when silent/missing frames are reconstructed on delay (e.g. Opus FEC) that the outgoing packet has the correct timestamp, of the previous (missing) input not the one on which it was reconstructed. Modified Paths: -------------- opal/trunk/include/opal/transcoders.h opal/trunk/src/opal/transcoders.cxx Modified: opal/trunk/include/opal/transcoders.h =================================================================== --- opal/trunk/include/opal/transcoders.h 2016-08-08 14:13:37 UTC (rev 34911) +++ opal/trunk/include/opal/transcoders.h 2016-08-09 14:27:35 UTC (rev 34912) @@ -450,6 +450,7 @@ PINDEX inputBytesPerFrame; PINDEX outputBytesPerFrame; PINDEX maxOutputDataSize; + RTP_Timestamp m_lastSilentTimestamp; }; Modified: opal/trunk/src/opal/transcoders.cxx =================================================================== --- opal/trunk/src/opal/transcoders.cxx 2016-08-08 14:13:37 UTC (rev 34911) +++ opal/trunk/src/opal/transcoders.cxx 2016-08-09 14:27:35 UTC (rev 34912) @@ -498,6 +498,7 @@ OpalFramedTranscoder::OpalFramedTranscoder(const OpalMediaFormat & inputMediaFormat, const OpalMediaFormat & outputMediaFormat) : OpalTranscoder(inputMediaFormat, outputMediaFormat) + , m_lastSilentTimestamp(0) { CalculateSizes(); } @@ -605,6 +606,11 @@ outLen = maxOutputDataSize; if (!ConvertFrame(inputPtr, inputLength, outputPtr, outLen)) return false; + + /* If the codec is delaying the frame data (e.g. due to FEC of Opus) then + remember the timestamp of the reconstructed frame. */ + if (outLen == 0) + m_lastSilentTimestamp = input.GetTimestamp(); } else { if (!ConvertSilentFrame(outputPtr)) @@ -630,6 +636,12 @@ inputPtr += consumed; inputLength -= consumed; } + + // We have delayed output from codec, so use timestamp from original sample + if (outLen > 0 && m_lastSilentTimestamp != 0) { + output.SetTimestamp(m_lastSilentTimestamp); + m_lastSilentTimestamp = 0; + } } // set actual output payload size This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-08-08 14:13:40
|
Revision: 34911 http://sourceforge.net/p/opalvoip/code/34911 Author: rjongbloed Date: 2016-08-08 14:13:37 +0000 (Mon, 08 Aug 2016) Log Message: ----------- Fixed small race where stack walk of thread other than current one, could walk an incorrect thread if was terminated and new one started with same id. I think on Linux only. Modified Paths: -------------- ptlib/trunk/include/ptlib/object.h ptlib/trunk/src/ptlib/common/object.cxx ptlib/trunk/src/ptlib/common/osutils.cxx ptlib/trunk/src/ptlib/msos/assert.cxx ptlib/trunk/src/ptlib/unix/assert.cxx Modified: ptlib/trunk/include/ptlib/object.h =================================================================== --- ptlib/trunk/include/ptlib/object.h 2016-08-05 08:52:38 UTC (rev 34910) +++ ptlib/trunk/include/ptlib/object.h 2016-08-08 14:13:37 UTC (rev 34911) @@ -780,7 +780,8 @@ static void WalkStack( ostream & strm, - PThreadIdentifier id = PNullThreadIdentifier + PThreadIdentifier id = PNullThreadIdentifier, + PUniqueThreadIdentifier uid = 0 ); static unsigned MaxStackWalk; // Default 20 Modified: ptlib/trunk/src/ptlib/common/object.cxx =================================================================== --- ptlib/trunk/src/ptlib/common/object.cxx 2016-08-05 08:52:38 UTC (rev 34910) +++ ptlib/trunk/src/ptlib/common/object.cxx 2016-08-08 14:13:37 UTC (rev 34911) @@ -108,13 +108,13 @@ static PCriticalSection s_AssertMutex; extern void PPlatformAssertFunc(const char * msg, char defaultAction); -extern void PPlatformWalkStack(ostream & strm, PThreadIdentifier id, unsigned framesToSkip); +extern void PPlatformWalkStack(ostream & strm, PThreadIdentifier id, PUniqueThreadIdentifier uid, unsigned framesToSkip); #if PTRACING - void PTrace::WalkStack(ostream & strm, PThreadIdentifier id) + void PTrace::WalkStack(ostream & strm, PThreadIdentifier id, PUniqueThreadIdentifier uid) { s_AssertMutex.Wait(); - PPlatformWalkStack(strm, id, 1); // 1 means skip reporting PTrace::WalkStack + PPlatformWalkStack(strm, id, uid, 1); // 1 means skip reporting PTrace::WalkStack s_AssertMutex.Signal(); } #endif // PTRACING @@ -159,7 +159,7 @@ if (errorCode != 0) strm << ", error=" << errorCode; strm << ", when=" << PTime().AsString(PTime::LoggingFormat); - PPlatformWalkStack(strm, PNullThreadIdentifier, 2); // 2 means skip reporting InternalAssertFunc & PAssertFunc + PPlatformWalkStack(strm, PNullThreadIdentifier, 0, 2); // 2 means skip reporting InternalAssertFunc & PAssertFunc strm << ends; str = strm.str(); } Modified: ptlib/trunk/src/ptlib/common/osutils.cxx =================================================================== --- ptlib/trunk/src/ptlib/common/osutils.cxx 2016-08-05 08:52:38 UTC (rev 34910) +++ ptlib/trunk/src/ptlib/common/osutils.cxx 2016-08-08 14:13:37 UTC (rev 34911) @@ -2861,7 +2861,7 @@ strm << "Thread \"" << *thread << "\"" #if PTRACING "\n"; - PTrace::WalkStack(strm, thread->GetThreadId()); + PTrace::WalkStack(strm, thread->GetThreadId(), thread->GetUniqueIdentifier()); strm << " " #endif " failed to terminate in " << maxWait << " seconds"; @@ -2981,7 +2981,7 @@ { strm << " id=" << PThread::GetIdentifiersAsString(tid, uid) << " name=\"" << PThread::GetThreadName(tid) << '"'; if (walkStack) - PTrace::WalkStack(strm, tid); + PTrace::WalkStack(strm, tid, uid); } #endif @@ -3355,7 +3355,7 @@ if (!it->second.m_waiting) trace << ", LOCKER"; if (PTimedMutex::EnableDeadlockStackWalk) - PTrace::WalkStack(trace, it->first); + PTrace::WalkStack(trace, it->first, it->second.m_uniqueId); } trace << PTrace::End; } Modified: ptlib/trunk/src/ptlib/msos/assert.cxx =================================================================== --- ptlib/trunk/src/ptlib/msos/assert.cxx 2016-08-05 08:52:38 UTC (rev 34910) +++ ptlib/trunk/src/ptlib/msos/assert.cxx 2016-08-08 14:13:37 UTC (rev 34911) @@ -360,7 +360,7 @@ }; - void PPlatformWalkStack(ostream & strm, PThreadIdentifier id, unsigned framesToSkip) + void PPlatformWalkStack(ostream & strm, PThreadIdentifier id, PUniqueThreadIdentifier, unsigned framesToSkip) { PDebugDLL debughelp; if (debughelp.IsLoaded()) Modified: ptlib/trunk/src/ptlib/unix/assert.cxx =================================================================== --- ptlib/trunk/src/ptlib/unix/assert.cxx 2016-08-05 08:52:38 UTC (rev 34910) +++ ptlib/trunk/src/ptlib/unix/assert.cxx 2016-08-08 14:13:37 UTC (rev 34911) @@ -180,14 +180,16 @@ { enum { OtherThreadSkip = 6 }; pthread_mutex_t m_mainMutex; - PThreadIdentifier m_id; + PThreadIdentifier m_threadId; + PUniqueThreadIdentifier m_uniqueId; vector<void *> m_addresses; int m_addressCount; pthread_mutex_t m_condMutex; pthread_cond_t m_condVar; PWalkStackInfo() - : m_id(PNullThreadIdentifier) + : m_threadId(PNullThreadIdentifier) + , m_uniqueId(0) , m_addressCount(-1) { pthread_mutex_init(&m_mainMutex, NULL); @@ -195,11 +197,12 @@ pthread_cond_init(&m_condVar, NULL); } - void WalkOther(ostream & strm, PThreadIdentifier id) + void WalkOther(ostream & strm, PThreadIdentifier id, PUniqueThreadIdentifier uid) { pthread_mutex_lock(&m_mainMutex); - m_id = id; + m_threadId = id; + m_uniqueId = uid; m_addressCount = -1; m_addresses.resize(InternalMaxStackWalk+OtherThreadSkip); if (!PThread::PX_kill(id, PProcess::WalkStackSignal)) { @@ -226,20 +229,23 @@ else InternalWalkStack(strm, OtherThreadSkip, m_addresses.data(), m_addressCount); - m_id = PNullThreadIdentifier; + m_threadId = PNullThreadIdentifier; + m_uniqueId = 0; pthread_mutex_unlock(&m_mainMutex); } void OthersWalk() { - PThreadIdentifier id = PThread::GetCurrentThreadId(); - if (m_id != id) { - if (id == PNullThreadIdentifier) + PThreadIdentifier tid = PThread::GetCurrentThreadId(); + PUniqueThreadIdentifier uid = PThread::GetCurrentUniqueIdentifier(); + + if (m_threadId != tid || (m_uniqueId != 0 && m_uniqueId != uid)) { + if (tid == PNullThreadIdentifier) PTRACE(0, "StackWalk", "Thread took too long to respond to signal"); else - PTRACE(0, "StackWalk", "Signal received on " << id << " (0x" << hex << id << ")" - " but expected " << m_id << " (0x" << hex << m_id << ')'); + PTRACE(0, "StackWalk", "Signal received on " << PThread::GetIdentifiersAsString(tid, uid) << + " but expected " << PThread::GetIdentifiersAsString(m_threadId, m_uniqueId)); return; } @@ -262,13 +268,13 @@ static PWalkStackInfo s_otherThreadStack; - void PPlatformWalkStack(ostream & strm, PThreadIdentifier id, unsigned framesToSkip) + void PPlatformWalkStack(ostream & strm, PThreadIdentifier id, PUniqueThreadIdentifier uid, unsigned framesToSkip) { if (!PProcess::IsInitialised()) return; if (id != PNullThreadIdentifier && id != PThread::GetCurrentThreadId()) - s_otherThreadStack.WalkOther(strm, id); + s_otherThreadStack.WalkOther(strm, id, uid); else { // Allow for some bizarre optimisation when called from PTrace::WalkStack() if (framesToSkip == 1) @@ -287,7 +293,7 @@ #else - void PPlatformWalkStack(ostream & strm, PThreadIdentifier id, unsigned skip) + void PPlatformWalkStack(ostream & strm, PThreadIdentifier id, PUniqueThreadIdentifier uid, unsigned skip) { } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-08-05 08:52:40
|
Revision: 34910 http://sourceforge.net/p/opalvoip/code/34910 Author: rjongbloed Date: 2016-08-05 08:52:38 +0000 (Fri, 05 Aug 2016) Log Message: ----------- IMproved logs around HTTP server persistent connections. Modified Paths: -------------- ptlib/trunk/src/ptclib/httpsrvr.cxx Modified: ptlib/trunk/src/ptclib/httpsrvr.cxx =================================================================== --- ptlib/trunk/src/ptclib/httpsrvr.cxx 2016-08-03 18:36:06 UTC (rev 34909) +++ ptlib/trunk/src/ptclib/httpsrvr.cxx 2016-08-05 08:52:38 UTC (rev 34910) @@ -289,7 +289,10 @@ // make sure the form info is reset for each new operation connectInfo.ResetMultipartFormInfo(); - PTRACE(5, "Transaction " << connectInfo.GetCommandName() << " \"" << args << "\" url=" << connectInfo.GetURL()); + PTRACE(5, "Transaction: " << connectInfo.GetCommandName() << " \"" << args << "\"," + " url=" << connectInfo.GetURL() << "," + " persist=" << std::boolalpha << connectInfo.IsPersistent() << "," + " proxy=" << connectInfo.IsProxyConnection()); if (connectInfo.IsWebSocket()) { if (!OnWebSocket(connectInfo)) @@ -323,11 +326,13 @@ // we always close the socket so the client will get the correct end of file if (persist && connectInfo.IsPersistent()) { unsigned max = connectInfo.GetPersistenceMaximumTransations(); - if (max == 0 || transactionCount < max) + if (max == 0 || transactionCount < max) { + PTRACE(5, "Connection persisting: transactions=" << transactionCount << ", max=" << max); return true; + } } - PTRACE(5, "Connection end: " << connectInfo.IsPersistent()); + PTRACE(5, "Connection persistence ended: requested=" << std::boolalpha << connectInfo.IsPersistent() << ", persist=" << persist); // close the output stream now and return false Shutdown(ShutdownWrite); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-08-03 18:36:08
|
Revision: 34909 http://sourceforge.net/p/opalvoip/code/34909 Author: rjongbloed Date: 2016-08-03 18:36:06 +0000 (Wed, 03 Aug 2016) Log Message: ----------- Merged revision(s) 34894-34908 from opal/branches/v3_16: --------------------- r34908 Fixed missing mutex in call recording, thanks Kevin Verfaille. --------------------- r34907 Fixed some more compilation with various options disabled. --------------------- r34903 Fixed numerous build failures when various options are disabled. --------------------- r34898 Fixed build without video Revision Links: -------------- http://sourceforge.net/p/opalvoip/code/34908 http://sourceforge.net/p/opalvoip/code/34907 http://sourceforge.net/p/opalvoip/code/34903 http://sourceforge.net/p/opalvoip/code/34898 Modified Paths: -------------- opal/trunk/include/ep/pcss.h opal/trunk/samples/callgen/main.cxx opal/trunk/samples/callgen/main.h opal/trunk/samples/callgen/precompile.h opal/trunk/samples/ivr/main.cxx opal/trunk/src/h323/h323ep.cxx opal/trunk/src/opal/call.cxx opal/trunk/src/opal/patch.cxx Property Changed: ---------------- opal/trunk/ Index: opal/trunk =================================================================== --- opal/trunk 2016-08-03 18:17:00 UTC (rev 34908) +++ opal/trunk 2016-08-03 18:36:06 UTC (rev 34909) Property changes on: opal/trunk ___________________________________________________________________ Modified: svn:mergeinfo ## -10,7 +10,7 ## /opal/branches/v3_10:25182-29485,30896,32927-32928,32933 /opal/branches/v3_12:28489-31709 /opal/branches/v3_14:31505-33613 -/opal/branches/v3_16:34090-34893 +/opal/branches/v3_16:34090-34908 /opal/branches/v3_2:21143,21220,21227,21253,21455 /opal/branches/v3_4:21060,21062,21088,21092,21111,21113,21115,21119,21143,21148,21151-21152,21155,21158,21184,21188,21253,21265-21266,21283-21284,21298,21300,21303,21307,21309,21311,21327,21331,21333,21359,21367,21369,21488,21556,21564-21565,21568,21570,21620,21625,21631,21748,21751,21756,21759,21761,21767,21770,22246,23044,23140,23143,23286 /opal/branches/v3_6:22169,22178,22184,22186,22197,22204,22216,22251,22253,22255,22258,22260,22291,22296,22300,22306,22308,22313,22319,22336,22353,22358,22436,22447,22449,22497,22511,22517,22519-22521,22527,22536,22538,22589,22596,22599,22617,22620,22622,22630,22640,22655,22675,22682,22726-22728,22730,22733,22738,22745-22746,22800,22820-22821,22842,22844-22845,22851,22853,22889,22896,22902,22904,22906,22918,22924,22928,22946,22965,22967,22976,22978,22980,22982,22994,23028,23123,23125-23126,23128,23157,23165,23173,23175,23183,23294,23341,23465,23467,23474,23521,23829,24346,24809 \ No newline at end of property Modified: opal/trunk/include/ep/pcss.h =================================================================== --- opal/trunk/include/ep/pcss.h 2016-08-03 18:17:00 UTC (rev 34908) +++ opal/trunk/include/ep/pcss.h 2016-08-03 18:36:06 UTC (rev 34909) @@ -683,5 +683,11 @@ bool m_userInputAutoDelete; void UserInputMain(); }; + +#else + +#define OPAL_PCSS_PREFIX + #endif // OPAL_HAS_PCSS + #endif // OPAL_OPAL_PCSS_H Modified: opal/trunk/samples/callgen/main.cxx =================================================================== --- opal/trunk/samples/callgen/main.cxx 2016-08-03 18:17:00 UTC (rev 34908) +++ opal/trunk/samples/callgen/main.cxx 2016-08-03 18:36:06 UTC (rev 34909) @@ -611,6 +611,7 @@ } +#if OPAL_VIDEO PFile * MyLocalEndPoint::OpenVideoFile() const { if (m_videoFilePath.IsEmpty()) @@ -627,6 +628,7 @@ delete file; return NULL; } +#endif // OPAL_VIDEO OpalLocalConnection * MyLocalEndPoint::CreateConnection(OpalCall & call, void * userData, unsigned options, OpalConnection::StringOptions * stringOptions) Modified: opal/trunk/samples/callgen/main.h =================================================================== --- opal/trunk/samples/callgen/main.h 2016-08-03 18:17:00 UTC (rev 34908) +++ opal/trunk/samples/callgen/main.h 2016-08-03 18:36:06 UTC (rev 34909) @@ -25,9 +25,6 @@ */ -#include <rtp/pcapfile.h> - - class MyManager; /////////////////////////////////////////////////////////////////////////////// Modified: opal/trunk/samples/callgen/precompile.h =================================================================== --- opal/trunk/samples/callgen/precompile.h 2016-08-03 18:17:00 UTC (rev 34908) +++ opal/trunk/samples/callgen/precompile.h 2016-08-03 18:36:06 UTC (rev 34909) @@ -37,6 +37,8 @@ #include <h323/h323ep.h> #include <h323/gkclient.h> #include <sip/sipep.h> +#include <codec/vidcodec.h> +#include <rtp/pcapfile.h> // End of File /////////////////////////////////////////////////////////////// Modified: opal/trunk/samples/ivr/main.cxx =================================================================== --- opal/trunk/samples/ivr/main.cxx 2016-08-03 18:17:00 UTC (rev 34908) +++ opal/trunk/samples/ivr/main.cxx 2016-08-03 18:36:06 UTC (rev 34909) @@ -50,7 +50,9 @@ MyIVREndPoint * ivr = new MyIVREndPoint(*this); ivr->SetDefaultVXML(args[0]); +#if OPAL_HAS_PCSS FindEndPointAs<OpalLocalEndPoint>(OPAL_PCSS_PREFIX)->SetDeferredAnswer(false); +#endif switch (args.GetCount()) { default : @@ -111,12 +113,14 @@ void MyManager::OnEstablishedCall(OpalCall & call) { OpalManagerConsole::OnEstablishedCall(call); +#if OPAL_HAS_PCSS OpalPCSSConnection * pcss = call.GetConnectionAs<OpalPCSSConnection>(); if (pcss != NULL) { PConsoleChannel * chan = new PConsoleChannel(PConsoleChannel::StandardInput); chan->SetLineBuffered(false); pcss->StartReadUserInput(chan); } +#endif // OPAL_HAS_PCSS } Modified: opal/trunk/src/h323/h323ep.cxx =================================================================== --- opal/trunk/src/h323/h323ep.cxx 2016-08-03 18:17:00 UTC (rev 34908) +++ opal/trunk/src/h323/h323ep.cxx 2016-08-03 18:36:06 UTC (rev 34909) @@ -113,7 +113,9 @@ , m_gatekeeperAliasLimit(MaxGatekeeperAliasLimit) , m_gatekeeperSimulatePattern(false) , m_gatekeeperRasRedirect(true) +#if OPAL_H450 , m_nextH450CallIdentity(0) +#endif #if OPAL_H460 , m_features(NULL) #endif Modified: opal/trunk/src/opal/call.cxx =================================================================== --- opal/trunk/src/opal/call.cxx 2016-08-03 18:17:00 UTC (rev 34908) +++ opal/trunk/src/opal/call.cxx 2016-08-03 18:36:06 UTC (rev 34909) @@ -858,7 +858,7 @@ bool OpalCall::IsRecording() const { PSafeLockReadOnly lock(*this); - return m_recordManager != NULL && m_recordManager->IsOpen(); + return lock.IsLocked() && m_recordManager != NULL && m_recordManager->IsOpen(); } @@ -881,20 +881,23 @@ bool OpalCall::OnStartRecording(const PString & streamId, const OpalMediaFormat & format) { - return m_recordManager != NULL && m_recordManager->OpenStream(streamId, format); + PSafeLockReadOnly lock(*this); + return lock.IsLocked() && m_recordManager != NULL && m_recordManager->OpenStream(streamId, format); } void OpalCall::OnStopRecording(const PString & streamId) { - if (m_recordManager != NULL) + PSafeLockReadOnly lock(*this); + if (lock.IsLocked() && m_recordManager != NULL) m_recordManager->CloseStream(streamId); } void OpalCall::OnRecordAudio(const PString & streamId, const RTP_DataFrame & frame) { - if (m_recordManager != NULL && !m_recordManager->WriteAudio(streamId, frame)) + PSafeLockReadOnly lock(*this); + if (lock.IsLocked() && m_recordManager != NULL && !m_recordManager->WriteAudio(streamId, frame)) m_recordManager->CloseStream(streamId); } @@ -903,7 +906,8 @@ void OpalCall::OnRecordVideo(const PString & streamId, const RTP_DataFrame & frame) { - if (m_recordManager != NULL && !m_recordManager->WriteVideo(streamId, frame)) + PSafeLockReadOnly lock(*this); + if (lock.IsLocked() && m_recordManager != NULL && !m_recordManager->WriteVideo(streamId, frame)) m_recordManager->CloseStream(streamId); } Modified: opal/trunk/src/opal/patch.cxx =================================================================== --- opal/trunk/src/opal/patch.cxx 2016-08-03 18:17:00 UTC (rev 34908) +++ opal/trunk/src/opal/patch.cxx 2016-08-03 18:36:06 UTC (rev 34909) @@ -295,10 +295,12 @@ m_stream->SetDataSize(packetSize, packetTime); m_stream->InternalUpdateMediaFormat(m_stream->GetMediaFormat()); m_patch.m_source.InternalUpdateMediaFormat(m_patch.m_source.GetMediaFormat()); +#if OPAL_STATISTICS m_audioFormat = sourceFormat; #if OPAL_VIDEO m_videoFormat = sourceFormat; #endif // OPAL_VIDEO +#endif // OPAL_STATISTICS PTRACE(3, "Changed to direct media on " << m_patch); return true; } @@ -944,7 +946,7 @@ if (m_primaryCodec != NULL) atLeastOne = m_primaryCodec->ExecuteCommand(command) || atLeastOne; -#if OPAL_VIDEO +#if OPAL_VIDEO && OPAL_STATISTICS if (atLeastOne) { const OpalVideoUpdatePicture * update = dynamic_cast<const OpalVideoUpdatePicture *>(&command); if (update != NULL) { @@ -967,6 +969,7 @@ return true; if (bypassing || m_primaryCodec == NULL) { +#if OPAL_STATISTICS OpalAudioFormat::FrameType audioFrameType; if (m_audioFormat.IsValid()) audioFrameType = m_audioFormat.GetFrameType(sourceFrame.GetPayloadPtr(), sourceFrame.GetPayloadSize(), m_audioFrameDetector); @@ -979,10 +982,12 @@ else videoFrameType = OpalVideoFormat::e_UnknownFrameType; #endif // OPAL_VIDEO +#endif // OPAL_STATISTICS if (!m_stream->WritePacket(sourceFrame)) return false; +#if OPAL_STATISTICS RTP_SyncSourceId ssrc; if (audioFrameType != OpalAudioFormat::e_UnknownFrameType) { PWaitAndSignal mutex(m_statsMutex); @@ -1032,6 +1037,7 @@ break; } #endif // OPAL_VIDEO +#endif // OPAL_STATISTICS PTRACE_IF(6, bypassing, "Bypassed packet " << setw(1) << sourceFrame); return true; @@ -1075,7 +1081,7 @@ PWaitAndSignal mutex(m_statsMutex); m_videoStatistics[0].IncrementFrames(videoCodec->WasLastFrameIFrame()); } -#endif +#endif // OPAL_VIDEO && OPAL_STATISTICS return true; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-08-03 18:17:03
|
Revision: 34908 http://sourceforge.net/p/opalvoip/code/34908 Author: rjongbloed Date: 2016-08-03 18:17:00 +0000 (Wed, 03 Aug 2016) Log Message: ----------- Fixed missing mutex in call recording, thanks Kevin Verfaille. Modified Paths: -------------- opal/branches/v3_16/src/opal/call.cxx Modified: opal/branches/v3_16/src/opal/call.cxx =================================================================== --- opal/branches/v3_16/src/opal/call.cxx 2016-08-03 16:58:08 UTC (rev 34907) +++ opal/branches/v3_16/src/opal/call.cxx 2016-08-03 18:17:00 UTC (rev 34908) @@ -858,7 +858,7 @@ bool OpalCall::IsRecording() const { PSafeLockReadOnly lock(*this); - return m_recordManager != NULL && m_recordManager->IsOpen(); + return lock.IsLocked() && m_recordManager != NULL && m_recordManager->IsOpen(); } @@ -881,20 +881,23 @@ bool OpalCall::OnStartRecording(const PString & streamId, const OpalMediaFormat & format) { - return m_recordManager != NULL && m_recordManager->OpenStream(streamId, format); + PSafeLockReadOnly lock(*this); + return lock.IsLocked() && m_recordManager != NULL && m_recordManager->OpenStream(streamId, format); } void OpalCall::OnStopRecording(const PString & streamId) { - if (m_recordManager != NULL) + PSafeLockReadOnly lock(*this); + if (lock.IsLocked() && m_recordManager != NULL) m_recordManager->CloseStream(streamId); } void OpalCall::OnRecordAudio(const PString & streamId, const RTP_DataFrame & frame) { - if (m_recordManager != NULL && !m_recordManager->WriteAudio(streamId, frame)) + PSafeLockReadOnly lock(*this); + if (lock.IsLocked() && m_recordManager != NULL && !m_recordManager->WriteAudio(streamId, frame)) m_recordManager->CloseStream(streamId); } @@ -903,7 +906,8 @@ void OpalCall::OnRecordVideo(const PString & streamId, const RTP_DataFrame & frame) { - if (m_recordManager != NULL && !m_recordManager->WriteVideo(streamId, frame)) + PSafeLockReadOnly lock(*this); + if (lock.IsLocked() && m_recordManager != NULL && !m_recordManager->WriteVideo(streamId, frame)) m_recordManager->CloseStream(streamId); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-08-03 16:58:10
|
Revision: 34907 http://sourceforge.net/p/opalvoip/code/34907 Author: rjongbloed Date: 2016-08-03 16:58:08 +0000 (Wed, 03 Aug 2016) Log Message: ----------- Fixed some more compilation with various options disabled. Modified Paths: -------------- opal/branches/v3_16/samples/ivr/main.cxx opal/branches/v3_16/src/opal/patch.cxx Modified: opal/branches/v3_16/samples/ivr/main.cxx =================================================================== --- opal/branches/v3_16/samples/ivr/main.cxx 2016-08-03 09:31:34 UTC (rev 34906) +++ opal/branches/v3_16/samples/ivr/main.cxx 2016-08-03 16:58:08 UTC (rev 34907) @@ -50,7 +50,9 @@ MyIVREndPoint * ivr = new MyIVREndPoint(*this); ivr->SetDefaultVXML(args[0]); +#if OPAL_HAS_PCSS FindEndPointAs<OpalLocalEndPoint>(OPAL_PCSS_PREFIX)->SetDeferredAnswer(false); +#endif switch (args.GetCount()) { default : Modified: opal/branches/v3_16/src/opal/patch.cxx =================================================================== --- opal/branches/v3_16/src/opal/patch.cxx 2016-08-03 09:31:34 UTC (rev 34906) +++ opal/branches/v3_16/src/opal/patch.cxx 2016-08-03 16:58:08 UTC (rev 34907) @@ -948,7 +948,7 @@ if (m_primaryCodec != NULL) atLeastOne = m_primaryCodec->ExecuteCommand(command) || atLeastOne; -#if OPAL_VIDEO +#if OPAL_VIDEO && OPAL_STATISTICS if (atLeastOne) { const OpalVideoUpdatePicture * update = dynamic_cast<const OpalVideoUpdatePicture *>(&command); if (update != NULL) { @@ -1029,18 +1029,20 @@ } } +#if OPAL_STATISTICS OpalVideoFormat::VideoFrameType frameType; if (m_videoFormat.IsValid()) frameType = m_videoFormat.GetVideoFrameType(sourceFrame.GetPayloadPtr(), sourceFrame.GetPayloadSize(), m_keyFrameDetectContext); else frameType = OpalVideoFormat::e_UnknownFrameType; +#endif // OPAL_STATISTICS #endif // OPAL_VIDEO if (bypassing || m_primaryCodec == NULL) { if (!m_stream->WritePacket(sourceFrame)) return false; -#if OPAL_VIDEO +#if OPAL_VIDEO && OPAL_STATISTICS RTP_SyncSourceId ssrc; switch (frameType) { case OpalVideoFormat::e_IntraFrame : @@ -1069,7 +1071,7 @@ default : break; } -#endif // OPAL_VIDEO +#endif // OPAL_VIDEO && OPAL_STATISTICS PTRACE_IF(6, bypassing, "Bypassed packet " << setw(1) << sourceFrame); return true; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-08-03 09:31:36
|
Revision: 34906 http://sourceforge.net/p/opalvoip/code/34906 Author: rjongbloed Date: 2016-08-03 09:31:34 +0000 (Wed, 03 Aug 2016) Log Message: ----------- Made the auto upgrade for PSecureHTTPServiceProcess more flexible, working with any HTTP command, not just GET and POST. Modified Paths: -------------- ptlib/trunk/src/ptclib/shttpsvc.cxx Modified: ptlib/trunk/src/ptclib/shttpsvc.cxx =================================================================== --- ptlib/trunk/src/ptclib/shttpsvc.cxx 2016-08-02 18:26:23 UTC (rev 34905) +++ ptlib/trunk/src/ptclib/shttpsvc.cxx 2016-08-03 09:31:34 UTC (rev 34906) @@ -50,11 +50,13 @@ virtual int BioRead(char * out, int outl); protected: - enum { PreRead_Size = 4 }; - - PSecureHTTPServiceProcess * svc; - PINDEX preReadLen; - char preRead[PreRead_Size]; + PSecureHTTPServiceProcess * m_serviceProcess; + PCaselessString m_preReadData; + enum { + e_Starting, + e_IsSSL, + e_Finished } + m_preReadState; }; #define new PNEW @@ -242,51 +244,61 @@ CRLF); } -HTTP_PSSLChannel::HTTP_PSSLChannel(PSecureHTTPServiceProcess * _svc, PSSLContext * context) - : PSSLChannel(context), svc(_svc) +HTTP_PSSLChannel::HTTP_PSSLChannel(PSecureHTTPServiceProcess * svc, PSSLContext * context) + : PSSLChannel(context) + , m_serviceProcess(svc) + , m_preReadState(e_Starting) { - preReadLen = P_MAX_INDEX; } int HTTP_PSSLChannel::BioRead(char * buf, int len) -{ - if (preReadLen == 0) - return PSSLChannel::BioRead(buf, len); +{ + if (m_preReadState == e_Finished) + return PSSLChannel::BioRead(buf, len); - if (preReadLen == P_MAX_INDEX) { + if (m_preReadState == e_Starting) { PChannel * chan = GetReadChannel(); - // read some bytes from the channel - preReadLen = 0; - while (preReadLen < PreRead_Size) { - PBoolean b = chan->Read(preRead + preReadLen, PreRead_Size - preReadLen); - if (!b) - break; - preReadLen += chan->GetLastReadCount(); - } + // read first line from the channel + for (;;) { + int c = chan->ReadChar(); + if (c < 0) + return -1; - // see if these bytes correspond to a GET or POST - if ( - (preReadLen == PreRead_Size) && - ((strncmp(preRead, "GET", 3) == 0) || (strncmp(preRead, "POST", 4) == 0)) - ) { + m_preReadData += (char)c; - // read in the rest of the line - PString line(preRead, 4); - int ch; - while (((ch = chan->ReadChar()) > 0) && (ch != '\n')) - line += (char)ch; + if (c == '\n' && m_preReadData.Find("HTTP/1") != P_MAX_INDEX) { + if (m_serviceProcess->OnDetectedNonSSLConnection(chan, m_preReadData)) + chan->Close(); + return -1; + } - if (!svc->OnDetectedNonSSLConnection(chan, line)) - return -1; + if (c == '\r' || !iscntrl(c)) + continue; + + if (!m_preReadData.IsEmpty()) { + m_preReadState = e_IsSSL; + break; + } + + m_preReadState = e_Finished; + *buf = (char)c; + len = 1; + return len; } } - // copy some bytes to the returned buffer, but no more than the buffer will allow - len = std::min(len, (int)preReadLen); - memcpy(buf, preRead, len); - preReadLen -= len; + // copy pre-read bytes to the supplied buffer, but no more than the buffer will allow + if (len < (int)m_preReadData.GetLength()) { + memcpy(buf, m_preReadData.GetPointer(), len); + m_preReadData.Delete(0, len); + } + else { + len = m_preReadData.GetLength(); + memcpy(buf, m_preReadData.GetPointer(), len); + m_preReadState = e_Finished; + } return len; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-08-02 18:26:25
|
Revision: 34905 http://sourceforge.net/p/opalvoip/code/34905 Author: rjongbloed Date: 2016-08-02 18:26:23 +0000 (Tue, 02 Aug 2016) Log Message: ----------- When attaching certificate file to a SSL context, make sure we also include the CA chain that might be present. Modified Paths: -------------- ptlib/trunk/include/ptclib/pssl.h ptlib/trunk/src/ptclib/pssl.cxx Modified: ptlib/trunk/include/ptclib/pssl.h =================================================================== --- ptlib/trunk/include/ptclib/pssl.h 2016-08-02 15:55:27 UTC (rev 34904) +++ ptlib/trunk/include/ptclib/pssl.h 2016-08-02 18:26:23 UTC (rev 34905) @@ -362,9 +362,13 @@ virtual void PrintOn(ostream & strm) const { strm << GetSubjectName(); } + typedef std::list<x509_st *> X509_Chain; + const X509_Chain & GetChain() const { return m_chain; } + protected: void FreeCertificate(); x509_st * m_certificate; + X509_Chain m_chain; }; Modified: ptlib/trunk/src/ptclib/pssl.cxx =================================================================== --- ptlib/trunk/src/ptclib/pssl.cxx 2016-08-02 15:55:27 UTC (rev 34904) +++ ptlib/trunk/src/ptclib/pssl.cxx 2016-08-02 18:26:23 UTC (rev 34905) @@ -551,6 +551,10 @@ if (m_certificate != NULL) { X509_free(m_certificate); m_certificate = NULL; + + for (X509_Chain::iterator it = m_chain.begin(); it != m_chain.end(); ++it) + X509_free(*it); + m_chain.clear(); } } @@ -674,6 +678,9 @@ PBoolean PSSLCertificate::Load(const PFilePath & certFile, PSSLFileTypes fileType) { + if (fileType == PSSLFileTypeDEFAULT) + return Load(certFile, PSSLFileTypePEM) || Load(certFile, PSSLFileTypeASN1); + FreeCertificate(); PSSL_BIO in; @@ -682,6 +689,8 @@ return false; } + X509 * ca; + switch (fileType) { case PSSLFileTypeASN1 : m_certificate = d2i_X509_bio(in, NULL); @@ -693,22 +702,16 @@ case PSSLFileTypePEM : m_certificate = PEM_read_bio_X509(in, NULL, NULL, NULL); - if (m_certificate != NULL) - break; + if (m_certificate == NULL) { + PTRACE(2, "Invalid PEM certificate file \"" << certFile << '"'); + return false; + } + while ((ca = PEM_read_bio_X509(in, NULL, NULL, NULL)) != NULL) + m_chain.push_back(ca); + break; - PTRACE(2, "Invalid PEM certificate file \"" << certFile << '"'); - return false; - default : - m_certificate = PEM_read_bio_X509(in, NULL, NULL, NULL); - if (m_certificate != NULL) - break; - - m_certificate = d2i_X509_bio(in, NULL); - if (m_certificate != NULL) - break; - - PTRACE(2, "Invalid certificate file \"" << certFile << '"'); + PTRACE(2, "Unsupported certificate file \"" << certFile << '"'); return false; } @@ -2060,9 +2063,31 @@ bool PSSLContext::UseCertificate(const PSSLCertificate & certificate) { - return PAssertNULL(m_context) != NULL && - certificate.IsValid() && - SSL_CTX_use_certificate(m_context, certificate) > 0; + if (PAssertNULL(m_context) == NULL) + return false; + + if (!certificate.IsValid()) + return false; + + if (SSL_CTX_use_certificate(m_context, certificate) == 0) { + PTRACE(2, "Could not use certificate: " << PSSLError()); + return false; + } + + SSL_CTX_clear_chain_certs(m_context); + + const PSSLCertificate::X509_Chain & chain = certificate.GetChain(); + for (PSSLCertificate::X509_Chain::const_iterator it = chain.begin(); it != chain.end(); ++it) { + X509 * ca = X509_dup(*it); + if (!SSL_CTX_add0_chain_cert(m_context, ca)) { + PTRACE(2, "Could not use certificate chain: " << PSSLError()); + X509_free(ca); + return false; + } + } + + PTRACE(5, "Using certificate with " << chain.size() << " CAs in chain"); + return true; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-08-02 15:55:29
|
Revision: 34904 http://sourceforge.net/p/opalvoip/code/34904 Author: rjongbloed Date: 2016-08-02 15:55:27 +0000 (Tue, 02 Aug 2016) Log Message: ----------- Make sure content length included in PSecureHTTPServiceProcess redirect http response to upgrade to https. Modified Paths: -------------- ptlib/trunk/src/ptclib/shttpsvc.cxx Modified: ptlib/trunk/src/ptclib/shttpsvc.cxx =================================================================== --- ptlib/trunk/src/ptclib/shttpsvc.cxx 2016-08-02 13:54:37 UTC (rev 34903) +++ ptlib/trunk/src/ptclib/shttpsvc.cxx 2016-08-02 15:55:27 UTC (rev 34904) @@ -235,9 +235,11 @@ PString PSecureHTTPServiceProcess::CreateRedirectMessage(const PString & url) { - return PString("HTTP/1.1 301 Moved Permanently\r\n") + - "Location: " + url + "\r\n" + - "\r\n"; + static const char * CRLF = "\r\n"; + return PSTRSTRM("HTTP/1.1 301 Moved Permanently" << CRLF << + PHTTP::LocationTag() << ": " << url << CRLF << + PHTTP::ContentLengthTag() << ": 0" << CRLF << + CRLF); } HTTP_PSSLChannel::HTTP_PSSLChannel(PSecureHTTPServiceProcess * _svc, PSSLContext * context) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-08-02 13:54:39
|
Revision: 34903 http://sourceforge.net/p/opalvoip/code/34903 Author: rjongbloed Date: 2016-08-02 13:54:37 +0000 (Tue, 02 Aug 2016) Log Message: ----------- Fixed numerous build failures when various options are disabled. Modified Paths: -------------- opal/branches/v3_16/include/ep/pcss.h opal/branches/v3_16/samples/callgen/main.h opal/branches/v3_16/samples/callgen/precompile.h opal/branches/v3_16/samples/ivr/main.cxx opal/branches/v3_16/src/h323/h323ep.cxx opal/branches/v3_16/src/opal/patch.cxx Modified: opal/branches/v3_16/include/ep/pcss.h =================================================================== --- opal/branches/v3_16/include/ep/pcss.h 2016-08-02 12:59:43 UTC (rev 34902) +++ opal/branches/v3_16/include/ep/pcss.h 2016-08-02 13:54:37 UTC (rev 34903) @@ -683,5 +683,11 @@ bool m_userInputAutoDelete; void UserInputMain(); }; + +#else + +#define OPAL_PCSS_PREFIX + #endif // OPAL_HAS_PCSS + #endif // OPAL_OPAL_PCSS_H Modified: opal/branches/v3_16/samples/callgen/main.h =================================================================== --- opal/branches/v3_16/samples/callgen/main.h 2016-08-02 12:59:43 UTC (rev 34902) +++ opal/branches/v3_16/samples/callgen/main.h 2016-08-02 13:54:37 UTC (rev 34903) @@ -25,9 +25,6 @@ */ -#include <rtp/pcapfile.h> - - class MyManager; /////////////////////////////////////////////////////////////////////////////// Modified: opal/branches/v3_16/samples/callgen/precompile.h =================================================================== --- opal/branches/v3_16/samples/callgen/precompile.h 2016-08-02 12:59:43 UTC (rev 34902) +++ opal/branches/v3_16/samples/callgen/precompile.h 2016-08-02 13:54:37 UTC (rev 34903) @@ -37,6 +37,8 @@ #include <h323/h323ep.h> #include <h323/gkclient.h> #include <sip/sipep.h> +#include <codec/vidcodec.h> +#include <rtp/pcapfile.h> // End of File /////////////////////////////////////////////////////////////// Modified: opal/branches/v3_16/samples/ivr/main.cxx =================================================================== --- opal/branches/v3_16/samples/ivr/main.cxx 2016-08-02 12:59:43 UTC (rev 34902) +++ opal/branches/v3_16/samples/ivr/main.cxx 2016-08-02 13:54:37 UTC (rev 34903) @@ -111,12 +111,14 @@ void MyManager::OnEstablishedCall(OpalCall & call) { OpalManagerConsole::OnEstablishedCall(call); +#if OPAL_HAS_PCSS OpalPCSSConnection * pcss = call.GetConnectionAs<OpalPCSSConnection>(); if (pcss != NULL) { PConsoleChannel * chan = new PConsoleChannel(PConsoleChannel::StandardInput); chan->SetLineBuffered(false); pcss->StartReadUserInput(chan); } +#endif // OPAL_HAS_PCSS } Modified: opal/branches/v3_16/src/h323/h323ep.cxx =================================================================== --- opal/branches/v3_16/src/h323/h323ep.cxx 2016-08-02 12:59:43 UTC (rev 34902) +++ opal/branches/v3_16/src/h323/h323ep.cxx 2016-08-02 13:54:37 UTC (rev 34903) @@ -105,7 +105,9 @@ , m_gatekeeperAliasLimit(MaxGatekeeperAliasLimit) , m_gatekeeperSimulatePattern(false) , m_gatekeeperRasRedirect(true) +#if OPAL_H450 , m_nextH450CallIdentity(0) +#endif #if OPAL_H460 , m_features(NULL) #endif Modified: opal/branches/v3_16/src/opal/patch.cxx =================================================================== --- opal/branches/v3_16/src/opal/patch.cxx 2016-08-02 12:59:43 UTC (rev 34902) +++ opal/branches/v3_16/src/opal/patch.cxx 2016-08-02 13:54:37 UTC (rev 34903) @@ -295,10 +295,10 @@ m_stream->SetDataSize(packetSize, packetTime); m_stream->InternalUpdateMediaFormat(m_stream->GetMediaFormat()); m_patch.m_source.InternalUpdateMediaFormat(m_patch.m_source.GetMediaFormat()); -#if OPAL_VIDEO +#if OPAL_VIDEO && OPAL_STATISTICS if (sourceFormat.GetMediaType() == OpalMediaType::Video()) m_videoFormat = sourceFormat; -#endif // OPAL_VIDEO +#endif // OPAL_VIDEO && OPAL_STATISTICS PTRACE(3, "Changed to direct media on " << m_patch); return true; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-08-02 12:59:46
|
Revision: 34902 http://sourceforge.net/p/opalvoip/code/34902 Author: rjongbloed Date: 2016-08-02 12:59:43 +0000 (Tue, 02 Aug 2016) Log Message: ----------- Fixed URL scheme in PSecureHTTPServiceProcess auto-upgrade from http to https. Modified Paths: -------------- ptlib/trunk/src/ptclib/shttpsvc.cxx Modified: ptlib/trunk/src/ptclib/shttpsvc.cxx =================================================================== --- ptlib/trunk/src/ptclib/shttpsvc.cxx 2016-08-01 13:00:48 UTC (rev 34901) +++ ptlib/trunk/src/ptclib/shttpsvc.cxx 2016-08-02 12:59:43 UTC (rev 34902) @@ -214,8 +214,8 @@ } } - url.Splice("http://", 0); - PSYSTEMLOG(Info, "Detected non-SSL connection, redirecting to " << url); + url.Splice("https://", 0); + PSYSTEMLOG(Info, "Detected non-SSL connection, host=\"" << host << "\", redirecting to " << url); PString str = CreateNonSSLMessage(url); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |