Skip to content

Commit

Permalink
Merge pull request #63 from adferguson/of10_send_fix2
Browse files Browse the repository at this point in the history
exception handling handling for OpenFlow 1.0 (take 2)
  • Loading branch information
seliopou committed Jan 7, 2014
2 parents e0cbd2a + 962360c commit 5f954f4
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lwt/OpenFlow0x01_Switch.ml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,13 @@ let rec recv_from_switch_fd (sock : file_descr) : (xid * msg) option Lwt.t =
let send_to_switch_fd (sock : file_descr) (xid : xid) (msg : msg) : bool Lwt.t =
lwt msg_buf = Lwt.wrap2 Message.marshal xid msg in
let msg_len = String.length msg_buf in
lwt sent = Lwt_unix.write sock msg_buf 0 msg_len in
Lwt.return (sent = msg_len)
try_lwt
lwt sent = Lwt_unix.write sock msg_buf 0 msg_len in
Lwt.return (sent = msg_len)
with Unix.Unix_error (err, fn, arg) ->
Printf.printf "[platform0x01] error sending: %s (in %s)\n%!"
(Unix.error_message err) fn;
Lwt.return (false)

let switch_handshake_finish (fd : file_descr) : OF.SwitchFeatures.t option Lwt.t =
match_lwt send_to_switch_fd fd 0l Message.SwitchFeaturesRequest with
Expand Down

0 comments on commit 5f954f4

Please sign in to comment.