From c47b9625678dc24c005196dc9e8e136817f3ae80 Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Thu, 13 Oct 2005 22:12:22 +0000 Subject: [PATCH] disconnect politely if there are no active assignments svn: r1076 --- collects/handin-client/client-gui.ss | 1 + collects/handin-client/client.ss | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/collects/handin-client/client-gui.ss b/collects/handin-client/client-gui.ss index 07a738d190..2f158bddd1 100644 --- a/collects/handin-client/client-gui.ss +++ b/collects/handin-client/client-gui.ss @@ -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)) diff --git a/collects/handin-client/client.ss b/collects/handin-client/client.ss index a522d90d74..355fbcd2e4 100644 --- a/collects/handin-client/client.ss +++ b/collects/handin-client/client.ss @@ -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)