Robustified Socket::Connection, added debugging data for copies/assigns and Socket::Connetion::open() calls for proper socket re-use.
This commit is contained in:
		
							parent
							
								
									8fe1dbb618
								
							
						
					
					
						commit
						66890c4564
					
				
					 16 changed files with 141 additions and 44 deletions
				
			
		|  | @ -41,8 +41,7 @@ namespace Mist { | |||
|       std::string host = getConnectedHost(); | ||||
|       dup2(myConn.getSocket(), STDIN_FILENO); | ||||
|       dup2(myConn.getSocket(), STDOUT_FILENO); | ||||
|       myConn.drop(); | ||||
|       myConn = Socket::Connection(STDOUT_FILENO, STDIN_FILENO); | ||||
|       myConn.open(STDOUT_FILENO, STDIN_FILENO); | ||||
|       myConn.setHost(host); | ||||
|     } | ||||
|     if (config->getString("nostreamtext").size()){ | ||||
|  |  | |||
|  | @ -33,7 +33,7 @@ namespace Mist{ | |||
| 
 | ||||
|         int fin = -1; | ||||
|         Util::Procs::StartPiped(args, &fin, 0, 0); | ||||
|         myConn = Socket::Connection(fin, -1); | ||||
|         myConn.open(fin, -1); | ||||
| 
 | ||||
|         wantRequest = false; | ||||
|         parseData = true; | ||||
|  |  | |||
|  | @ -143,7 +143,7 @@ void pushFirstElement(std::string qId) { | |||
|   proxyToPost(srcConn, srcLocation, dstConn, dstLocation); | ||||
|    | ||||
|    | ||||
|   srcConn = Socket::Connection(srcHost, srcPort, true); | ||||
|   srcConn.open(srcHost, srcPort, true); | ||||
| 
 | ||||
|   //Set the location to push to for the index containing this segment.
 | ||||
|   //The index will contain (at most) the last PUSH_INDEX_SIZE segments.
 | ||||
|  | @ -156,7 +156,7 @@ void pushFirstElement(std::string qId) { | |||
|   proxyToPost(srcConn, srcLocation, dstConn, dstLocation); | ||||
| 
 | ||||
| 
 | ||||
|   srcConn = Socket::Connection(srcHost, srcPort, true); | ||||
|   srcConn.open(srcHost, srcPort, true); | ||||
| 
 | ||||
|   //Set the location to push to for the global index containing all qualities.
 | ||||
|   srcLocation = baseURL + "/push/index.m3u8"; | ||||
|  | @ -255,7 +255,7 @@ namespace Mist { | |||
|     } | ||||
|     //Reconnect when disconnected
 | ||||
|     if (!listConn.connected()){ | ||||
|       listConn = Socket::Connection(srcHost, srcPort, true); | ||||
|       listConn.open(srcHost, srcPort, true); | ||||
|     } | ||||
|     //Request the push list
 | ||||
|     if (listConn.connected()){ | ||||
|  |  | |||
|  | @ -43,9 +43,9 @@ namespace Mist{ | |||
|       } | ||||
|       initialize(); | ||||
|       INFO_MSG("About to push stream %s out. Host: %s, port: %d, app: %s, stream: %s", streamName.c_str(), pushUrl.host.c_str(), pushUrl.getPort(), app.c_str(), streamOut.c_str()); | ||||
|       if (pushUrl.protocol == "rtmp"){myConn = Socket::Connection(pushUrl.host, pushUrl.getPort(), false);} | ||||
|       if (pushUrl.protocol == "rtmp"){myConn.open(pushUrl.host, pushUrl.getPort(), false);} | ||||
| #ifdef SSL | ||||
|       if (pushUrl.protocol == "rtmps"){myConn = Socket::Connection(pushUrl.host, pushUrl.getPort(), false, true);} | ||||
|       if (pushUrl.protocol == "rtmps"){myConn.open(pushUrl.host, pushUrl.getPort(), false, true);} | ||||
| #endif | ||||
|       if (!myConn){ | ||||
|         FAIL_MSG("Could not connect to %s:%d!", pushUrl.host.c_str(), pushUrl.getPort()); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Thulinma
						Thulinma