Christophe
Weblog
Wiki
Code
Publications
Music
projects
/
swankr.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
log and fix bug #20: infinite errors on disconnect.
[swankr.git]
/
swank.R
diff --git
a/swank.R
b/swank.R
index dea28cf99f2f72cec6ccadc13d1266b88b571c78..20311847afef86a62468a50c58b0f1962cc7dc9b 100644
(file)
--- a/
swank.R
+++ b/
swank.R
@@
-33,9
+33,10
@@
acceptConnections <- function(port, portFile) {
cat(port, file=f)
close(f)
}
cat(port, file=f)
close(f)
}
+ ## FIXME: maybe we should support dontClose here?
s <- socketConnection(host="localhost", server=TRUE, port=port, open="r+b")
on.exit(close(s))
s <- socketConnection(host="localhost", server=TRUE, port=port, open="r+b")
on.exit(close(s))
-
serve(s
)
+
tryCatch(serve(s), endOfFile=function(c) NULL
)
}
serve <- function(io) {
}
serve <- function(io) {
@@
-145,6
+146,11
@@
readPacket <- function(io) {
readChunk <- function(io, len) {
buffer <- readChar(io, len)
readChunk <- function(io, len) {
buffer <- readChar(io, len)
+ if(length(buffer) == 0) {
+ condition <- simpleCondition("End of file on io")
+ class(condition) <- c("endOfFile", class(condition))
+ signalCondition(condition)
+ }
if(nchar(buffer) != len) {
stop("short read in readChunk")
}
if(nchar(buffer) != len) {
stop("short read in readChunk")
}