Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
85f8664
Use non-default loop
wch Oct 17, 2017
a36d7a1
Handle I/O on background thread wip
wch Nov 1, 2017
8b36f48
Add guard class
wch Nov 1, 2017
e463f2f
Add threading support for on_message
wch Nov 2, 2017
9215ab1
Fixes for shiny WIP
wch Nov 2, 2017
0a83815
Add debugging code and thread assertions
wch Nov 3, 2017
6f98f3c
websocket fixes wip
wch Nov 3, 2017
d6fbbcb
Debugging fixes
wch Nov 4, 2017
2ad9ea9
Add Callback class
wch Nov 7, 2017
a48909c
Add WriteQueue and free memory after writes
wch Nov 8, 2017
2658465
Close websocket asynchronously
wch Nov 9, 2017
b8d7776
Make fatal_error thread-safe
wch Nov 9, 2017
196f2d6
Add reference counting for HttpRequest
wch Nov 9, 2017
003cb69
More precise check for background thread
wch Nov 9, 2017
589d773
More streamlining with Callback class
wch Nov 9, 2017
442118e
Switch from REprintf to fprintf for thread safety
wch Nov 9, 2017
c7a6d95
Miscellaneous cleanup and comments
wch Nov 9, 2017
2112340
Delete _env in destructor
wch Nov 9, 2017
6fa0177
Copy data for callback
wch Nov 9, 2017
55e9ad8
Simplify callback creation
wch Nov 9, 2017
640216b
Misc fixes
wch Nov 9, 2017
de387a3
Simplify some callbacks
wch Nov 10, 2017
ee19f55
Add PROTECT wrappers
wch Nov 15, 2017
30a4e8f
Don't access raw vector on background thread
wch Nov 16, 2017
b758269
More removal of Rcpp on background thread
wch Nov 16, 2017
7ecda4e
Better way of creating environment
wch Nov 16, 2017
6b08019
Shut down server cleanly
wch Nov 17, 2017
1eecbe3
Add support for running multiple apps
wch Nov 18, 2017
e5988b4
Remove unused code
wch Nov 18, 2017
32f0e26
Remove obsolete stuff
wch Nov 20, 2017
3e00069
Rename WriteQueue to CallbackQueue and don't use global
wch Nov 20, 2017
c0cbf88
Switch to REprintf
wch Nov 21, 2017
f6efa8c
Wrap values before assigning in Environment
wch Dec 1, 2017
f31798a
Delete Environment on main thread
wch Dec 1, 2017
ad25269
Add delete_cb template function
wch Dec 4, 2017
5b3265a
Delete pWebApplication on main thread
wch Dec 4, 2017
e648eea
Throw exception
wch Dec 5, 2017
73e41a9
Add version of delete_cb that checks for background thread
wch Dec 11, 2017
4234548
Handle exceptions in onHeaders() and call()
wch Dec 12, 2017
c21da2e
Fix up service() and update documentation
wch Dec 13, 2017
abd1675
Execute WebApplication::onBodyData on main thread
wch Dec 13, 2017
9b98e8d
Move background thread to Socket class
wch Dec 13, 2017
68295f1
If error happens in onBodyData, send error response immediately
wch Dec 14, 2017
518b2e0
Close websocket connections on error
wch Dec 15, 2017
644b102
Don't use REprintf on background thread
wch Dec 15, 2017
9d8855f
Fix function naming conflict on Windows
wch Dec 15, 2017
2894f2a
Update pipe server to run on background thread
wch Dec 15, 2017
01c966e
Export stopAllServers and update docs
wch Dec 18, 2017
8353644
Reset _response_scheduled for each request
wch Dec 18, 2017
e67c713
Make sure PROTECT is balanced
wch Dec 18, 2017
7578277
Fix startup crashes on Windows
wch Dec 18, 2017
1e771b0
Update to libuv 1.18.0
wch Dec 19, 2017
b698588
Initialize new Environment for each request
wch Dec 19, 2017
0c27df7
Free _pBody after write
wch Dec 19, 2017
96ceced
Do local tasks before scheduling callbacks
wch Dec 19, 2017
7a4c0b5
Protect HttpRequest object while initializing environment
wch Dec 19, 2017
e284bbe
Error on pipelined HTTP requests
wch Dec 20, 2017
200f567
Add debugging flags to Makevars.win
wch Dec 20, 2017
50ebc64
Send websocket close message with code and reason
wch Dec 20, 2017
60bcfe4
Fixes for R CMD check on R-devel
wch Dec 21, 2017
2c8da19
Switch to boost::shared_ptr
wch Dec 21, 2017
b1e4359
Make sure deletions happen on background thread
wch Dec 22, 2017
12d7f3c
Disable thread assertions
wch Dec 22, 2017
2f88a98
Use const for array size
wch Jan 18, 2018
01ab685
Convert Socket* to shared_ptr
wch Dec 25, 2017
9b32611
Convert Environment* to shared_ptr
wch Jan 19, 2018
3baaf62
Convert WebApplication* to shared_ptr
wch Jan 19, 2018
1546a15
Correctly use trycatch in auto deleter functions
wch Jan 22, 2018
44573b5
Simplify Socket shared_ptr code
wch Jan 22, 2018
92ae672
Add deleter for Socket
wch Jan 23, 2018
64cfa73
Convert HttpResponse* to shared_ptr
wch Jan 23, 2018
4455907
Minor cleanups
wch Jan 24, 2018
7350107
Review feedback
wch Jan 24, 2018
6e7d3d1
Add invoke_later() function
wch Jan 25, 2018
e3eee00
Make sure Socket closes properly
wch Jan 25, 2018
23a53f9
Bump version to 1.3.5.9005, and later version dependency
wch Jan 25, 2018
c627a3a
Always catch exceptions in deleter functions
wch Jan 25, 2018
a2516c6
Make flush method private
wch Jan 25, 2018
70369d0
Move deletion to a better location
wch Jan 25, 2018
43181b1
Update README with instructions to enable debugging
wch Jan 25, 2018
f919487
Fix mutex and condvar usage
wch Feb 6, 2018
e676c32
Add Barrier class for thread synchronization
wch Feb 8, 2018
3fd40ec
Don't delete Socket before it's done
wch Feb 16, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
^\.travis\.yml$
^appveyor\.yml$
^src/libuv/.github$
^src/libuv/m4/lt~obsolete.m4$
7 changes: 4 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: httpuv
Type: Package
Title: HTTP and WebSocket Server Library
Version: 1.3.5.9002
Version: 1.3.5.9005
Author: Joe Cheng, Hector Corrada Bravo [ctb], Jeroen Ooms [ctb],
Winston Chang [ctb]
Copyright: RStudio, Inc.; Joyent, Inc.; Nginx Inc.; Igor Sysoev; Niels Provos;
Expand All @@ -22,11 +22,12 @@ Imports:
Rcpp (>= 0.11.0),
utils,
promises,
later
later (>= 0.7.1)
Remotes:
r-lib/later,
rstudio/promises
LinkingTo: Rcpp, BH, later
URL: https://github.com/rstudio/httpuv
SystemRequirements: GNU make
RoxygenNote: 6.0.1
RoxygenNote: 6.0.1.9000
Suggests: testthat
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ export(service)
export(startDaemonizedServer)
export(startPipeServer)
export(startServer)
export(stopAllServers)
export(stopDaemonizedServer)
export(stopServer)
exportClasses(WebSocket)
import(methods)
importFrom(Rcpp,evalCpp)
importFrom(later,run_now)
importFrom(promises,"%...!%")
importFrom(promises,"%...>%")
importFrom(promises,finally)
Expand Down
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
httpuv 1.3.5.9002
httpuv 1.3.5.9004
=================

