Ticket #6: dss-hh-20081021-1.patch
| File dss-hh-20081021-1.patch, 14.7 KB (added by horace.hsieh@…, 17 months ago) |
|---|
-
DarwinStreamingSrvr6.0.3-Source
old new 86 86 ;; 87 87 88 88 Linux.i586 | \ 89 Linux.i686) 89 Linux.i686 | \ 90 Linux.x86_64 ) 90 91 echo "Configuring for the "$OSNAME" "$HARDWARENAME" platform" 91 92 CPLUS=gcc 92 93 CCOMP=gcc 93 94 LINKER='gcc' 94 95 MAKE=make 95 96 96 COMPILER_FLAGS="-D_REENTRANT -D__USE_POSIX -D__linux__ -pipe" 97 if [ "$PLAT" = "Linux.x86_64" ]; then 98 COMPILER_FLAGS="-D_REENTRANT -D__USE_POSIX -D__linux__ -pipe -fPIC" 99 else 100 COMPILER_FLAGS="-D_REENTRANT -D__USE_POSIX -D__linux__ -pipe" 101 fi 97 102 INCLUDE_FLAG="-include" 98 103 99 104 CORE_LINK_LIBS="-lpthread -ldl -lstdc++ -lm -lcrypt" -
DarwinStreamingSrvr6.0.3-Source
old new 190 190 191 191 # Add the unprivileged user qtss as the server's run user 192 192 echo "Creating unprivileged user to run the server = \"qtss\"." 193 if [ $INSTALL_OS = "Linux" ]; then 194 /usr/sbin/groupadd qtss > /dev/null 2>&1 193 groupadded="1" 194 if [ -x /usr/sbin/addgroup ]; then 195 addgroup --system qtss > /dev/null 2>&1 196 groupadded=$? 197 fi 198 if [ "$grouptadded" != "0" ]; then 199 /usr/sbin/groupadd -r qtss > /dev/null 2>&1 200 if [ $? != "0" ]; then 201 /usr/sbin/groupadd qtss > /dev/null 2>&1 202 fi 203 fi 204 usradded="1" 205 if [ -x /usr/sbin/adduser ]; then 206 adduser --system --no-create-home --ingroup qtss qtss > /dev/null 2>&1 207 usradded=$? 208 fi 209 if [ "$usradded" != "0" ]; then 195 210 /usr/sbin/useradd -M qtss > /dev/null 2>&1 196 else197 /usr/sbin/groupadd qtss > /dev/null 2>&1198 /usr/sbin/useradd qtss > /dev/null 2>&1211 if [ $? != "0" ]; then 212 /usr/sbin/useradd qtss > /dev/null 2>&1 213 fi 199 214 fi 200 215 201 216 ## INSTALL NEW VERSION ## -
DarwinStreamingSrvr6.0.3-Source
old new 216 216 217 217 struct sigaction act; 218 218 219 #if defined(sun) || defined(i386) || defined(__MacOSX__) || defined(__sgi__) || defined(__osf__) || defined(__hpux__) || defined(__linuxppc__) 219 #if defined(sun) || defined(i386) || defined(__MacOSX__) || defined(__sgi__) || defined(__osf__) || defined(__hpux__) || defined(__linuxppc__) || defined(__linux__) 220 220 sigemptyset(&act.sa_mask); 221 221 act.sa_flags = 0; 222 222 act.sa_handler = (void(*)(int))&SignalEventHandler; -
DarwinStreamingSrvr6.0.3-Source
old new 2082 2082 2083 2083 struct sigaction act; 2084 2084 2085 #if defined(sun) || defined(i386) || defined(__MacOSX__) || defined(__powerpc__) || defined (__sgi_cc__) || defined(__osf__) || defined(__hpux__) 2085 #if defined(sun) || defined(i386) || defined(__MacOSX__) || defined(__powerpc__) || defined (__sgi_cc__) || defined(__osf__) || defined(__hpux__) || defined(__linux__) 2086 2086 sigemptyset(&act.sa_mask); 2087 2087 act.sa_flags = 0; 2088 2088 act.sa_handler = (void(*)(int))&SignalEventHandler; -
DarwinStreamingSrvr6.0.3-Source
old new 216 216 //(void) ::signal(SIGPIPE, SIG_IGN); 217 217 struct sigaction act; 218 218 219 #if defined(sun) || defined(i386) || defined (__MacOSX__) || defined(__powerpc__) || defined (__osf__) || defined (__sgi_cc__) || defined (__hpux__) 219 #if defined(sun) || defined(i386) || defined (__MacOSX__) || defined(__powerpc__) || defined (__osf__) || defined (__sgi_cc__) || defined (__hpux__) || defined (__linux__) 220 220 sigemptyset(&act.sa_mask); 221 221 act.sa_flags = 0; 222 222 act.sa_handler = (void(*)(int))&sigcatcher; -
DarwinStreamingSrvr6.0.3-Source
old new 135 135 #ifndef __Win32__ 136 136 struct sigaction act; 137 137 138 #if defined(sun) || defined(i386) || defined (__MacOSX__) || defined(__powerpc__) || defined (__osf__) || defined (__sgi_cc__) || defined (__hpux__) 138 #if defined(sun) || defined(i386) || defined (__MacOSX__) || defined(__powerpc__) || defined (__osf__) || defined (__sgi_cc__) || defined (__hpux__) || defined (__linux__) 139 139 sigemptyset(&act.sa_mask); 140 140 act.sa_flags = 0; 141 141 act.sa_handler = (void(*)(int))&sigcatcher; -
DarwinStreamingSrvr6.0.
old new 549 549 //if the length of the addr is 0, use the family to determine 550 550 //what the addr size is 551 551 if (ifr->ifr_addr.sa_len == 0) 552 #else553 *inIfReqIter += sizeof(ifr->ifr_name) + 0;554 #endif555 552 { 556 553 switch (ifr->ifr_addr.sa_family) 557 554 { … … 565 562 // return false; 566 563 } 567 564 } 565 #else 566 *inIfReqIter += sizeof(*ifr); 567 #endif 568 568 return true; 569 569 } 570 570 #endif -
DarwinStreamingSrvr6.0.
old new 213 213 static UInt32 sNumShortTaskThreads; 214 214 static UInt32 sNumBlockingTaskThreads; 215 215 216 static OSMutexRW sMutexRW ;216 static OSMutexRW sMutexRW __attribute__((visibility("hidden"))); 217 217 218 218 friend class Task; 219 219 friend class TaskThread; -
DarwinStreamingSrvr6.0.3-Source
old new 135 135 // 136 136 // Grab the server mutex. This is to make sure all gets & set values on this 137 137 // object complete before we start deleting stuff 138 OSMutexLocker serverlocker(this->GetServerObjectMutex());138 OSMutexLocker* serverlocker = new OSMutexLocker(this->GetServerObjectMutex()); 139 139 140 140 // 141 141 // Grab the prefs mutex. This is to make sure we can't reread prefs 142 142 // WHILE shutting down, which would cause some weirdness for QTSS API 143 143 // (some modules could get QTSS_RereadPrefs_Role after QTSS_Shutdown, which would be bad) 144 OSMutexLocker locker(this->GetPrefs()->GetMutex());144 OSMutexLocker* locker = new OSMutexLocker(this->GetPrefs()->GetMutex()); 145 145 146 146 QTSS_ModuleState theModuleState; 147 147 theModuleState.curRole = QTSS_Shutdown_Role; … … 152 152 (void)QTSServerInterface::GetModule(QTSSModule::kShutdownRole, x)->CallDispatch(QTSS_Shutdown_Role, NULL); 153 153 154 154 OSThread::SetMainThreadData(NULL); 155 156 delete fRTPMap; 157 delete fSocketPool; 158 delete fSrvrMessages; 159 delete locker; 160 delete serverlocker; 161 delete fSrvrPrefs; 155 162 } 156 163 157 164 Bool16 QTSServer::Initialize(XMLPrefsParser* inPrefsSource, PrefsSource* inMessagesSource, UInt16 inPortOverride, Bool16 createListeners) -
DarwinStreamingSrvr6.0.3-Source
old new 212 212 } 213 213 214 214 QTSSMessages::QTSSMessages(PrefsSource* inMessages) 215 : QTSSDictionary(QTSSDictionaryMap::GetMap(QTSSDictionaryMap::kTextMessagesDictIndex)) 215 : QTSSDictionary(QTSSDictionaryMap::GetMap(QTSSDictionaryMap::kTextMessagesDictIndex)), 216 numAttrs(GetDictionaryMap()->GetNumAttrs()) 216 217 { 217 218 static const UInt32 kMaxMessageSize = 2048; 218 219 char theMessage[kMaxMessageSize]; 219 220 220 221 // Use the names of the attributes in the attribute map as the key values for 221 222 // finding preferences in the config file. 222 223 for (UInt32 x = 0; x < this->GetDictionaryMap()->GetNumAttrs(); x++) 223 attrBuffer = NEW char* [numAttrs]; 224 ::memset(attrBuffer, 0, sizeof(char*) * numAttrs); 225 for (UInt32 x = 0; x < numAttrs; x++) 224 226 { 225 227 theMessage[0] = '\0'; 226 228 (void)inMessages->GetValue(this->GetDictionaryMap()->GetAttrName(x), &theMessage[0]); … … 248 250 // the new attribute, and copy the data into the newly allocated buffer 249 251 if (theMessage[0] != '\0') 250 252 { 251 char* attrBuffer = NEW char[::strlen(theMessage) + 2]; 252 ::strcpy(attrBuffer, theMessage); 253 this->SetVal(this->GetDictionaryMap()->GetAttrID(x), attrBuffer, ::strlen(attrBuffer)); 253 attrBuffer[x] = NEW char[::strlen(theMessage) + 2]; 254 ::strcpy(attrBuffer[x], theMessage); 255 this->SetVal(this->GetDictionaryMap()->GetAttrID(x), 256 attrBuffer[x], ::strlen(attrBuffer[x])); 254 257 } 255 258 } 256 259 } -
DarwinStreamingSrvr6.0.3-Source
old new 215 215 Bool16 fMyMutex; 216 216 Bool16 fLocked; 217 217 218 void DeleteAttributeData(DictValueElement* inDictValues, UInt32 inNumValues); 218 void DeleteAttributeData(DictValueElement* inDictValues, 219 UInt32 inNumValues, QTSSDictionaryMap* theMap); 219 220 }; 220 221 221 222 … … 271 272 // CONSTRUCTOR / DESTRUCTOR 272 273 273 274 QTSSDictionaryMap(UInt32 inNumReservedAttrs, UInt32 inFlags = kNoFlags); 274 ~QTSSDictionaryMap(){ delete fAttrArray; } 275 ~QTSSDictionaryMap() { 276 for (UInt32 i = 0; i < fAttrArraySize; i++) 277 delete fAttrArray[i]; 278 delete [] fAttrArray; 279 } 275 280 276 281 // 277 282 // QTSS API CALLS -
DarwinStreamingSrvr6.0.3-Source
old new 53 53 static void Initialize(); 54 54 55 55 QTSSMessages(PrefsSource* inMessages); 56 virtual ~QTSSMessages() {} 56 virtual ~QTSSMessages() { 57 for (UInt32 x = 0; x < numAttrs; x++) 58 if (attrBuffer[x] != NULL) 59 delete [] attrBuffer[x]; 60 delete [] attrBuffer; 61 } 57 62 58 63 59 64 //Use the standard GetAttribute method in QTSSDictionary to retrieve messages 60 65 61 66 private: 62 67 char** attrBuffer; 68 UInt32 numAttrs; 69 63 70 enum 64 71 { 65 72 kNumMessages = 74 // 0 based count so it is one more than last message index number -
DarwinStreamingSrvr6.0.3-Source
old new 60 60 QTSSDictionary::~QTSSDictionary() 61 61 { 62 62 if (fMap != NULL) 63 this->DeleteAttributeData(fAttributes, fMap->GetNumAttrs() );63 this->DeleteAttributeData(fAttributes, fMap->GetNumAttrs(), fMap); 64 64 if (fAttributes != NULL) 65 65 delete [] fAttributes; 66 delete fInstanceMap; 67 this->DeleteAttributeData(fInstanceAttrs, fInstanceArraySize); 66 this->DeleteAttributeData(fInstanceAttrs, fInstanceArraySize, fInstanceMap); 68 67 delete [] fInstanceAttrs; 68 delete fInstanceMap; 69 69 if (fMyMutex) 70 70 delete fMutexP; 71 71 } … … 340 340 theAttrs[theMapIndex].fAttributeData.Len = sizeof(char*); 341 341 // store off original string as first value in array 342 342 *(char**)theAttrs[theMapIndex].fAttributeData.Ptr = temp; 343 // question: why isn't theAttrs[theMapIndex].fAllocatedInternally set to true? 343 // question: why isn't theAttrs[theMapIndex].fAllocatedInternally set to true? 344 theAttrs[theMapIndex].fAllocatedInternally = true; 344 345 } 345 346 } 346 347 else … … 407 408 // The offset should be (attrLen * inIndex) and not (inLen * inIndex) 408 409 char** valuePtr = (char**)(theAttrs[theMapIndex].fAttributeData.Ptr + (attrLen * inIndex)); 409 410 if (inIndex < numValues) // we're replacing an existing string 410 delete *valuePtr;411 delete [] *valuePtr; 411 412 *valuePtr = (char*)attributeBufferPtr; 412 413 } 413 414 … … 522 523 { 523 524 // we need to delete the string 524 525 char* str = *(char**)(theAttrs[theMapIndex].fAttributeData.Ptr + (theValueLen * inIndex)); 525 delete str;526 delete [] str; 526 527 } 527 528 528 529 // … … 797 798 return theErr; 798 799 } 799 800 800 void QTSSDictionary::DeleteAttributeData(DictValueElement* inDictValues, UInt32 inNumValues) 801 void QTSSDictionary::DeleteAttributeData(DictValueElement* inDictValues, 802 UInt32 inNumValues, 803 QTSSDictionaryMap* theMap) 801 804 { 802 805 for (UInt32 x = 0; x < inNumValues; x++) 803 806 { 804 if (inDictValues[x].fAllocatedInternally) 807 if (inDictValues[x].fAllocatedInternally) { 808 if ((theMap->GetAttrType(x) == qtssAttrDataTypeCharArray) && 809 (inDictValues[x].fNumAttributes > 1)) { 810 UInt32 z = 0; 811 for (char **y = (char **) (inDictValues[x].fAttributeData.Ptr); 812 z < inDictValues[x].fNumAttributes; z++) 813 delete [] y[z]; 814 } 805 815 delete [] inDictValues[x].fAttributeData.Ptr; 816 } 806 817 } 807 818 } 808 819 -
DarwinStreamingSrvr6.0.3-Source
old new 220 220 return ((tzInfo.Bias / 60) * -1); 221 221 #else 222 222 223 time_t clock ;223 time_t clock = 0; //Make 'clock' initialized for valgrind 224 224 struct tm *tmptr= localtime(&clock); 225 225 if (tmptr == NULL) 226 226 return 0;

