Compare commits

...

15 Commits

Author SHA1 Message Date
spiral d24df5a1ea Merge branch 'feat/max_concurrency' into 'master'
gateway: add max_concurrency support

See merge request litecord/litecord!82
2022-01-27 04:39:47 +00:00
Luna ddd2469066 gateway: send zlib flush in the same websocket message
see #139
2022-01-26 21:54:32 -03:00
Luna c85f0806c7 test_websocket: add test for zlib stream 2022-01-25 23:47:33 -03:00
Luna f792769656 gateway: don't set FIN bit on zlib-stream chunks
close #139
2022-01-25 23:46:53 -03:00
Luna d77a84be97 handle bot gateway connections
close #134
2021-11-01 22:15:48 -03:00
Luna b0096f119a add hacky patch for python 3.10 2021-11-01 21:48:14 -03:00
NotNite b6b07073bc
Add user_settings_version to identify 2021-11-01 19:42:29 -04:00
Luna 3cfbbeecc7 add message reaction tests 2021-10-21 21:47:27 -03:00
Luna 55d8e3fe50 bump quart to git commit 2021-10-21 21:46:29 -03:00
Luna 8bdfdfa4ec enable raw tls on websocket 2021-10-09 12:59:48 -03:00
NotNite 2ba7a09796
gateway.schemas: add v identify field for eris 2021-09-24 21:54:17 -04:00
NotNite 2f33bb32a4
gateway.schemas: add missing guild_subscriptions 2021-09-24 21:53:55 -04:00
NotNite 2df5a93a9b
schemas: make allowed_mentions fields optional 2021-09-24 21:53:13 -04:00
luna 1b53cb404e Merge branch 'update-license-headers' into 'master'
Update license headers

See merge request litecord/litecord!83
2021-09-24 17:41:26 +00:00
Cynthia Foxwell f162f0ab60 Update license headers 2021-09-24 11:33:06 -06:00
127 changed files with 343 additions and 204 deletions

View File

@ -632,7 +632,7 @@ state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
Litecord
Copyright (C) 2018 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -651,7 +651,7 @@ Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
litecord Copyright (C) 2018 Luna Mendes
litecord Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -48,6 +48,11 @@ class Config:
# e.g 'gateway.example.com' for reverse proxies.
WEBSOCKET_URL = "localhost:5001"
# Set these to file paths if you want to enable raw TLS support on
# the websocket (without NGINX)
WEBSOCKET_TLS_CERT_PATH = None
WEBSOCKET_TLS_KEY_PATH = None
#: Where to host the websocket?
# (a local address the server will bind to)
WS_HOST = "0.0.0.0"

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -120,8 +120,12 @@ IDENTIFY_SCHEMA = {
"type": "number",
"required": False,
},
"user_settings_version": {"type": "number", "required": False},
},
},
"guild_subscriptions": {"type": "boolean", "required": False},
# this is just to make bot libraries happy
"v": {"type": "number", "required": False},
},
}
},

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -91,7 +91,8 @@ def _complete_users_list(user_id: str, base_ready, user_ready, ws_properties) ->
for recipient in private_channel["recipients"]:
users_to_send[recipient["id"]] = recipient
for relationship in user_ready["relationships"]:
user_relationships = user_ready.get("relationships", [])
for relationship in user_relationships:
relationship_user = relationship["user"]
users_to_send[relationship_user["id"]] = relationship_user
@ -101,7 +102,7 @@ def _complete_users_list(user_id: str, base_ready, user_ready, ws_properties) ->
# relationship object structure changed in v9
if ws_properties.version == 9:
ready["relationships"] = []
for relationship in user_ready["relationships"]:
for relationship in user_relationships:
ready["relationships"].append(
{
"user_id": relationship["user"]["id"],
@ -138,7 +139,9 @@ async def _compute_supplemental(app, base_ready, user_ready, users_to_send: dict
"guilds": [],
}
for relationship in user_ready["relationships"]:
user_relationships = user_ready.get("relationships", [])
for relationship in user_relationships:
if relationship["type"] != RelationshipType.FRIEND.value:
continue
@ -265,16 +268,13 @@ class GatewayWebsocket:
"""Split data in chunk_size-big chunks and send them
over the websocket."""
log.debug(
"zlib-stream: chunking {} bytes into {}-byte chunks", len(data), chunk_size
"zlib-stream: sending {} bytes into {}-byte chunks", len(data), chunk_size
)
total_chunks = 0
for chunk in yield_chunks(data, chunk_size):
total_chunks += 1
log.debug("zlib-stream: chunk {}", total_chunks)
await self.ws.send(chunk)
log.debug("zlib-stream: sent {} chunks", total_chunks)
# we send the entire iterator as per websockets documentation
# to pretent setting FIN when we don't want to
# see https://gitlab.com/litecord/litecord/-/issues/139
await self.ws.send(yield_chunks(data, chunk_size))
async def _zlib_stream_send(self, encoded):
"""Sending a single payload across multiple compressed
@ -283,39 +283,19 @@ class GatewayWebsocket:
# compress and flush (for the rest of compressed data + ZLIB_SUFFIX)
data1 = self.ws_properties.zctx.compress(encoded)
data2 = self.ws_properties.zctx.flush(zlib.Z_FULL_FLUSH)
data = data1 + data2
log.debug(
"zlib-stream: length {} -> compressed ({} + {})",
"zlib-stream: length {} -> compressed ({})",
len(encoded),
len(data1),
len(data2),
len(data),
)
if not data1:
# if data1 is nothing, that might cause problems
# to clients, since they'll receive an empty message
data1 = bytes([data2[0]])
data2 = data2[1:]
log.debug(
"zlib-stream: len(data1) == 0, remaking as ({} + {})",
len(data1),
len(data2),
)
# NOTE: the old approach was ws.send(data1 + data2).
# I changed this to a chunked send of data1 and data2
# because that can bring some problems to the network
# since we can be potentially sending a really big packet
# as a single message.
# clients should handle chunked sends (via detection
# of the ZLIB_SUFFIX suffix appended to data2), so
# this shouldn't being problems.
# since we always chunk the entire compressed message, we shouldn't
# worry about sending big frames to the clients
# TODO: the chunks are 1024 bytes, 1KB, is this good enough?
await self._chunked_send(data1, 1024)
await self._chunked_send(data2, 1024)
await self._chunked_send(data, 1024)
async def _zstd_stream_send(self, encoded):
compressor = self.ws_properties.zsctx.stream_writer(

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -450,8 +450,8 @@ MESSAGE_CREATE = {
"required": False,
"nullable": True,
"schema": {
"parse": {"type": "list", "required": True},
"replied_user": {"type": "boolean", "required": True},
"parse": {"type": "list", "required": False},
"replied_user": {"type": "boolean", "required": False},
},
},
}

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
Copyright (C) 2018-2021 Luna Mendes and Litecord Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

Some files were not shown because too many files have changed in this diff Show More