mirror of
https://github.com/YGGverse/ggemini.git
synced 2026-03-31 09:05:45 +00:00
hold NetworkAddress and SocketConnection as the Connection members
This commit is contained in:
parent
2102d8887a
commit
a12a73d311
2 changed files with 9 additions and 5 deletions
|
|
@ -74,8 +74,8 @@ impl Client {
|
||||||
Ok(socket_connection) => {
|
Ok(socket_connection) => {
|
||||||
match Connection::build(
|
match Connection::build(
|
||||||
socket_connection,
|
socket_connection,
|
||||||
|
network_address,
|
||||||
certificate,
|
certificate,
|
||||||
Some(network_address),
|
|
||||||
is_session_resumption,
|
is_session_resumption,
|
||||||
) {
|
) {
|
||||||
Ok(connection) => connection.request_async(
|
Ok(connection) => connection.request_async(
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,8 @@ use glib::{
|
||||||
};
|
};
|
||||||
|
|
||||||
pub struct Connection {
|
pub struct Connection {
|
||||||
|
pub network_address: NetworkAddress,
|
||||||
|
pub socket_connection: SocketConnection,
|
||||||
pub tls_client_connection: TlsClientConnection,
|
pub tls_client_connection: TlsClientConnection,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -27,24 +29,26 @@ impl Connection {
|
||||||
/// Create new `Self`
|
/// Create new `Self`
|
||||||
pub fn build(
|
pub fn build(
|
||||||
socket_connection: SocketConnection,
|
socket_connection: SocketConnection,
|
||||||
|
network_address: NetworkAddress,
|
||||||
certificate: Option<TlsCertificate>,
|
certificate: Option<TlsCertificate>,
|
||||||
server_identity: Option<NetworkAddress>,
|
|
||||||
is_session_resumption: bool,
|
is_session_resumption: bool,
|
||||||
) -> Result<Self, Error> {
|
) -> Result<Self, Error> {
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
tls_client_connection: match new_tls_client_connection(
|
tls_client_connection: match new_tls_client_connection(
|
||||||
&socket_connection,
|
&socket_connection,
|
||||||
server_identity.as_ref(),
|
Some(&network_address),
|
||||||
is_session_resumption,
|
is_session_resumption,
|
||||||
) {
|
) {
|
||||||
Ok(tls_client_connection) => {
|
Ok(tls_client_connection) => {
|
||||||
if let Some(ref certificate) = certificate {
|
if let Some(ref c) = certificate {
|
||||||
tls_client_connection.set_certificate(certificate);
|
tls_client_connection.set_certificate(c);
|
||||||
}
|
}
|
||||||
tls_client_connection
|
tls_client_connection
|
||||||
}
|
}
|
||||||
Err(e) => return Err(e),
|
Err(e) => return Err(e),
|
||||||
},
|
},
|
||||||
|
network_address,
|
||||||
|
socket_connection,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue