Switch xCAT server connection to client back toblocking IO for large segments of code depending on blocking io
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@12724 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
		| @@ -1702,20 +1702,23 @@ sub service_connection { | ||||
|     my $request; | ||||
|     my $req=undef; | ||||
|     my $line; | ||||
|     my $flags=fcntl($sock,F_GETFL,0); | ||||
|     $flags |= O_NONBLOCK; #we want sysread to bail on us, select seems to be evil to us still.. | ||||
|     fcntl($sock,F_SETFL,$flags); | ||||
|     my $clientsel = new IO::Select; | ||||
|     $clientsel->add($sock); | ||||
|     while (1) { | ||||
|       $line=""; | ||||
|       unless ($clientsel->can_read(15)) { last; } #don't let an unresponsive client hold us up | ||||
|     	my $flags=fcntl($sock,F_GETFL,0); | ||||
| 	    $flags |= O_NONBLOCK; #we want sysread to bail on us, select seems to be evil to us still.. | ||||
| 	    fcntl($sock,F_SETFL,$flags); | ||||
|       my $bytesread; | ||||
|       do  { $bytesread=sysread($sock,$line,65536,length($line)) } while ($bytesread); | ||||
|       if (length($line)==0) { | ||||
| 	      if (not defined $bytesread and $! == EAGAIN) { next; } # | ||||
| 	      last; | ||||
|       } | ||||
|     	my $flags=fcntl($sock,F_GETFL,0); | ||||
| 	    $flags &= ~O_NONBLOCK; #now we want *print* to be blocking IO | ||||
| 	    fcntl($sock,F_SETFL,$flags); | ||||
|       $request .= $line; | ||||
|       #$req = eval { XMLin($request, ForceArray => [ 'attribute' , 'attributepair' ]) }; | ||||
|       if ($line =~ m/<\/xcatrequest>/) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user