Skip to content

Commit

Permalink
Export stopAllServers and update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
wch committed Dec 18, 2017
1 parent 2894f2a commit 01c966e
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 18 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export(service)
export(startDaemonizedServer)
export(startPipeServer)
export(startServer)
export(stopAllServers)
export(stopDaemonizedServer)
export(stopServer)
exportClasses(WebSocket)
Expand Down
21 changes: 15 additions & 6 deletions R/RcppExports.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,30 @@ makePipeServer <- function(name, mask, onHeaders, onBodyData, onRequest, onWSOpe
.Call('_httpuv_makePipeServer', PACKAGE = 'httpuv', name, mask, onHeaders, onBodyData, onRequest, onWSOpen, onWSMessage, onWSClose)
}

#' Stop a running server
#' Stop a server
#'
#' Given a handle that was returned from a previous invocation of
#' \code{\link{startServer}}, closes all open connections for that server and
#' unbinds the port. \strong{Be careful not to call \code{stopServer} more than
#' once on a handle, as this will cause the R process to crash!}
#' \code{\link{startServer}} or \code{\link{startPipeServer}}, this closes all
#' open connections for that server and unbinds the port.
#'
#' @param handle A handle that was previously returned from
#' \code{\link{startServer}}.
#'
#' \code{\link{startServer}} or \code{\link{startPipeServer}}.
#'
#' @seealso \code{\link{stopAllServers}} to stop all servers.
#'
#' @export
stopServer <- function(handle) {
invisible(.Call('_httpuv_stopServer', PACKAGE = 'httpuv', handle))
}

#' Stop all applications
#'
#' This will stop all applications which were created by
#' \code{\link{startServer}} or \code{\link{startPipeServer}}.
#'
#' @seealso \code{\link{stopServer}} to stop a specific server.
#'
#' @export
stopAllServers <- function() {
invisible(.Call('_httpuv_stopAllServers', PACKAGE = 'httpuv'))
}
Expand Down
15 changes: 15 additions & 0 deletions man/stopAllServers.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/stopDaemonizedServer.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions man/stopServer.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 15 additions & 6 deletions src/httpuv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,16 +287,17 @@ void stopServer(uv_stream_t* pServer) {
);
}

//' Stop a running server
//' Stop a server
//'
//' Given a handle that was returned from a previous invocation of
//' \code{\link{startServer}}, closes all open connections for that server and
//' unbinds the port. \strong{Be careful not to call \code{stopServer} more than
//' once on a handle, as this will cause the R process to crash!}
//' \code{\link{startServer}} or \code{\link{startPipeServer}}, this closes all
//' open connections for that server and unbinds the port.
//'
//' @param handle A handle that was previously returned from
//' \code{\link{startServer}}.
//'
//' \code{\link{startServer}} or \code{\link{startPipeServer}}.
//'
//' @seealso \code{\link{stopAllServers}} to stop all servers.
//'
//' @export
// [[Rcpp::export]]
void stopServer(std::string handle) {
Expand All @@ -305,6 +306,14 @@ void stopServer(std::string handle) {
stopServer(pServer);
}

//' Stop all applications
//'
//' This will stop all applications which were created by
//' \code{\link{startServer}} or \code{\link{startPipeServer}}.
//'
//' @seealso \code{\link{stopServer}} to stop a specific server.
//'
//' @export
// [[Rcpp::export]]
void stopAllServers() {
ASSERT_MAIN_THREAD()
Expand Down

0 comments on commit 01c966e

Please sign in to comment.