Skip to content

Commit

Permalink
original client now updated to use the ClientFuture
Browse files Browse the repository at this point in the history
  • Loading branch information
bluejekyll committed Jan 14, 2017
1 parent 5d81644 commit 6e7d78a
Show file tree
Hide file tree
Showing 16 changed files with 289 additions and 868 deletions.
128 changes: 47 additions & 81 deletions Cargo.lock

Large diffs are not rendered by default.

269 changes: 149 additions & 120 deletions client/src/client/client.rs

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions client/src/client/client_connection.rs
Expand Up @@ -15,13 +15,11 @@
//! Trait for client connections

use std::io;
use std::fmt::Debug;

use futures::Future;
use tokio_core::reactor::Core;

use ::client::ClientStreamHandle;
use ::error::*;

/// Trait for client connections
pub trait ClientConnection: Sized {
Expand Down
2 changes: 0 additions & 2 deletions client/src/client/client_future.rs
Expand Up @@ -796,7 +796,6 @@ pub trait ClientHandle: Clone {
///
/// * `record` - The name, class and record_type will be used to match and delete the RecordSet
/// * `zone_origin` - the zone name to update, i.e. SOA name
/// * `signer` - the signer, with private key, to use to sign the request
///
/// The update must go to a zone authority (i.e. the server used in the ClientConnection). If
/// the rrset does not exist and must_exist is false, then the RRSet will be deleted.
Expand Down Expand Up @@ -853,7 +852,6 @@ pub trait ClientHandle: Clone {
/// * `name_of_records` - the name of all the record sets to delete
/// * `zone_origin` - the zone name to update, i.e. SOA name
/// * `dns_class` - the class of the SOA
/// * `signer` - the signer, with private key, to use to sign the request
///
/// The update must go to a zone authority (i.e. the server used in the ClientConnection). This
/// operation attempts to delete all resource record sets the the specified name reguardless of
Expand Down
2 changes: 1 addition & 1 deletion client/src/client/mod.rs
Expand Up @@ -25,7 +25,7 @@ mod retry_client_handle;
mod secure_client_handle;

#[allow(deprecated)]
pub use self::client::Client;
pub use self::client::{Client, SecureSyncClient, SyncClient};
pub use self::client_connection::ClientConnection;
pub use self::client_future::{ClientFuture, BasicClientHandle, ClientHandle, StreamHandle, ClientStreamHandle};
pub use self::memoize_client_handle::MemoizeClientHandle;
Expand Down
4 changes: 1 addition & 3 deletions client/src/tcp/tcp_client_connection.rs
Expand Up @@ -16,11 +16,9 @@

use std::net::SocketAddr;
use std::io;
use std::mem;
use std::fmt;

use futures::Future;
use tokio_core::reactor::{Core, Handle};
use tokio_core::reactor::Core;

use ::error::*;
use ::client::{ClientConnection, ClientStreamHandle};
Expand Down
2 changes: 1 addition & 1 deletion client/src/tcp/tcp_stream.rs
Expand Up @@ -334,7 +334,7 @@ fn tcp_client_stream_test(server_addr: IpAddr) {
// the tests should run within 5 seconds... right?
// TODO: add timeout here, so that test never hangs...
// let timeout = Timeout::new(Duration::from_secs(5), &io_loop.handle());
let (stream, mut sender) = TcpStream::new(server_addr, io_loop.handle());
let (stream, sender) = TcpStream::new(server_addr, io_loop.handle());

let mut stream: TcpStream = io_loop.run(stream).ok().expect("run failed to get stream");

Expand Down
7 changes: 1 addition & 6 deletions client/src/udp/udp_client_connection.rs
Expand Up @@ -15,14 +15,9 @@
//! UDP based DNS client

use std::io;
use std::mem;
use std::net::{SocketAddr, ToSocketAddrs};
use std::fmt;
use std::net::SocketAddr;

use futures::Future;
use futures::stream::Stream;
use rand::Rng;
use rand;
use tokio_core::reactor::Core;

use ::error::*;
Expand Down
2 changes: 1 addition & 1 deletion client/src/udp/udp_stream.rs
Expand Up @@ -261,7 +261,7 @@ fn udp_stream_test(server_addr: std::net::IpAddr) {
};

let socket = std::net::UdpSocket::bind(client_addr).expect("could not create socket"); // some random address...
let (mut stream, mut sender) = UdpStream::with_bound(socket, io_loop.handle());
let (mut stream, sender) = UdpStream::with_bound(socket, io_loop.handle());
//let mut stream: UdpStream = io_loop.run(stream).ok().unwrap();

for _ in 0..send_recv_times {
Expand Down
1 change: 0 additions & 1 deletion server/Cargo.toml
Expand Up @@ -55,7 +55,6 @@ error-chain = "0.1.12"
futures = "^0.1"
lazy_static = "^0.2.1"
log = "^0.3.5"
mio = "^0.5.1"
openssl = "^0.9.5"
rand = "^0.3"
rustc-serialize = "^0.3.18"
Expand Down
3 changes: 0 additions & 3 deletions server/src/lib.rs
Expand Up @@ -30,7 +30,6 @@ extern crate chrono;
#[macro_use] extern crate error_chain;
#[macro_use] extern crate futures;
#[macro_use] extern crate log;
extern crate mio;
extern crate openssl;
extern crate rusqlite;
extern crate rustc_serialize;
Expand All @@ -44,8 +43,6 @@ pub mod config;
pub mod error;
pub mod server;

#[allow(deprecated)]
pub use self::server::Server;
pub use self::server::ServerFuture;

/// this exposes a version function which gives access to the access
Expand Down
3 changes: 0 additions & 3 deletions server/src/server/mod.rs
Expand Up @@ -17,14 +17,11 @@
//! `Server` component for hosting a domain name servers operations.

mod request_stream;
mod server;
mod server_future;
mod timeout_stream;

pub use self::request_stream::Request;
pub use self::request_stream::RequestStream;
pub use self::request_stream::ResponseHandle;
#[allow(deprecated)]
pub use self::server::Server;
pub use self::server_future::ServerFuture;
pub use self::timeout_stream::TimeoutStream;

0 comments on commit 6e7d78a

Please sign in to comment.