File tree Expand file tree Collapse file tree 4 files changed +17
-4
lines changed Expand file tree Collapse file tree 4 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -162,6 +162,7 @@ module Chunk : sig
162
162
]
163
163
164
164
val client_version : t -> Client_id .t -> int
165
+ val client_next_xid : t -> Client_id .t -> int32
165
166
166
167
val send_txn
167
168
: t
@@ -191,7 +192,7 @@ module OpenFlow0x01 : sig
191
192
val send_txn
192
193
: t
193
194
-> Client_id. t
194
- -> m
195
+ -> OpenFlow0x01.Message. t
195
196
-> [ `Sent of Message. t Ivar. t | `Drop of exn ] Deferred. t
196
197
end
197
198
@@ -214,7 +215,7 @@ module OpenFlow0x04 : sig
214
215
val send_txn
215
216
: t
216
217
-> Client_id. t
217
- -> m
218
+ -> OpenFlow0x04.Message. t
218
219
-> [ `Sent of Message. t Ivar. t | `Drop of exn ] Deferred. t
219
220
end
220
221
Original file line number Diff line number Diff line change @@ -96,7 +96,8 @@ module Controller = struct
96
96
97
97
let send_txn t sw_id msg =
98
98
let c_id = client_id_of_switch_exn t sw_id in
99
- ChunkController. send_txn t.sub c_id (Message. marshal' msg)
99
+ let xid = ChunkController. client_next_xid t.sub c_id in
100
+ ChunkController. send_txn t.sub c_id (Message. marshal' (xid, msg))
100
101
101
102
let send_ignore_errors t sw_id msg =
102
103
let c_id = client_id_of_switch_exn t sw_id in
Original file line number Diff line number Diff line change @@ -131,7 +131,8 @@ module Controller = struct
131
131
132
132
let send_txn t sw_id msg =
133
133
let c_id = client_id_of_switch_exn t sw_id in
134
- ChunkController. send_txn t.sub c_id (Message. marshal' msg)
134
+ let xid = ChunkController. client_next_xid t.sub c_id in
135
+ ChunkController. send_txn t.sub c_id (Message. marshal' (xid, msg))
135
136
136
137
let send_ignore_errors t sw_id msg =
137
138
let c_id = client_id_of_switch_exn t sw_id in
Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ module Controller = struct
47
47
type t = {
48
48
state : [ `Active | `Idle | `Kill ];
49
49
version : int option ;
50
+ mutable xid : int32 ;
50
51
txns : r Ivar .t XidTbl .t ;
51
52
state_entered : Time .t ;
52
53
last_activity : Time .t
@@ -56,11 +57,17 @@ module Controller = struct
56
57
let now = Time. now () in
57
58
{ state = `Active
58
59
; version = None
60
+ ; xid = 1l
59
61
; txns = XidTbl. create ()
60
62
; state_entered = now
61
63
; last_activity = now
62
64
}
63
65
66
+ let next_xid (t :t ) =
67
+ let xid = t.xid in
68
+ t.xid < - Int32. (xid + 1l );
69
+ xid
70
+
64
71
let add_txn (t :t ) m =
65
72
let xid = (Message. header_of m).OpenFlow_Header. xid in
66
73
let ivar = ref None in
@@ -266,6 +273,9 @@ module Controller = struct
266
273
| None -> raise Not_found
267
274
| Some (ver ) -> ver
268
275
276
+ let client_next_xid t c_id =
277
+ Conn. next_xid (Client_id.Table. find_exn t.clients c_id)
278
+
269
279
let handshake v t evt =
270
280
let open Header in
271
281
match evt with
You can’t perform that action at this time.
0 commit comments