gorealis v2 refactor (#5)
* Changing default timeout for start maintenance. * Upgrading dependencies to gorealis v2 and thrift 0.12.0 * Refactored to update to gorealis v2.
This commit is contained in:
parent
ad4dd9606e
commit
6ab5c9334d
1335 changed files with 137431 additions and 61530 deletions
1
vendor/git.apache.org/thrift.git/lib/d/src/thrift/async/socket.d
generated
vendored
1
vendor/git.apache.org/thrift.git/lib/d/src/thrift/async/socket.d
generated
vendored
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
module thrift.async.socket;
|
||||
|
||||
import core.stdc.errno: ECONNRESET;
|
||||
import core.thread : Fiber;
|
||||
import core.time : dur, Duration;
|
||||
import std.array : empty;
|
||||
|
|
2
vendor/git.apache.org/thrift.git/lib/d/src/thrift/base.d
generated
vendored
2
vendor/git.apache.org/thrift.git/lib/d/src/thrift/base.d
generated
vendored
|
@ -50,7 +50,7 @@ class TCompoundOperationException : TException {
|
|||
/// The Thrift version string, used for informative purposes.
|
||||
// Note: This is currently hardcoded, but will likely be filled in by the build
|
||||
// system in future versions.
|
||||
enum VERSION = "0.10.0";
|
||||
enum VERSION = "0.12.0";
|
||||
|
||||
/**
|
||||
* Functions used for logging inside Thrift.
|
||||
|
|
2
vendor/git.apache.org/thrift.git/lib/d/src/thrift/internal/ssl_bio.d
generated
vendored
2
vendor/git.apache.org/thrift.git/lib/d/src/thrift/internal/ssl_bio.d
generated
vendored
|
@ -73,7 +73,7 @@ private {
|
|||
void setError(Exception e) nothrow {
|
||||
ERR_put_error(ERR_LIB_D_EXCEPTION, ERR_F_D_EXCEPTION, ERR_R_D_EXCEPTION,
|
||||
ERR_FILE_D_EXCEPTION, ERR_LINE_D_EXCEPTION);
|
||||
try { GC.addRoot(cast(void*)e); } catch {}
|
||||
try { GC.addRoot(cast(void*)e); } catch (Throwable) {}
|
||||
ERR_set_error_data(cast(char*)e, ERR_FLAGS_D_EXCEPTION);
|
||||
}
|
||||
|
||||
|
|
32
vendor/git.apache.org/thrift.git/lib/d/src/thrift/server/base.d
generated
vendored
32
vendor/git.apache.org/thrift.git/lib/d/src/thrift/server/base.d
generated
vendored
|
@ -118,6 +118,38 @@ protected:
|
|||
TTransportFactory outputTransportFactory_;
|
||||
TProtocolFactory inputProtocolFactory_;
|
||||
TProtocolFactory outputProtocolFactory_;
|
||||
|
||||
public:
|
||||
|
||||
@property TProcessorFactory processorFactory()
|
||||
{
|
||||
return processorFactory_;
|
||||
}
|
||||
|
||||
@property TServerTransport serverTransport()
|
||||
{
|
||||
return serverTransport_;
|
||||
}
|
||||
|
||||
@property TTransportFactory inputTransportFactory()
|
||||
{
|
||||
return inputTransportFactory_;
|
||||
}
|
||||
|
||||
@property TTransportFactory outputTransportFactory()
|
||||
{
|
||||
return outputTransportFactory_;
|
||||
}
|
||||
|
||||
@property TProtocolFactory inputProtocolFactory()
|
||||
{
|
||||
return inputProtocolFactory_;
|
||||
}
|
||||
|
||||
@property TProtocolFactory outputProtocolFactory()
|
||||
{
|
||||
return outputProtocolFactory_;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
10
vendor/git.apache.org/thrift.git/lib/d/src/thrift/server/nonblocking.d
generated
vendored
10
vendor/git.apache.org/thrift.git/lib/d/src/thrift/server/nonblocking.d
generated
vendored
|
@ -893,14 +893,14 @@ private {
|
|||
callsSinceResize_ = 0;
|
||||
|
||||
factoryInputTransport_ =
|
||||
server_.inputTransportFactory_.getTransport(inputTransport_);
|
||||
server_.inputTransportFactory.getTransport(inputTransport_);
|
||||
factoryOutputTransport_ =
|
||||
server_.outputTransportFactory_.getTransport(outputTransport_);
|
||||
server_.outputTransportFactory.getTransport(outputTransport_);
|
||||
|
||||
inputProtocol_ =
|
||||
server_.inputProtocolFactory_.getProtocol(factoryInputTransport_);
|
||||
server_.inputProtocolFactory.getProtocol(factoryInputTransport_);
|
||||
outputProtocol_ =
|
||||
server_.outputProtocolFactory_.getProtocol(factoryOutputTransport_);
|
||||
server_.outputProtocolFactory.getProtocol(factoryOutputTransport_);
|
||||
|
||||
if (server_.eventHandler) {
|
||||
connectionContext_ =
|
||||
|
@ -908,7 +908,7 @@ private {
|
|||
}
|
||||
|
||||
auto info = TConnectionInfo(inputProtocol_, outputProtocol_, socket_);
|
||||
processor_ = server_.processorFactory_.getProcessor(info);
|
||||
processor_ = server_.processorFactory.getProcessor(info);
|
||||
}
|
||||
|
||||
~this() {
|
||||
|
|
4
vendor/git.apache.org/thrift.git/lib/d/src/thrift/server/simple.d
generated
vendored
4
vendor/git.apache.org/thrift.git/lib/d/src/thrift/server/simple.d
generated
vendored
|
@ -140,7 +140,9 @@ class TSimpleServer : TServer {
|
|||
}
|
||||
}
|
||||
} catch (TTransportException ttx) {
|
||||
logError("Client died: %s", ttx);
|
||||
if (ttx.type() != TTransportException.Type.END_OF_FILE) {
|
||||
logError("Client died unexpectedly: %s", ttx);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logError("Uncaught exception: %s", e);
|
||||
}
|
||||
|
|
4
vendor/git.apache.org/thrift.git/lib/d/src/thrift/server/taskpool.d
generated
vendored
4
vendor/git.apache.org/thrift.git/lib/d/src/thrift/server/taskpool.d
generated
vendored
|
@ -268,7 +268,9 @@ protected:
|
|||
}
|
||||
}
|
||||
} catch (TTransportException ttx) {
|
||||
logError("Client died: %s", ttx);
|
||||
if (ttx.type() != TTransportException.Type.END_OF_FILE) {
|
||||
logError("Client died unexpectedly: %s", ttx);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logError("Uncaught exception: %s", e);
|
||||
}
|
||||
|
|
4
vendor/git.apache.org/thrift.git/lib/d/src/thrift/server/threaded.d
generated
vendored
4
vendor/git.apache.org/thrift.git/lib/d/src/thrift/server/threaded.d
generated
vendored
|
@ -173,7 +173,9 @@ private class WorkerThread : Thread {
|
|||
}
|
||||
}
|
||||
} catch (TTransportException ttx) {
|
||||
logError("Client died: %s", ttx);
|
||||
if (ttx.type() != TTransportException.Type.END_OF_FILE) {
|
||||
logError("Client died unexpectedly: %s", ttx);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logError("Uncaught exception: %s", e);
|
||||
}
|
||||
|
|
24
vendor/git.apache.org/thrift.git/lib/d/src/thrift/server/transport/base.d
generated
vendored
24
vendor/git.apache.org/thrift.git/lib/d/src/thrift/server/transport/base.d
generated
vendored
|
@ -95,16 +95,7 @@ class TServerTransportException : TException {
|
|||
|
||||
///
|
||||
this(Type type, string file = __FILE__, size_t line = __LINE__, Throwable next = null) {
|
||||
string msg = "TTransportException: ";
|
||||
switch (type) {
|
||||
case Type.UNKNOWN: msg ~= "Unknown server transport exception"; break;
|
||||
case Type.NOT_LISTENING: msg ~= "Server transport not listening"; break;
|
||||
case Type.ALREADY_LISTENING: msg ~= "Server transport already listening"; break;
|
||||
case Type.RESOURCE_FAILED: msg ~= "An underlying resource failed"; break;
|
||||
default: msg ~= "(Invalid exception type)"; break;
|
||||
}
|
||||
|
||||
this(msg, type, file, line, next);
|
||||
this(errorMsg(type), type, file, line, next);
|
||||
}
|
||||
|
||||
///
|
||||
|
@ -129,5 +120,18 @@ class TServerTransportException : TException {
|
|||
|
||||
protected:
|
||||
Type type_;
|
||||
|
||||
private:
|
||||
string errorMsg(Type type) {
|
||||
string msg = "TTransportException: ";
|
||||
switch (type) {
|
||||
case Type.UNKNOWN: msg ~= "Unknown server transport exception"; break;
|
||||
case Type.NOT_LISTENING: msg ~= "Server transport not listening"; break;
|
||||
case Type.ALREADY_LISTENING: msg ~= "Server transport already listening"; break;
|
||||
case Type.RESOURCE_FAILED: msg ~= "An underlying resource failed"; break;
|
||||
default: msg ~= "(Invalid exception type)"; break;
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
11
vendor/git.apache.org/thrift.git/lib/d/src/thrift/transport/file.d
generated
vendored
11
vendor/git.apache.org/thrift.git/lib/d/src/thrift/transport/file.d
generated
vendored
|
@ -37,7 +37,8 @@ import std.array : empty;
|
|||
import std.algorithm : min, max;
|
||||
import std.concurrency;
|
||||
import std.conv : to;
|
||||
import std.datetime : AutoStart, dur, Duration, StopWatch;
|
||||
import std.datetime : dur, Duration;
|
||||
import std.datetime.stopwatch : AutoStart, StopWatch;
|
||||
import std.exception;
|
||||
import std.stdio : File;
|
||||
import thrift.base;
|
||||
|
@ -637,7 +638,7 @@ final class TFileWriterTransport : TBaseTransport {
|
|||
override void close() {
|
||||
if (!isOpen) return;
|
||||
|
||||
prioritySend(writerThread_, ShutdownMessage(), thisTid); // FIXME: Should use normal send here.
|
||||
send(writerThread_, ShutdownMessage(), thisTid);
|
||||
receive((ShutdownMessage msg, Tid tid){});
|
||||
isOpen_ = false;
|
||||
}
|
||||
|
@ -1076,15 +1077,15 @@ unittest {
|
|||
|
||||
// If any attempt takes more than 500ms, treat that as a fatal failure to
|
||||
// avoid looping over a potentially very slow operation.
|
||||
enforce(sw.peek().msecs < 1500,
|
||||
text("close() took ", sw.peek().msecs, "ms."));
|
||||
enforce(sw.peek().total!"msecs" < 1500,
|
||||
text("close() took ", sw.peek().total!"msecs", "ms."));
|
||||
|
||||
// Normally, it takes less than 5ms on my dev box.
|
||||
// However, if the box is heavily loaded, some of the test runs can take
|
||||
// longer. Additionally, on a Windows Server 2008 instance running in
|
||||
// a VirtualBox VM, it has been observed that about a quarter of the runs
|
||||
// takes (217 ± 1) ms, for reasons not yet known.
|
||||
if (sw.peek().msecs > 50) {
|
||||
if (sw.peek().total!"msecs" > 50) {
|
||||
++numOver;
|
||||
}
|
||||
|
||||
|
|
2
vendor/git.apache.org/thrift.git/lib/d/src/thrift/transport/http.d
generated
vendored
2
vendor/git.apache.org/thrift.git/lib/d/src/thrift/transport/http.d
generated
vendored
|
@ -330,7 +330,7 @@ protected:
|
|||
"Host: " ~ host_ ~ "\r\n" ~
|
||||
"Content-Type: application/x-thrift\r\n" ~
|
||||
"Content-Length: " ~ to!string(dataLength) ~ "\r\n" ~
|
||||
"Accept: application/x-thrift\r\n"
|
||||
"Accept: application/x-thrift\r\n" ~
|
||||
"User-Agent: Thrift/" ~ VERSION ~ " (D/TClientHttpTransport)\r\n" ~
|
||||
"\r\n";
|
||||
}
|
||||
|
|
7
vendor/git.apache.org/thrift.git/lib/d/src/thrift/transport/socket.d
generated
vendored
7
vendor/git.apache.org/thrift.git/lib/d/src/thrift/transport/socket.d
generated
vendored
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
module thrift.transport.socket;
|
||||
|
||||
import core.stdc.errno: ECONNRESET;
|
||||
import core.thread : Thread;
|
||||
import core.time : dur, Duration;
|
||||
import std.array : empty;
|
||||
|
@ -79,8 +80,8 @@ abstract class TSocketBase : TBaseTransport {
|
|||
version (none) assert(written <= buf.length, text("Implementation wrote " ~
|
||||
"more data than requested to?! (", written, " vs. ", buf.length, ")"));
|
||||
} body {
|
||||
assert(0, "DMD bug? – Why would contracts work for interfaces, but not "
|
||||
"for abstract methods? "
|
||||
assert(0, "DMD bug? – Why would contracts work for interfaces, but not " ~
|
||||
"for abstract methods? " ~
|
||||
"(Error: function […] in and out contracts require function body");
|
||||
}
|
||||
|
||||
|
@ -256,7 +257,7 @@ class TSocket : TSocketBase {
|
|||
new TCompoundOperationException(
|
||||
text(
|
||||
"All addresses tried failed (",
|
||||
joiner(map!q{text(a._0, `: "`, a._1.msg, `"`)}(zip(addrs, errors)), ", "),
|
||||
joiner(map!q{text(a[0], `: "`, a[1].msg, `"`)}(zip(addrs, errors)), ", "),
|
||||
")."
|
||||
),
|
||||
errors
|
||||
|
|
12
vendor/git.apache.org/thrift.git/lib/d/src/thrift/transport/ssl.d
generated
vendored
12
vendor/git.apache.org/thrift.git/lib/d/src/thrift/transport/ssl.d
generated
vendored
|
@ -249,7 +249,13 @@ class TSSLContext {
|
|||
}
|
||||
count_++;
|
||||
|
||||
ctx_ = SSL_CTX_new(TLSv1_method());
|
||||
static if (OPENSSL_VERSION_NUMBER >= 0x1010000f) { // OPENSSL_VERSION_AT_LEAST(1, 1)) {
|
||||
ctx_ = SSL_CTX_new(TLS_method());
|
||||
} else {
|
||||
ctx_ = SSL_CTX_new(SSLv23_method());
|
||||
SSL_CTX_set_options(ctx_, SSL_OP_NO_SSLv2);
|
||||
}
|
||||
SSL_CTX_set_options(ctx_, SSL_OP_NO_SSLv3); // THRIFT-3164
|
||||
enforce(ctx_, getSSLException("SSL_CTX_new"));
|
||||
SSL_CTX_set_mode(ctx_, SSL_MODE_AUTO_RETRY);
|
||||
}
|
||||
|
@ -446,6 +452,7 @@ private:
|
|||
}
|
||||
initialized_ = true;
|
||||
|
||||
static if (OPENSSL_VERSION_NUMBER < 0x1010000f) { // OPENSSL_VERSION_BEFORE(1, 1)) {
|
||||
SSL_library_init();
|
||||
SSL_load_error_strings();
|
||||
|
||||
|
@ -463,12 +470,14 @@ private:
|
|||
CRYPTO_set_dynlock_create_callback(assumeNothrow(&dynlockCreateCallback));
|
||||
CRYPTO_set_dynlock_lock_callback(assumeNothrow(&dynlockLockCallback));
|
||||
CRYPTO_set_dynlock_destroy_callback(assumeNothrow(&dynlockDestroyCallback));
|
||||
}
|
||||
}
|
||||
|
||||
static void cleanupOpenSSL() {
|
||||
if (!initialized_) return;
|
||||
|
||||
initialized_ = false;
|
||||
static if (OPENSSL_VERSION_NUMBER < 0x1010000f) { // OPENSSL_VERSION_BEFORE(1, 1)) {
|
||||
CRYPTO_set_locking_callback(null);
|
||||
CRYPTO_set_dynlock_create_callback(null);
|
||||
CRYPTO_set_dynlock_lock_callback(null);
|
||||
|
@ -476,6 +485,7 @@ private:
|
|||
CRYPTO_cleanup_all_ex_data();
|
||||
ERR_free_strings();
|
||||
ERR_remove_state(0);
|
||||
}
|
||||
}
|
||||
|
||||
static extern(C) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue