Merge branch 'master' into create_ubuntu20_package
This commit is contained in:
@@ -423,7 +423,7 @@ extern settings_t settings;
|
||||
|
||||
WebsocketListener::WebsocketListener(const struct sockaddr *listenaddr,
|
||||
socklen_t listenaddrlen,
|
||||
bool sslonly, const char *cert,
|
||||
bool sslonly, const char *cert, const char *certkey,
|
||||
const char *basicauth,
|
||||
const char *httpdir)
|
||||
{
|
||||
@@ -496,7 +496,7 @@ WebsocketListener::WebsocketListener(const struct sockaddr *listenaddr,
|
||||
|
||||
settings.basicauth = basicauth;
|
||||
settings.cert = cert;
|
||||
settings.key = "";
|
||||
settings.key = certkey;
|
||||
settings.ssl_only = sslonly;
|
||||
settings.verbose = vlog.getLevel() >= vlog.LEVEL_DEBUG;
|
||||
settings.httpdir = NULL;
|
||||
@@ -673,7 +673,7 @@ void network::createTcpListeners(std::list<SocketListener*> *listeners,
|
||||
|
||||
void network::createWebsocketListeners(std::list<SocketListener*> *listeners,
|
||||
const struct addrinfo *ai,
|
||||
bool sslonly, const char *cert,
|
||||
bool sslonly, const char *cert, const char *certkey,
|
||||
const char *basicauth,
|
||||
const char *httpdir)
|
||||
{
|
||||
@@ -701,7 +701,7 @@ void network::createWebsocketListeners(std::list<SocketListener*> *listeners,
|
||||
try {
|
||||
new_listeners.push_back(new WebsocketListener(current->ai_addr,
|
||||
current->ai_addrlen,
|
||||
sslonly, cert, basicauth,
|
||||
sslonly, cert, certkey, basicauth,
|
||||
httpdir));
|
||||
} catch (SocketException& e) {
|
||||
// Ignore this if it is due to lack of address family support on
|
||||
@@ -729,6 +729,7 @@ void network::createWebsocketListeners(std::list<SocketListener*> *listeners,
|
||||
const char *addr,
|
||||
bool sslonly,
|
||||
const char *cert,
|
||||
const char *certkey,
|
||||
const char *basicauth,
|
||||
const char *httpdir)
|
||||
{
|
||||
@@ -757,7 +758,7 @@ void network::createWebsocketListeners(std::list<SocketListener*> *listeners,
|
||||
ai[1].ai_addrlen = sizeof(sa[1].u.sin6);
|
||||
ai[1].ai_next = NULL;
|
||||
|
||||
createWebsocketListeners(listeners, ai, sslonly, cert, basicauth, httpdir);
|
||||
createWebsocketListeners(listeners, ai, sslonly, cert, certkey, basicauth, httpdir);
|
||||
} else {
|
||||
struct addrinfo *ai, hints;
|
||||
char service[16];
|
||||
@@ -780,7 +781,7 @@ void network::createWebsocketListeners(std::list<SocketListener*> *listeners,
|
||||
gai_strerror(result));
|
||||
|
||||
try {
|
||||
createWebsocketListeners(listeners, ai, sslonly, cert, basicauth, httpdir);
|
||||
createWebsocketListeners(listeners, ai, sslonly, cert, certkey, basicauth, httpdir);
|
||||
} catch(...) {
|
||||
freeaddrinfo(ai);
|
||||
throw;
|
||||
|
||||
@@ -90,7 +90,8 @@ namespace network {
|
||||
class WebsocketListener : public SocketListener {
|
||||
public:
|
||||
WebsocketListener(const struct sockaddr *listenaddr, socklen_t listenaddrlen,
|
||||
bool sslonly, const char *cert, const char *basicauth,
|
||||
bool sslonly, const char *cert, const char *certkey,
|
||||
const char *basicauth,
|
||||
const char *httpdir);
|
||||
|
||||
virtual int getMyPort();
|
||||
@@ -110,6 +111,7 @@ namespace network {
|
||||
const char *addr,
|
||||
bool sslonly,
|
||||
const char *cert,
|
||||
const char *certkey,
|
||||
const char *basicauth,
|
||||
const char *httpdir);
|
||||
void createTcpListeners(std::list<SocketListener*> *listeners,
|
||||
@@ -121,6 +123,7 @@ namespace network {
|
||||
const struct addrinfo *ai,
|
||||
bool sslonly,
|
||||
const char *cert,
|
||||
const char *certkey,
|
||||
const char *basicauth,
|
||||
const char *httpdir);
|
||||
|
||||
|
||||
@@ -1181,38 +1181,13 @@ uint8_t EncodeManager::getEncoderType(const Rect& rect, const PixelBuffer *pb,
|
||||
const PixelBuffer *scaledpb, const Rect& scaledrect) const
|
||||
{
|
||||
struct RectInfo info;
|
||||
unsigned int divisor, maxColours;
|
||||
unsigned int maxColours = 256;
|
||||
PixelBuffer *ppb;
|
||||
Encoder *encoder;
|
||||
|
||||
bool useRLE;
|
||||
EncoderType type;
|
||||
|
||||
// FIXME: This is roughly the algorithm previously used by the Tight
|
||||
// encoder. It seems a bit backwards though, that higher
|
||||
// compression setting means spending less effort in building
|
||||
// a palette. It might be that they figured the increase in
|
||||
// zlib setting compensated for the loss.
|
||||
if (conn->cp.compressLevel == -1)
|
||||
divisor = 2 * 8;
|
||||
else
|
||||
divisor = conn->cp.compressLevel * 8;
|
||||
if (divisor < 4)
|
||||
divisor = 4;
|
||||
|
||||
maxColours = rect.area()/divisor;
|
||||
|
||||
// Special exception inherited from the Tight encoder
|
||||
if (activeEncoders[encoderFullColour] == encoderTightJPEG) {
|
||||
if ((conn->cp.compressLevel != -1) && (conn->cp.compressLevel < 2))
|
||||
maxColours = 24;
|
||||
else
|
||||
maxColours = 96;
|
||||
}
|
||||
|
||||
if (maxColours < 2)
|
||||
maxColours = 2;
|
||||
|
||||
encoder = encoders[activeEncoders[encoderIndexedRLE]];
|
||||
if (maxColours > encoder->maxPaletteSize)
|
||||
maxColours = encoder->maxPaletteSize;
|
||||
|
||||
Reference in New Issue
Block a user