2ZDRU4SSJJ4LJVQRQUZMD662TPJQTHQKDPZFMERPKTLNCHHDIUTQC
UE57VD2GPQABW63QNOJCUWNMPL54F5MC3IXXTZXVCRASKHHJACKAC
P23SSG5CZVB3MJHYF2PRV2JCFWRFZDAQOOYUJKOPY5V2RF3R63LQC
SO2VFZUJI2CLGDHNDLJIEPCQKFDP4TOH6WREPVJYPEVJ66EITDMQC
AGPU6SD7V5FQNI6W54HDRJQCVHWYCZIHDHL6IL5LVVMJ7SVJL7UAC
SMM42WXFAYFMOMUR7DCVCZCK7QMXIE5KUH4GUOIZPVFDDYB4ZMZAC
7VYQARQVDMISCO5566F55TG5FIDSOO3JQEIKVOUKEFEU4X5HZNEAC
H36WAZXM2LZAJGYPRRMJUUQTER6RUOV4YXJDFXBZOHG73UPA7M5AC
LSQ7OPL7Z5WJDO7ZZS3D4UPMEEWUUF2LNQ3FZUWWFUVZEXA7CIOAC
Q5YCA2QNTHQ236GPBNSWIE7U5YAIGSOD4Z5S2EP547WHTDNVR66QC
6WLPW4L4PN6ANYYW3I6AOCN3SXQP37RQTUOM52IVXL3SRZD7UHAAC
AYQYCR7JKWTAZASLQTY5DPVI6A5MN6X4XMPC3GBS5KJRH3EGRPIQC
YYUB6HZYSVQSCO7DGF6ETPAXTMG6SG2RQQXLP73NKPLDMZEC3PGAC
F3IDYEIHR2FA7SCE2MYVQSUQ5SOPGJ5IKBTS2V3HLM52SWGQ322AC
M2FGQSGQITI7FYU3RWY3IGIA4ZLS6JAZMHIO64WNHKS4JIL53OWQC
OQUFLYFABSJIESLURHVVQLIGCKRT2T66IMEAVSIKT3PPTEN22PAAC
RPECDMZ4O7MMU32H6Z7EW75GRVEQ6IJYNPWSV54HUPTCX5H7I26QC
Ok(file) => match serde_json::from_reader(file) {
Ok(screens) => Some(screens),
Err(err) => {
warn!("Failed to parse screens.json: {}", err);
None
},
},
Ok(file) => serde_json::from_reader(file).map_err(|err| {
warn!("Failed to parse screens.json: {}", err);
}).ok(),
match self.state {
State::Connected => match self.cluster.process_host_event(&self.host, event) {
Some(event) => match event {
// Global events
NetEvent::Focus(_) => {
match self.net.send_to_all(&event) {
Err(e) => {
error!("Failed to send event to cluster: {}", e);
self.state = State::Waiting;
}
_ => (),
};
},
// Focused events
event => {
let addr = self.cluster.focused_screen().default_route();
match self.net.send_to(&event, addr) {
Err(e) => error!("Failed to send event to {}: {}", addr, e),
_ => (),
};
},
if self.state != State::Connected { return }
if let Some(event) = self.cluster.process_host_event(&self.host, event) {
match event {
// Global events
NetEvent::Focus(_) => {
if let Err(err) = self.net.send_to_all(&event) {
error!("Failed to send event to cluster: {}", err);
self.state = State::Waiting;
}
match self.net.send_to(&NetEvent::Cluster(self.cluster.clone()), addr) {
Err(err) => error!("Failed to passively connect: {}", err),
_ => (),
};
if let Err(err) = self.net.send_to(&NetEvent::Cluster(self.cluster.clone()), addr) {
error!("Failed to passively connect: {}", err);
}
match self.net.send_to_all(&NetEvent::Connect(self.cluster.clone())) {
Err(err) => error!("Failed to connect: {}", err),
_ => (),
};
if let Err(err) = self.net.send_to_all(&NetEvent::Connect(self.cluster.clone())) {
error!("Failed to connect: {}", err);
}
Ok(Some((event, addr)))
},
Ok(None) => Ok(None),
Err(err) => Err(err),
}
(event, addr)
})
})
match gethostname(&mut buf) {
Ok(_) => {
let len = unsafe { strlen(mem::transmute(&buf as *const u8)) };
Ok(String::from_utf8_lossy(&buf[..len]).into_owned())
},
Err(err) => Err(err),
}
gethostname(&mut buf).map(|_| {
let len = unsafe { strlen(mem::transmute(&buf as *const u8)) };
String::from_utf8_lossy(&buf[..len]).into_owned()
})