swdunlop / WaspVM

The Wasp Lisp Virtual Machine, Associated Libraries, and MOSREF
http://sites.google.com/site/waspvm/
103 stars 17 forks source link

Buffer input timeouts #2

Closed doublec closed 13 years ago

doublec commented 13 years ago

This commit contains a fix to 'buffer-input' so that it returns the symbol 'timeout if a timeout occurs. Current behaviour in MSOREF seems to require this. I modelled the fix after the way 'close is handled.

Connections made to a MOSREF console that do not send the preamble and just wait never time out. This commit fixes that. A smaller test case that shows the problem:

(import "lib/buffer-input")  
(import "lib/tcp-server")
(define out (current-output))
(define (handler)
   (define read (buffer-input (current-input) 5000))
   (define a (read 10))
   (send (format a) out)
   (send 'close (current-output)))

Without this fix, the above will not timeout and is instead stuck in the 'read' call when something connects to it.

I haven't included the buffer-input.mo file in the patch. I left it out since it might cause merge issues if you're merging into another repository with a newer .mo file. What's the best way of dealing with this? Should I include regenerated .mo's?

swdunlop commented 13 years ago

Generally, .mo files should be regenerated and included in case they are a dependency of the compiler; this ensures a new installation can bootstrap itself. The patch looks good; I'll merge it later today when I can review further.. Thanks!

swdunlop commented 13 years ago

Pulled and merged; thanks, Chris.