@@ -803,7 +803,7 @@ class ClientTransport(PipeTransport):
803803 @var socket = False
804804 """
805805
806- def __init__ (self , host = 'localhost' , port = PORT ): #OK
806+ def __init__ (self , host = 'localhost' , port = PORT , socktimeout = 30 ): #OK
807807 """Initialize a new instance of ClientTransport.
808808
809809 Responsable for a connection with GraphServ.
@@ -818,6 +818,8 @@ def __init__(self, host='localhost', port=PORT): #OK
818818 self .host = host
819819 #FIXME: PORT removal of self.graphname to php
820820 self .socket = False
821+ # XXXX socktimeout might not be available in the PHP version
822+ self .socktimeout = socktimeout
821823 PipeTransport .__init__ (self )
822824
823825 def connect (self ):
@@ -834,8 +836,8 @@ def connect(self):
834836 """
835837 self .socket = socket .socket (socket .AF_INET , socket .SOCK_STREAM )
836838 try :
839+ if self .socktimeout : self .socket .settimeout (self .socktimeout )
837840 self .socket .connect ((self .host , self .port ))
838- #XXX: configure timeout?
839841 except socket .error as (value , message ):
840842 raise gpProtocolException (
841843 "failed to connect to %s:%s: %s %s" % (self .host , self .port , value , message ) )
0 commit comments