|  | @@ -8924,6 +8924,7 @@ connect_socket(struct mg_context *ctx /* may be NULL */,
 | 
	
		
			
				|  |  |  		struct mg_pollfd pfd[1];
 | 
	
		
			
				|  |  |  		int pollres;
 | 
	
		
			
				|  |  |  		int ms_wait = 10000; /* 10 second timeout */
 | 
	
		
			
				|  |  | +		int nonstop = 0;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  		/* For a non-blocking socket, the connect sequence is:
 | 
	
		
			
				|  |  |  		 * 1) call connect (will not block)
 | 
	
	
		
			
				|  | @@ -8932,7 +8933,7 @@ connect_socket(struct mg_context *ctx /* may be NULL */,
 | 
	
		
			
				|  |  |  		 */
 | 
	
		
			
				|  |  |  		pfd[0].fd = *sock;
 | 
	
		
			
				|  |  |  		pfd[0].events = POLLOUT;
 | 
	
		
			
				|  |  | -		pollres = mg_poll(pfd, 1, (int)(ms_wait), &(ctx->stop_flag));
 | 
	
		
			
				|  |  | +		pollres = mg_poll(pfd, 1, ms_wait, ctx ? &(ctx->stop_flag) : &nonstop);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  		if (pollres != 1) {
 | 
	
		
			
				|  |  |  			/* Not connected */
 |