Skip to content

Commit

Permalink
opt: fieldalignment, optimization from 144 to 104 byte
Browse files Browse the repository at this point in the history
  • Loading branch information
zhongweikang authored and panjf2000 committed May 29, 2022
1 parent 2ae824a commit f70489f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,18 @@ import (
)

type conn struct {
fd int // file descriptor
ctx interface{} // user-defined context
peer unix.Sockaddr // remote socket address
loop *eventloop // connected event-loop
buffer []byte // buffer for the latest bytes
opened bool // connection opened event fired
localAddr net.Addr // local addr
remoteAddr net.Addr // remote addr
isDatagram bool // UDP protocol
inboundBuffer elastic.RingBuffer // buffer for leftover data from the peer
loop *eventloop // connected event-loop
outboundBuffer *elastic.Buffer // buffer for data that is eligible to be sent to the peer
pollAttachment *netpoll.PollAttachment // connection attachment for poller
inboundBuffer elastic.RingBuffer // buffer for leftover data from the peer
buffer []byte // buffer for the latest bytes
fd int // file descriptor
isDatagram bool // UDP protocol
opened bool // connection opened event fired
}

func newTCPConn(fd int, el *eventloop, sa unix.Sockaddr, localAddr, remoteAddr net.Addr) (c *conn) {
Expand Down

0 comments on commit f70489f

Please sign in to comment.