std/event/tcp.zig: remove promise_symbol from suspend and use @handle();

Tracking Issue #1296 ;
master
kristopher tate 2018-07-29 17:14:35 +09:00
parent a3705b4251
commit 9fe140abad
1 changed files with 5 additions and 4 deletions

View File

@ -88,8 +88,8 @@ pub const Server = struct {
}, },
error.ProcessFdQuotaExceeded => { error.ProcessFdQuotaExceeded => {
errdefer std.os.emfile_promise_queue.remove(&self.waiting_for_emfile_node); errdefer std.os.emfile_promise_queue.remove(&self.waiting_for_emfile_node);
suspend |p| { suspend {
self.waiting_for_emfile_node = PromiseNode.init(p); self.waiting_for_emfile_node = PromiseNode.init( @handle() );
std.os.emfile_promise_queue.append(&self.waiting_for_emfile_node); std.os.emfile_promise_queue.append(&self.waiting_for_emfile_node);
} }
continue; continue;
@ -141,8 +141,9 @@ test "listen on a port, send bytes, receive bytes" {
(await next_handler) catch |err| { (await next_handler) catch |err| {
std.debug.panic("unable to handle connection: {}\n", err); std.debug.panic("unable to handle connection: {}\n", err);
}; };
suspend |p| { suspend {
cancel p; var h: promise = @handle();
cancel h;
} }
} }
async fn errorableHandler(self: *Self, _addr: *const std.net.Address, _socket: *const std.os.File) !void { async fn errorableHandler(self: *Self, _addr: *const std.net.Address, _socket: *const std.os.File) !void {