Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
zfl9 committed Sep 5, 2024
1 parent f72387b commit 2b46aa5
Show file tree
Hide file tree
Showing 4 changed files with 436 additions and 352 deletions.
5 changes: 4 additions & 1 deletion src/EvLoop.zig
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ pub const Fd = struct {
self.canceled = true;
// cc.set_errno(c.ECANCELED);

_ = self.ref();
defer self.unref();

if (self.read_frame) |frame|
co.do_resume(frame);
if (self.write_frame) |frame|
Expand Down Expand Up @@ -541,7 +544,7 @@ pub fn read(self: *EvLoop, fdobj: *Fd, buf: []u8) ReadErr!void {
}
}

pub fn read_udp(self: *EvLoop, fdobj: *Fd, buf: []u8, src_addr: *cc.SockAddr) ?usize {
pub fn read_udp(self: *EvLoop, fdobj: *Fd, buf: []u8, src_addr: ?*cc.SockAddr) ?usize {
while (!fdobj.is_canceled()) {
return cc.recvfrom(fdobj.fd, buf, 0, src_addr) orelse {
if (cc.errno() != c.EAGAIN)
Expand Down
Loading

0 comments on commit 2b46aa5

Please sign in to comment.