8000 bug fix by amdfxlucas · Pull Request #4 · cbodley/nexus · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

bug fix #4

8000 New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions include/nexus/quic/detail/connection_state.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,11 @@ struct open {
// handshake errors are stored here until they can be delivered on close
error_code ec;

explicit open(lsquic_conn& handle) noexcept : handle(handle) {}
explicit open( incoming_connection&& incoming ) noexcept
: handle( *incoming.handle ),
incoming_streams(std::move(incoming.incoming_streams))
{
}
};

/// the connection is 8000 processing open streams but not initiating or accepting
Expand Down Expand Up @@ -107,11 +111,11 @@ connection_id id(const variant& state, error_code& ec);
udp::endpoint remote_endpoint(const variant& state, error_code& ec);

// connection events
void on_connect(variant& state, lsquic_conn* handle);
void on_connect(variant& state, incoming_connection&& conn);
void on_handshake(variant& state, int status);
void accept(variant& state, accept_operation& op);
void accept_incoming(variant& state, incoming_connection&& incoming);
void on_accept(variant& state, lsquic_conn* handle);
void on_accept(variant& state, incoming_connection&& handle);

bool stream_connect(variant& state, stream_connect_operation& op);
stream_impl* on_stream_connect(variant& state, lsquic_stream* handle,
Expand Down
16 changes: 8 additions & 8 deletions src/connection_state.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ udp::endpoint remote_endpoint(const variant& state, error_code& ec)
return remote;
}

void on_connect(variant& state, lsquic_conn* handle)
void on_connect(variant& state, incoming_connection&& conn)
{
assert(handle);
assert( conn.handle);
assert(std::holds_alternative<closed>(state));
state.emplace<open>(*handle);
state.emplace<open>(std::move(conn));
}

void on_handshake(variant& state, int status)
Expand Down Expand Up @@ -97,16 +97,16 @@ void accept_incoming(variant& state, incoming_connection&& incoming)
{
assert(std::holds_alternative<closed>(state));
assert(incoming.handle);
auto& o = state.emplace<open>(*incoming.handle);
o.incoming_streams = std::move(incoming.incoming_streams);
state.emplace<open>( std::move(incoming) );

}

void on_accept(variant& state, lsquic_conn* handle)
void on_accept(variant& state, incoming_connection&& conn )
{
assert(handle);
assert(conn.handle);
assert(std::holds_alternative<accepting>(state));
std::get_if<accepting>(&state)->op->defer(error_code{}); // success
state.emplace<open>(*handle);
state.emplace<open>(std::move(conn));
}

bool stream_connect(variant& state, stream_connect_operation& op)
Expand Down
4 changes: 2 additions & 2 deletions src/socket.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ void socket_impl::connect(connection_impl& c,

void socket_impl::on_connect(connection_impl& c, lsquic_conn_t* conn)
{
connection_state::on_connect(c.state, conn);
connection_state::on_connect(c.state, incoming_connection{conn,engine.max_streams_per_connection});
open_connections.push_back(c);
}

Expand Down Expand Up @@ -128,7 +128,7 @@ connection_context* socket_impl::on_accept(lsquic_conn_t* conn)
auto& c = accepting_connections.front();
list_transfer(c, accepting_connections, open_connections);

connection_state::on_accept(c.state, conn);
connection_state::on_accept(c.state, incoming_connection{conn,engine.max_streams_per_connection});
return &c;
}

Expand Down
4 changes: 3 additions & 1 deletion src/stream_state.cc
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,9 @@ void on_read_body(variant& state, lsquic_stream* handle)
auto& b = *std::get_if<body>(&state);
error_code ec;
auto bytes = ::lsquic_stream_readv(handle, b.op->iovs, b.op->num_iovs);
if (bytes == -1) {
if(bytes == 0)
{ec = make_error_code(stream_error::eof); }
else if (bytes == -1) {
bytes = 0;
ec.assign(errno, system_category());
}
Expand Down
0