help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-smalltalk] Re: Exception in the socket code


From: Paolo Bonzini
Subject: Re: [Help-smalltalk] Re: Exception in the socket code
Date: Sat, 26 Mar 2011 11:11:57 +0100
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.7

On 03/26/2011 11:09 AM, Holger Hans Peter Freyther wrote:
On 03/25/2011 10:01 PM, Holger Hans Peter Freyther wrote:

recvfrom(4, 0xb35bf7bc, 1024, 0, 0, 0)  = -1 ECONNRESET (Connection reset by 
peer)



okay, 945cca8737d716e2436aaa064c2c6aed02d34627 of 11th of August 2008
introduced the following to cint.c:get_errno():

if (old == ESHUTDOWN || old == ECONNRESET
     || old == ECONNABORTED || old == ENETRESET)
    return 0;


this explains why the connection refused is working but the connection reset
(due using tcpkill) will fail. The question is how to go forward? So somehow I
want to get a EndOfStream or a FileError.

Yes, your original idea of returning 0 now is correct. checkError will return 0 for you:

diff --git a/kernel/FileDescr.st b/kernel/FileDescr.st
index f424cd2..d2291d1 100644
--- a/kernel/FileDescr.st
+++ b/kernel/FileDescr.st
@@ -797,7 +797,8 @@ do arbitrary processing on the files.'>
                    fileOp: 3
                    with: aCollection
                    with: position + available
-                   with: (position + n - 1 min: aCollection size).
+                   with: (position + n - 1 min: aCollection size)
+                    ifFail: [self checkError].
        count := count + available.
        count = 0 ifTrue: [atEnd := true].
        ^count
@@ -817,7 +818,8 @@ do arbitrary processing on the files.'>
                            fileOp: 2
                            with: aCollection
                            with: cur
-                           with: last.
+                           with: last
+                            ifFail: [self checkError].
                result = 0 ifTrue: [^cur - position].
                cur := cur + result].
        ^cur - position

(untested).

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]