Browse Source

devicechannel: receive() will catch all IOErrors internally

bboozzoo/device-cache
Maciek Borzecki 10 years ago
parent
commit
435ab1e3ac
1 changed files with 4 additions and 4 deletions
  1. +4
    -4
      src/devicechannel.vala

+ 4
- 4
src/devicechannel.vala View File

@ -145,7 +145,7 @@ class DeviceChannel : Object {
* *
* @return false if channel was closed, true otherwise * @return false if channel was closed, true otherwise
*/ */
public async bool receive() throws Error {
public async bool receive() {
size_t line_len; size_t line_len;
string data = null; string data = null;
// read line up to newline // read line up to newline
@ -154,6 +154,9 @@ class DeviceChannel : Object {
Priority.DEFAULT, Priority.DEFAULT,
null, null,
out line_len); out line_len);
// expecting \n\n
_din.read_byte();
_din.read_byte();
} catch (IOError ie) { } catch (IOError ie) {
debug("I/O error: %s", ie.message); debug("I/O error: %s", ie.message);
} }
@ -164,9 +167,6 @@ class DeviceChannel : Object {
} }
debug("received line: %s", data); debug("received line: %s", data);
// expecting \n\n
_din.read_byte();
_din.read_byte();
Packet pkt = Packet.new_from_data(data); Packet pkt = Packet.new_from_data(data);
if (pkt == null) { if (pkt == null) {


Loading…
Cancel
Save