Skip to content

Timeout passed to a ZnClient is ignored while making the connection via the underlying socket #59

@akellens

Description

@akellens

Suppose the following situation:

  • Create a ZnClient
  • Pass in an explicit timeout (e.g., 3 seconds)
  • Pass in a host/port combination that does not exist

Expected behavior: an error should be thrown after 3 seconds.

What happens: the user has to wait for the (default) timeout of GsSocket; the timeout passed in to the client is ignored.

Reason: the SocketStream does not use the timeout while connecting to the socket created via SocketStreamSocket.

In the code this is reflected in the following extension method

SocketStream>>openConnectionToHost: host port: portNumber timeout: timeout
| socket |
socket :=SocketStreamSocket newTCPSocket.
socket connectTo: host port: portNumber.
^(self on: socket) 
    timeout: timeout; 
    yourself

I compared this with the Pharo implementation, and here the timeout is passed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions