Skip to content

Commit

Permalink
httpCtx -> tctx
Browse files Browse the repository at this point in the history
  • Loading branch information
maddsua committed Feb 12, 2024
1 parent 7207bee commit ea9879f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion core/sse/sse.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace Lambda::SSE {
Network::TCP::Connection& m_conn;

public:
Writer(HTTP::Transport::TransportContext& httpCtx, const HTTP::Request initRequest);
Writer(HTTP::Transport::TransportContext& tctx, const HTTP::Request initRequest);
void push(const EventMessage& event);
bool connected() const noexcept;
void close();
Expand Down
8 changes: 4 additions & 4 deletions core/sse/writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ using namespace Lambda;
using namespace Lambda::Network;
using namespace Lambda::SSE;

Writer::Writer(HTTP::Transport::TransportContext& httpCtx, const HTTP::Request initRequest) : m_conn(httpCtx.tcpconn()) {
Writer::Writer(HTTP::Transport::TransportContext& tctx, const HTTP::Request initRequest) : m_conn(tctx.tcpconn()) {

httpCtx.flags.autocompress = false;
httpCtx.flags.forceContentLength = false;
tctx.flags.autocompress = false;
tctx.flags.forceContentLength = false;

const auto originHeader = initRequest.headers.get("origin");

Expand All @@ -23,7 +23,7 @@ Writer::Writer(HTTP::Transport::TransportContext& httpCtx, const HTTP::Request i
upgradeResponse.headers.set("Access-Control-Allow-Origin", originHeader);
}

httpCtx.respond(upgradeResponse);
tctx.respond(upgradeResponse);
}

void Writer::push(const EventMessage& event) {
Expand Down
10 changes: 5 additions & 5 deletions core/websocket/context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ static const std::string wsMagicString = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
// It works, so fuck that, I'm not even selling this code to anyone. Yet. Remove when you do, the future Daniel.
static const time_t sockRcvTimeout = 100;

WebsocketContext::WebsocketContext(HTTP::Transport::TransportContext& httpCtx, const HTTP::Request initRequest)
: conn(httpCtx.tcpconn()), topts(httpCtx.options()) {
WebsocketContext::WebsocketContext(HTTP::Transport::TransportContext& tctx, const HTTP::Request initRequest)
: conn(tctx.tcpconn()), topts(tctx.options()) {

auto headerUpgrade = Strings::toLowerCase(initRequest.headers.get("Upgrade"));
auto headerWsKey = initRequest.headers.get("Sec-WebSocket-Key");
Expand All @@ -32,7 +32,7 @@ WebsocketContext::WebsocketContext(HTTP::Transport::TransportContext& httpCtx, c
throw std::runtime_error("Websocket initialization aborted: Invalid connection header");
}

if (httpCtx.hasPartialData()) {
if (tctx.hasPartialData()) {
throw std::runtime_error("Websocket initialization aborted: Connection has unprocessed data");
}

Expand All @@ -46,8 +46,8 @@ WebsocketContext::WebsocketContext(HTTP::Transport::TransportContext& httpCtx, c
{ "Sec-WebSocket-Accept", Encoding::toBase64(keyHash) }
});

httpCtx.respond(handshakeReponse);
httpCtx.reset();
tctx.respond(handshakeReponse);
tctx.reset();

this->conn.flags.closeOnTimeout = false;
this->conn.setTimeouts(sockRcvTimeout, Network::SetTimeoutsDirection::Receive);
Expand Down
2 changes: 1 addition & 1 deletion core/websocket/websocket.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ namespace Lambda::Websocket {

public:

WebsocketContext(HTTP::Transport::TransportContext& httpCtx, const HTTP::Request initRequest);
WebsocketContext(HTTP::Transport::TransportContext& tctx, const HTTP::Request initRequest);
~WebsocketContext();

bool awaitMessage();
Expand Down

0 comments on commit ea9879f

Please sign in to comment.