The Trunk: Network-ul.190.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Network-ul.190.mcz

commits-2
Levente Uzonyi uploaded a new version of Network to project The Trunk:
http://source.squeak.org/trunk/Network-ul.190.mcz

==================== Summary ====================

Name: Network-ul.190
Author: ul
Time: 26 March 2017, 10:33:09.693969 pm
UUID: 3e29be46-381f-4b14-9899-4a25585ddf57
Ancestors: Network-cmm.189

Don't try to disconnect from a not connected socket in Socket >> #closeAndDestroy:, because Squeak doesn't support half-closed connections.

=============== Diff against Network-cmm.189 ===============

Item was changed:
  ----- Method: Socket>>closeAndDestroy: (in category 'connection open/close') -----
+ closeAndDestroy: timeoutSeconds
- closeAndDestroy: timeoutSeconds
  "First, try to close this connection gracefully. If the close attempt fails or times out, abort the connection. In either case, destroy the socket. Do nothing if the socket has already been destroyed (i.e., if its socketHandle is nil)."
+
+ socketHandle ifNil: [ ^self ].
+ self isConnected ifTrue: [
+ self close.  "Close this end.".
+ (self waitForDisconnectionFor: timeoutSeconds) ifFalse: [
+ "The other end has not closed the connect yet, so we will just abort it."
+ self primSocketAbortConnection: socketHandle ] ].
- socketHandle ifNil: [ ^ self ].
- self isConnected ifTrue: [ self close ].
- (self waitForDisconnectionFor: timeoutSeconds) ifFalse:
- [ "The other end has not closed the connect yet, so we will just abort it."
- [ self primSocketAbortConnection: socketHandle ]
- on: Error
- do: [ : err | "ignore error if invalid handle" ] ].
  self destroy!


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Network-ul.190.mcz

Chris Muller-3
A better fix, thanks.

On Sun, Mar 26, 2017 at 3:34 PM,  <[hidden email]> wrote:

> Levente Uzonyi uploaded a new version of Network to project The Trunk:
> http://source.squeak.org/trunk/Network-ul.190.mcz
>
> ==================== Summary ====================
>
> Name: Network-ul.190
> Author: ul
> Time: 26 March 2017, 10:33:09.693969 pm
> UUID: 3e29be46-381f-4b14-9899-4a25585ddf57
> Ancestors: Network-cmm.189
>
> Don't try to disconnect from a not connected socket in Socket >> #closeAndDestroy:, because Squeak doesn't support half-closed connections.
>
> =============== Diff against Network-cmm.189 ===============
>
> Item was changed:
>   ----- Method: Socket>>closeAndDestroy: (in category 'connection open/close') -----
> + closeAndDestroy: timeoutSeconds
> - closeAndDestroy: timeoutSeconds
>         "First, try to close this connection gracefully. If the close attempt fails or times out, abort the connection. In either case, destroy the socket. Do nothing if the socket has already been destroyed (i.e., if its socketHandle is nil)."
> +
> +       socketHandle ifNil: [ ^self ].
> +       self isConnected ifTrue: [
> +               self close.  "Close this end.".
> +               (self waitForDisconnectionFor: timeoutSeconds) ifFalse: [
> +                       "The other end has not closed the connect yet, so we will just abort it."
> +                       self primSocketAbortConnection: socketHandle ] ].
> -       socketHandle ifNil: [ ^ self ].
> -       self isConnected ifTrue: [ self close ].
> -       (self waitForDisconnectionFor: timeoutSeconds) ifFalse:
> -               [ "The other end has not closed the connect yet, so we will just abort it."
> -               [ self primSocketAbortConnection: socketHandle ]
> -                       on: Error
> -                       do: [ : err | "ignore error if invalid handle" ] ].
>         self destroy!
>
>