Skip to content

Commit

Permalink
remove closed event
Browse files Browse the repository at this point in the history
  • Loading branch information
cheng-zhongliang committed Oct 5, 2023
1 parent a21796b commit b085d60
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ $ go get -u github.com/cheng-zhongliang/event

When the event is triggered, the callback function will be called.

### Read/Write/Closed/Timeout
### Read/Write/Timeout

These events can be used in combination.

Expand Down Expand Up @@ -118,8 +118,8 @@ func main() {
}

fd := socket()
ev := event.New(fd, event.EvRead|event.EvPersist, accept, base)
if err := ev.Attach(base, 0); err != nil {
ev := event.New(base, fd, event.EvRead|event.EvPersist, accept, base)
if err := ev.Attach(0); err != nil {
panic(err)
}

Expand All @@ -132,7 +132,7 @@ func main() {

func socket() int {
addr := syscall.SockaddrInet4{Port: 1246, Addr: [4]byte{0, 0, 0, 0}}
fd, err := syscall.Socket(syscall.AF_INET, syscall.SOCK_STREAM|syscall.SOCK_NONBLOCK, syscall.IPPROTO_TCP)
fd, err := syscall.Socket(syscall.AF_INET, syscall.SOCK_STREAM, syscall.IPPROTO_TCP)
if err != nil {
panic(err)
}
Expand All @@ -154,8 +154,8 @@ func accept(fd int, events uint32, arg interface{}) {
panic(err)
}

ev := event.New(clientFd, event.EvRead|event.EvPersist, echo, nil)
if err := ev.Attach(base, 0); err != nil {
ev := event.New(base, clientFd, event.EvRead|event.EvPersist, echo, nil)
if err := ev.Attach(0); err != nil {
panic(err)
}
}
Expand Down

0 comments on commit b085d60

Please sign in to comment.