Skip to content

Commit

Permalink
refs #4273 allow dynamic handlers to be removed without waiting for a…
Browse files Browse the repository at this point in the history
…ll connections to terminate
  • Loading branch information
davidnich committed Jul 1, 2021
1 parent 8eb0b1a commit 0cf044a
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 10 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Expand Up @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12)
# NOTE: Qore should always use semantic versioning: https://semver.org/
set(VERSION_MAJOR 1)
set(VERSION_MINOR 0)
set(VERSION_SUB 0)
set(VERSION_SUB 1)
#set(VERSION_PATCH 0)

# support <pkg>_ROOT in find_package
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Expand Up @@ -2,7 +2,7 @@

# AC_PREREQ(2.59)
# NOTE: Qore should always use semantic versioning: https://semver.org/
AC_INIT([qore], [1.0.0],
AC_INIT([qore], [1.0.1],
[David Nichols <david@qore.org>],
[qore])
AM_INIT_AUTOMAKE([no-dist-gzip dist-bzip2 tar-ustar subdir-objects])
Expand Down
2 changes: 2 additions & 0 deletions doxygen/lang/900_release_notes.dox.tmpl
Expand Up @@ -9,6 +9,8 @@

@subsection qore_1_0_1_bug_fixes Bug Fixes in Qore
- <a href="../../modules/HttpServer/html/index.html">HttpServer</a> module
- allow dynamic handlers to be removed without waiting for all connections to terminate
(<a href="https://github.com/qorelanguage/qore/issues/4273">issue 4273</a>)
- allow for full logging of authentication errors if HTTP server debugging is enabled
(<a href="https://github.com/qorelanguage/qore/issues/4217">issue 4217</a>)

Expand Down
15 changes: 10 additions & 5 deletions qlib/HttpServer.qm
Expand Up @@ -117,6 +117,8 @@ log("started listener on %s", lh.desc);
@section http_relnotes HttpServer Module Release Notes

@subsection http1_0_1 HttpServer 1.0.1
- allow dynamic handlers to be removed without waiting for all connections to terminate
(<a href="https://github.com/qorelanguage/qore/issues/4273">issue 4273</a>)
- allow for full logging of authentication errors if HTTP server debugging is enabled
(<a href="https://github.com/qorelanguage/qore/issues/4217">issue 4217</a>)

Expand Down Expand Up @@ -1128,8 +1130,8 @@ http.setListenerLogOptionsID(0, LLO_RECV_HEADERS|LLO_SEND_HEADERS);
#! remove dynamic handler
/** @throw REMOVEHANDLER-ERROR if the given dynamic handler does not exist
*/
removeDynamicHandler(string name) {
dhandlers.removeHandler(name);
removeDynamicHandler(string name, *bool force_immediate) {
dhandlers.removeHandler(name, force_immediate);
}

#! called to log information to the registered log code
Expand Down Expand Up @@ -2815,16 +2817,17 @@ class DynamicHttpHandlerList inherits HttpHandlerList {
#! remove dynamic handler
/** @throw REMOVEHANDLER-ERROR if the given dynamic handler does not exist
*/
removeHandler(string name) {
removeHandler(string name, *bool force_immediate) {
Counter c;
{
# grab exclusive lock
dhl.writeLock();
on_exit dhl.writeUnlock();

# if no such handler exists, throw an exception
if (!handlers{name})
if (!handlers{name}) {
throw "REMOVEHANDLER-ERROR", sprintf("dynamic request handler %y does not exist", name);
}

# remove the handler from the list
DynamicHandlerInfo dhi = remove handlers{name};
Expand All @@ -2844,7 +2847,9 @@ class DynamicHttpHandlerList inherits HttpHandlerList {
}

# wait for the call counter to reach zero
c.waitForZero();
if (!force_immediate) {
c.waitForZero();
}
}

#! Disable dynamic handler
Expand Down
5 changes: 4 additions & 1 deletion qore.spec-fedora
Expand Up @@ -2,7 +2,7 @@
%global user_module_dir %{_datadir}/qore-modules/

Name: qore
Version: 1.0.0
Version: 1.0.1
Release: 1%{?dist}
Summary: Multithreaded Programming Language

Expand Down Expand Up @@ -173,6 +173,9 @@ make check
%{_mandir}/man1/qore.1.*

%changelog
* Thu Jul 1 2021 David Nichols <david@qore.org> 1.0.1-1
- updated version to 1.0.1-1

* Thu Dec 31 2020 David Nichols <david@qore.org> 1.0-1
- updated version to 1.0-1
- updated libqore version to 7.4.0
Expand Down
5 changes: 4 additions & 1 deletion qore.spec-multi
Expand Up @@ -31,7 +31,7 @@

Summary: Multithreaded Programming Language
Name: qore
Version: 1.0.0
Version: 1.0.1
Release: 1%{dist}
%if 0%{?suse_version}
License: LGPL-2.0+ or GPL-2.0+ or MIT
Expand Down Expand Up @@ -276,6 +276,9 @@ rm -rf $RPM_BUILD_ROOT
%endif

%changelog
* Thu Jul 1 2021 David Nichols <david@qore.org> 1.0.1
- updated version to 1.0.1

* Thu Dec 31 2020 David Nichols <david@qore.org> 1.0
- updated version to 1.0
- updated libqore version to 7.4.0
Expand Down
2 changes: 1 addition & 1 deletion qore.spec-opensuse
Expand Up @@ -19,7 +19,7 @@

%define module_dir %{_libdir}/qore-modules
Name: qore
Version: 1.0.0
Version: 1.0.1
Release: 0
Summary: Multithreaded Programming Language
License: LGPL-2.1+ or GPL-2.0+ or MIT
Expand Down

0 comments on commit 0cf044a

Please sign in to comment.