disconnect politely if there are no active assignments

svn: r1076
This commit is contained in:
Eli Barzilay 2005-10-13 22:12:22 +00:00
parent 988dfce4ae
commit c47b962567
2 changed files with 6 additions and 0 deletions

View File

@ -238,6 +238,7 @@
(let* ([h (connect)]
[l (retrieve-active-assignments h)])
(when (null? l)
(handin-disconnect h)
(error 'handin "there are no active assignments"))
(set! connection h)
(for-each (lambda (assign) (send assignment append assign))

View File

@ -2,6 +2,7 @@
(require (lib "mzssl.ss" "openssl"))
(provide handin-connect
handin-disconnect
retrieve-extra-fields
retrieve-active-assignments
submit-assignment
@ -42,6 +43,10 @@
;; Return connection:
(make-handin r w))))
(define (handin-disconnect h)
(write+flush (handin-w h) 'bye)
(close-handin-ports h))
(define (retrieve-extra-fields h)
(let ([r (handin-r h)] [w (handin-w h)])
(write+flush w 'get-extra-fields 'bye)