openssl: fix error handling

The recent thread-safety change wasn't right.
This commit is contained in:
Matthew Flatt 2012-03-01 15:42:13 -07:00
parent 8055d9f5f8
commit fc2eb1c11c
2 changed files with 10 additions and 4 deletions

View File

@ -312,9 +312,9 @@
;; so that this library is thread-safe (at the level of Racket threads)
(atomically
(define v (thunk))
(define e (if (negative? v)
(SSL_get_error ssl v)
0))
(define e (if (positive? v)
0
(SSL_get_error ssl v)))
(define estr
(cond
[(= e SSL_ERROR_SSL)
@ -649,7 +649,7 @@
[else
(set! must-read-len #f)
((mzssl-error mzssl) 'read-bytes
"SSL read failed ~a"
"SSL read failed ~a ~a"
estr)]))))))]
[top-read
(lambda (buffer)

View File

@ -0,0 +1,6 @@
#lang racket/base
(require net/url)
(unless (input-port? (get-pure-port (string->url "https://api.github.com/")))
(error "failed for https://api.github.com/"))