* Upgraded to libuv 1.15.0. ([#91](https://github.com/rstudio/httpuv/pull/91))
Expand Down
52 changes: 32 additions & 20 deletions R/RcppExports.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ sendWSMessage <- function(conn, binary, message) {
invisible(.Call('_httpuv_sendWSMessage', PACKAGE = 'httpuv', conn, binary, message))
}

closeWS <- function(conn) {
invisible(.Call('_httpuv_closeWS', PACKAGE = 'httpuv', conn))
closeWS <- function(conn, code, reason) {
invisible(.Call('_httpuv_closeWS', PACKAGE = 'httpuv', conn, code, reason))
}

makeTcpServer <- function(host, port, onHeaders, onBodyData, onRequest, onWSOpen, onWSMessage, onWSClose) {
Expand All @@ -17,30 +17,38 @@ makePipeServer <- function(name, mask, onHeaders, onBodyData, onRequest, onWSOpe
.Call('_httpuv_makePipeServer', PACKAGE = 'httpuv', name, mask, onHeaders, onBodyData, onRequest, onWSOpen, onWSMessage, onWSClose)
}

destroyServer <- function(handle) {
invisible(.Call('_httpuv_destroyServer', PACKAGE = 'httpuv', handle))
}

run <- function(timeoutMillis) {
.Call('_httpuv_run', PACKAGE = 'httpuv', timeoutMillis)
#' Stop a server
#'
#' Given a handle that was returned from a previous invocation of
#' \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}} or \code{\link{startPipeServer}}.
#'
#' @seealso \code{\link{stopAllServers}} to stop all servers.
#'
#' @export
stopServer <- function(handle) {
invisible(.Call('_httpuv_stopServer', PACKAGE = 'httpuv', handle))
}

stopLoop <- function() {
invisible(.Call('_httpuv_stopLoop', PACKAGE = 'httpuv'))
#' 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'))
}

base64encode <- function(x) {
.Call('_httpuv_base64encode', PACKAGE = 'httpuv', x)
}

daemonize <- function(handle) {
.Call('_httpuv_daemonize', PACKAGE = 'httpuv', handle)
}

destroyDaemonizedServer <- function(handle) {
invisible(.Call('_httpuv_destroyDaemonizedServer', PACKAGE = 'httpuv', handle))
}

#' URI encoding/decoding
#'
#' Encodes/decodes strings using URI encoding/decoding in the same way that web
Expand Down Expand Up @@ -93,8 +101,8 @@ decodeURIComponent <- function(value) {
.Call('_httpuv_decodeURIComponent', PACKAGE = 'httpuv', value)
}

invokeCppCallback <- function(data, callback_sexp) {
invisible(.Call('_httpuv_invokeCppCallback', PACKAGE = 'httpuv', data, callback_sexp))
invokeCppCallback <- function(data, callback_xptr) {
invisible(.Call('_httpuv_invokeCppCallback', PACKAGE = 'httpuv', data, callback_xptr))
}

#' Apply the value of .Random.seed to R's internal RNG state
Expand All @@ -111,3 +119,7 @@ getRNGState <- function() {
invisible(.Call('_httpuv_getRNGState', PACKAGE = 'httpuv'))
}

wsconn_address <- function(external_ptr) {
.Call('_httpuv_wsconn_address', PACKAGE = 'httpuv', external_ptr)
}

Loading