File tree Expand file tree Collapse file tree 2 files changed +22
-21
lines changed Expand file tree Collapse file tree 2 files changed +22
-21
lines changed Original file line number Diff line number Diff line change @@ -99,6 +99,14 @@ module Controller = struct
99
99
let xid = ChunkController. client_next_xid t.sub c_id in
100
100
ChunkController. send_txn t.sub c_id (Message. marshal' (xid, msg))
101
101
102
+ let send_txn_with t sw_id msg f =
103
+ try begin
104
+ send_txn t sw_id msg
105
+ >> = function
106
+ | `Sent ivar -> Ivar. read ivar >> | f
107
+ | `Drop exn -> return (Result. Error exn )
108
+ end with Not_found -> return (Result. Error Not_found )
109
+
102
110
let send_ignore_errors t sw_id msg =
103
111
let c_id = client_id_of_switch_exn t sw_id in
104
112
ChunkController. send_ignore_errors t.sub c_id (Message. marshal' msg)
@@ -213,15 +221,7 @@ module Controller = struct
213
221
send_result t sw_id (0l , M. PacketOutMsg pkt_out)
214
222
215
223
let barrier t sw_id =
216
- try begin
217
- send_txn t sw_id M. BarrierRequest
218
- >> = function
219
- | `Sent ivar -> begin Ivar. read ivar
220
- >> | function
221
- | M. BarrierReply -> Result. Ok ()
222
- | _ -> assert false
223
- end
224
- | `Drop exn -> return (Result. Error exn )
225
- end with Not_found -> return (Result. Error Not_found )
226
-
224
+ send_txn_with t sw_id M. BarrierRequest (function
225
+ | M. BarrierReply -> Result. Ok ()
226
+ | _ -> assert false )
227
227
end
Original file line number Diff line number Diff line change @@ -134,6 +134,14 @@ module Controller = struct
134
134
let xid = ChunkController. client_next_xid t.sub c_id in
135
135
ChunkController. send_txn t.sub c_id (Message. marshal' (xid, msg))
136
136
137
+ let send_txn_with t sw_id msg f =
138
+ try begin
139
+ send_txn t sw_id msg
140
+ >> = function
141
+ | `Sent ivar -> Ivar. read ivar >> | f
142
+ | `Drop exn -> return (Result. Error exn )
143
+ end with Not_found -> return (Result. Error Not_found )
144
+
137
145
let send_ignore_errors t sw_id msg =
138
146
let c_id = client_id_of_switch_exn t sw_id in
139
147
ChunkController. send_ignore_errors t.sub c_id (Message. marshal' msg)
@@ -247,15 +255,8 @@ module Controller = struct
247
255
send_result t sw_id (0l , M. PacketOutMsg pkt_out)
248
256
249
257
let barrier t sw_id =
250
- try begin
251
- send_txn t sw_id M. BarrierRequest
252
- >> = function
253
- | `Sent ivar -> begin Ivar. read ivar
254
- >> | function
255
- | M. BarrierReply -> Result. Ok ()
256
- | _ -> assert false
257
- end
258
- | `Drop exn -> return (Result. Error exn )
259
- end with Not_found -> return (Result. Error Not_found )
258
+ send_txn_with t sw_id M. BarrierRequest (function
259
+ | M. BarrierReply -> Result. Ok ()
260
+ | _ -> assert false )
260
261
261
262
end
You can’t perform that action at this time.
0 commit comments