Skip to content

Commit 342fbe9

Browse files
committed
Revert "api: introduce RootContext::on_create_child_context() callback"
This reverts commit 5b0bbe5. We revert this temporarily to allow for upstream patches to apply.
1 parent 4b093e0 commit 342fbe9

File tree

2 files changed

+0
-45
lines changed

2 files changed

+0
-45
lines changed

src/dispatcher.rs

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -95,37 +95,6 @@ impl Dispatcher {
9595
}
9696
}
9797

98-
/// Lets the root context to create its child context.
99-
fn create_child_context(&self, context_id: u32, root_context_id: u32) -> bool {
100-
if !self.roots.borrow().contains_key(&root_context_id) {
101-
panic!("invalid root_context_id")
102-
}
103-
if let Some(child_context) = self
104-
.roots
105-
.borrow_mut()
106-
.get_mut(&root_context_id)
107-
.and_then(|root| root.on_create_child_context(context_id))
108-
{
109-
if match child_context {
110-
ChildContext::HttpContext(http_context) => self
111-
.http_streams
112-
.borrow_mut()
113-
.insert(context_id, http_context)
114-
.is_some(),
115-
ChildContext::StreamContext(stream_context) => self
116-
.streams
117-
.borrow_mut()
118-
.insert(context_id, stream_context)
119-
.is_some(),
120-
} {
121-
panic!("duplicate context_id")
122-
}
123-
true
124-
} else {
125-
false
126-
}
127-
}
128-
12998
fn create_stream_context(&self, context_id: u32, root_context_id: u32) {
13099
if !self.roots.borrow().contains_key(&root_context_id) {
131100
panic!("invalid root_context_id")
@@ -176,8 +145,6 @@ impl Dispatcher {
176145
fn on_create_context(&self, context_id: u32, root_context_id: u32) {
177146
if root_context_id == 0 {
178147
self.create_root_context(context_id)
179-
} else if self.create_child_context(context_id, root_context_id) {
180-
// root context created a child context by himself
181148
} else if self.new_http_stream.get().is_some() {
182149
self.create_http_context(context_id, root_context_id);
183150
} else if self.new_stream.get().is_some() {

src/traits.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,6 @@ pub trait Context {
9999
}
100100
}
101101

102-
/// Represents a child context of the root context.
103-
pub enum ChildContext {
104-
StreamContext(Box<dyn StreamContext>),
105-
HttpContext(Box<dyn HttpContext>),
106-
}
107-
108102
pub trait RootContext: Context {
109103
fn on_vm_start(&mut self, _vm_configuration_size: usize) -> bool {
110104
true
@@ -127,12 +121,6 @@ pub trait RootContext: Context {
127121
fn on_queue_ready(&mut self, _queue_id: u32) {}
128122

129123
fn on_log(&mut self) {}
130-
131-
fn on_create_child_context(&mut self, _context_id: u32) -> Option<ChildContext> {
132-
// for the sake of compatibility with `set_http_context` and `set_stream_context` API,
133-
// root context is not required to create its child context.
134-
None
135-
}
136124
}
137125

138126
pub trait StreamContext: Context {

0 commit comments

Comments
 (0)