Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
polling & connection timeouts
Browse files Browse the repository at this point in the history
  • Loading branch information
NikVolf committed Aug 10, 2016
1 parent 286b67d commit a511daa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
6 changes: 2 additions & 4 deletions ipc/nano/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ use std::sync::*;
use nanomsg::{Socket, Protocol, Error, Endpoint, PollRequest, PollFd, PollInOut};
use std::ops::Deref;

const POLL_TIMEOUT: isize = 100;
const CLIENT_CONNECTION_TIMEOUT: isize = 2500;
const POLL_TIMEOUT: isize = 200;
const CLIENT_CONNECTION_TIMEOUT: isize = 15000;

/// Generic worker to handle service (binded) sockets
pub struct Worker<S: ?Sized> where S: IpcInterface {
Expand Down Expand Up @@ -68,7 +68,6 @@ pub fn init_duplex_client<S>(socket_addr: &str) -> Result<GuardedSocket<S>, Sock
SocketError::DuplexLink
}));

// 2500 ms default timeout
socket.set_receive_timeout(CLIENT_CONNECTION_TIMEOUT).unwrap();

let endpoint = try!(socket.connect(socket_addr).map_err(|e| {
Expand All @@ -91,7 +90,6 @@ pub fn init_client<S>(socket_addr: &str) -> Result<GuardedSocket<S>, SocketError
SocketError::RequestLink
}));

// 2500 ms default timeout
socket.set_receive_timeout(CLIENT_CONNECTION_TIMEOUT).unwrap();

let endpoint = try!(socket.connect(socket_addr).map_err(|e| {
Expand Down
6 changes: 3 additions & 3 deletions parity/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,6 @@ pub struct RunCmd {
}

pub fn execute(cmd: RunCmd) -> Result<(), String> {
// create supervisor
let mut hypervisor = modules::hypervisor();

// increase max number of open files
raise_fd_limit();

Expand Down Expand Up @@ -165,6 +162,9 @@ pub fn execute(cmd: RunCmd) -> Result<(), String> {
net_conf.boot_nodes = spec.nodes.clone();
}

// create supervisor
let mut hypervisor = modules::hypervisor();

// create client service.
let service = try!(ClientService::start(
client_config,
Expand Down

0 comments on commit a511daa

Please sign in to comment.