mirror of
https://github.com/YGGverse/ggemini.git
synced 2026-04-02 10:05:36 +00:00
get connection ownership on wrap
This commit is contained in:
parent
e437d35acf
commit
1c50fadfde
2 changed files with 11 additions and 8 deletions
|
|
@ -82,9 +82,9 @@ impl Client {
|
||||||
move |result| match result {
|
move |result| match result {
|
||||||
Ok(connection) => {
|
Ok(connection) => {
|
||||||
match Connection::new_wrap(
|
match Connection::new_wrap(
|
||||||
&connection,
|
connection,
|
||||||
certificate.as_ref(),
|
certificate,
|
||||||
Some(&network_address),
|
Some(network_address),
|
||||||
) {
|
) {
|
||||||
Ok(result) => request_async(
|
Ok(result) => request_async(
|
||||||
result,
|
result,
|
||||||
|
|
|
||||||
|
|
@ -17,9 +17,9 @@ impl Connection {
|
||||||
|
|
||||||
/// Create new `Self`
|
/// Create new `Self`
|
||||||
pub fn new_wrap(
|
pub fn new_wrap(
|
||||||
socket_connection: &SocketConnection,
|
socket_connection: SocketConnection,
|
||||||
certificate: Option<&TlsCertificate>,
|
certificate: Option<TlsCertificate>,
|
||||||
server_identity: Option<&NetworkAddress>,
|
server_identity: Option<NetworkAddress>,
|
||||||
) -> Result<Self, Error> {
|
) -> Result<Self, Error> {
|
||||||
if socket_connection.is_closed() {
|
if socket_connection.is_closed() {
|
||||||
return Err(Error::SocketConnectionClosed);
|
return Err(Error::SocketConnectionClosed);
|
||||||
|
|
@ -29,8 +29,11 @@ impl Connection {
|
||||||
socket_connection: socket_connection.clone(),
|
socket_connection: socket_connection.clone(),
|
||||||
tls_client_connection: match certificate {
|
tls_client_connection: match certificate {
|
||||||
Some(certificate) => {
|
Some(certificate) => {
|
||||||
match new_tls_client_connection(socket_connection, certificate, server_identity)
|
match new_tls_client_connection(
|
||||||
{
|
&socket_connection,
|
||||||
|
&certificate,
|
||||||
|
server_identity.as_ref(),
|
||||||
|
) {
|
||||||
Ok(tls_client_connection) => Some(tls_client_connection),
|
Ok(tls_client_connection) => Some(tls_client_connection),
|
||||||
Err(reason) => return Err(reason),
|
Err(reason) => return Err(reason),
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue