Skip to content

Commit

Permalink
cleaner dispatcher logic
Browse files Browse the repository at this point in the history
  • Loading branch information
shikokuchuo committed Jan 9, 2025
1 parent 8503d87 commit 64f1edd
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions R/dispatcher.R
Original file line number Diff line number Diff line change
Expand Up @@ -205,17 +205,17 @@ dispatcher <- function(host, url = NULL, n = NULL, ..., tls = NULL, pass = NULL,
next
}
if (value[4L]) {
if (value[4L] > 1L) {
if (value[4L] == 1L) {
send(outq[[id]][["ctx"]], value, mode = 2L, block = TRUE)
send(psock, 0L, mode = 2L, pipe = outq[[id]][["pipe"]], block = TRUE)
if (length(outq[[id]][["dmnid"]]))
events <- c(events, outq[[id]][["dmnid"]])
outq[[id]] <- NULL
} else {
dmnid <- readBin(value, "integer", n = 2L)[2L]
events <- c(events, dmnid)
outq[[id]][["dmnid"]] <- -dmnid
next
}
send(outq[[id]][["ctx"]], value, mode = 2L, block = TRUE)
send(psock, 0L, mode = 2L, pipe = outq[[id]][["pipe"]], block = TRUE)
if (length(outq[[id]][["dmnid"]]))
events <- c(events, outq[[id]][["dmnid"]])
outq[[id]] <- NULL
next
} else {
send(outq[[id]][["ctx"]], value, mode = 2L, block = TRUE)
Expand Down

0 comments on commit 64f1edd

Please sign in to comment.