CloseOnError added
This commit is contained in:
		
							parent
							
								
									1be85fdb70
								
							
						
					
					
						commit
						a715943447
					
				
					 2 changed files with 3 additions and 3 deletions
				
			
		|  | @ -185,7 +185,7 @@ void DTSC::Stream::endStream() { | ||||||
| /// Blocks until either the stream has metadata available or the sourceSocket errors.
 | /// Blocks until either the stream has metadata available or the sourceSocket errors.
 | ||||||
| /// This function is intended to be run before any commands are sent and thus will not throw away anything important.
 | /// This function is intended to be run before any commands are sent and thus will not throw away anything important.
 | ||||||
| /// It will time out after 3 seconds, disconnecting the sourceSocket.
 | /// It will time out after 3 seconds, disconnecting the sourceSocket.
 | ||||||
| void DTSC::Stream::waitForMeta(Socket::Connection & sourceSocket) { | void DTSC::Stream::waitForMeta(Socket::Connection & sourceSocket, bool closeOnError){ | ||||||
|   bool wasBlocking = sourceSocket.isBlocking(); |   bool wasBlocking = sourceSocket.isBlocking(); | ||||||
|   sourceSocket.setBlocking(false); |   sourceSocket.setBlocking(false); | ||||||
|   //cancel the attempt after 5000 milliseconds
 |   //cancel the attempt after 5000 milliseconds
 | ||||||
|  | @ -210,7 +210,7 @@ void DTSC::Stream::waitForMeta(Socket::Connection & sourceSocket) { | ||||||
|   } |   } | ||||||
|   sourceSocket.setBlocking(wasBlocking); |   sourceSocket.setBlocking(wasBlocking); | ||||||
|   //if the timeout has passed, close the socket
 |   //if the timeout has passed, close the socket
 | ||||||
|   if (Util::getMS() - start >= 3000) { |   if (Util::getMS() - start >= 3000 && closeOnError){ | ||||||
|     sourceSocket.close(); |     sourceSocket.close(); | ||||||
|     //and optionally print a debug message that this happened
 |     //and optionally print a debug message that this happened
 | ||||||
|     DEBUG_MSG(DLVL_DEVEL, "Timing out while waiting for metadata"); |     DEBUG_MSG(DLVL_DEVEL, "Timing out while waiting for metadata"); | ||||||
|  |  | ||||||
|  | @ -425,7 +425,7 @@ namespace DTSC { | ||||||
|       bool isNewest(DTSC::livePos & pos, std::set<int> & allowedTracks); |       bool isNewest(DTSC::livePos & pos, std::set<int> & allowedTracks); | ||||||
|       DTSC::livePos getNext(DTSC::livePos & pos, std::set<int> & allowedTracks); |       DTSC::livePos getNext(DTSC::livePos & pos, std::set<int> & allowedTracks); | ||||||
|       void endStream(); |       void endStream(); | ||||||
|       void waitForMeta(Socket::Connection & sourceSocket); |       void waitForMeta(Socket::Connection & sourceSocket, bool closeOnError = true); | ||||||
|       void waitForPause(Socket::Connection & sourceSocket); |       void waitForPause(Socket::Connection & sourceSocket); | ||||||
|     protected: |     protected: | ||||||
|       void cutOneBuffer(); |       void cutOneBuffer(); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 ozzay
						ozzay