Allenxuxu / gev

🚀Gev is a lightweight, fast non-blocking TCP network library / websocket server based on Reactor mode. Support custom protocols to quickly and easily build high-performance servers.
MIT License
1.73k stars 194 forks source link

sa *unix.Sockaddr 中 unix 包下的结构体不存在 ,具体进入查看详情 #30

Closed billmi closed 4 years ago

billmi commented 4 years ago

有关这个包下的 golang.org/x/sys/unix sa *unix.Sockaddr

func New(fd int, loop *eventloop.EventLoop, sa *unix.Sockaddr, protocol Protocol, tw *timingwheel.TimingWheel, idleTime time.Duration, readCb ReadCallback, closeCb CloseCallback) *Connection {
    conn := &Connection{
        fd:            fd,
        peerAddr:      sockaddrToString(sa),
        outBuffer:     pool.Get(),
        inBuffer:      pool.Get(),
        readCallback:  readCb,
        closeCallback: closeCb,
        loop:          loop,
        idleTime:      idleTime,
        timingWheel:   tw,
        protocol:      protocol,
    }
    conn.connected.Set(true)

    if conn.idleTime > 0 {
        _ = conn.activeTime.Swap(int(time.Now().Unix()))
        conn.timingWheel.AfterFunc(conn.idleTime, conn.closeTimeoutConn())
    }

    return conn
}

包路径 : github.com/Allenxuxu/gev/connection

sa *unix.Sockaddr 不存在

参考 https://github.com/golang/sys 下的 unix 库

Allenxuxu commented 4 years ago

很抱歉,现在才回复。

你说的这个是有的啊

https://github.com/golang/sys/blob/669c56c373c468cbe0f0c12b7939832b26088d33/unix/syscall_unix.go#L185

billmi commented 4 years ago

很抱歉,现在才回复。

你说的这个是有的啊

https://github.com/golang/sys/blob/669c56c373c468cbe0f0c12b7939832b26088d33/unix/syscall_unix.go#L185

谢谢大哥。可能本地的库很久没更新。。。