This commit is contained in:
esrrhs 2019-10-27 12:32:31 +08:00
parent 7b88a879e1
commit dc02a58284
2 changed files with 4 additions and 4 deletions

View File

@ -226,7 +226,7 @@ func (p *Client) AcceptTcpConn(conn *net.TCPConn) {
left := common.MinOfInt(clientConn.fm.GetSendBufferLeft(), len(bytes)) left := common.MinOfInt(clientConn.fm.GetSendBufferLeft(), len(bytes))
if left > 0 { if left > 0 {
conn.SetReadDeadline(time.Now().Add(time.Millisecond * 10)) conn.SetReadDeadline(time.Now().Add(time.Millisecond * 1))
n, err := conn.Read(bytes[0:left]) n, err := conn.Read(bytes[0:left])
if err != nil { if err != nil {
nerr, ok := err.(net.Error) nerr, ok := err.(net.Error)
@ -266,7 +266,7 @@ func (p *Client) AcceptTcpConn(conn *net.TCPConn) {
if clientConn.fm.GetRecvBufferSize() > 0 { if clientConn.fm.GetRecvBufferSize() > 0 {
rr := clientConn.fm.GetRecvReadLineBuffer() rr := clientConn.fm.GetRecvReadLineBuffer()
conn.SetWriteDeadline(time.Now().Add(time.Millisecond * 10)) conn.SetWriteDeadline(time.Now().Add(time.Millisecond * 1))
n, err := conn.Write(rr) n, err := conn.Write(rr)
if err != nil { if err != nil {
nerr, ok := err.(net.Error) nerr, ok := err.(net.Error)

View File

@ -192,7 +192,7 @@ func (p *Server) RecvTCP(conn *ServerConn, id string, src *net.IPAddr) {
left := common.MinOfInt(conn.fm.GetSendBufferLeft(), len(bytes)) left := common.MinOfInt(conn.fm.GetSendBufferLeft(), len(bytes))
if left > 0 { if left > 0 {
conn.tcpconn.SetReadDeadline(time.Now().Add(time.Millisecond * 10)) conn.tcpconn.SetReadDeadline(time.Now().Add(time.Millisecond * 1))
n, err := conn.tcpconn.Read(bytes[0:left]) n, err := conn.tcpconn.Read(bytes[0:left])
if err != nil { if err != nil {
nerr, ok := err.(net.Error) nerr, ok := err.(net.Error)
@ -231,7 +231,7 @@ func (p *Server) RecvTCP(conn *ServerConn, id string, src *net.IPAddr) {
if conn.fm.GetRecvBufferSize() > 0 { if conn.fm.GetRecvBufferSize() > 0 {
rr := conn.fm.GetRecvReadLineBuffer() rr := conn.fm.GetRecvReadLineBuffer()
conn.tcpconn.SetWriteDeadline(time.Now().Add(time.Millisecond * 10)) conn.tcpconn.SetWriteDeadline(time.Now().Add(time.Millisecond * 1))
n, err := conn.tcpconn.Write(rr) n, err := conn.tcpconn.Write(rr)
if err != nil { if err != nil {
nerr, ok := err.(net.Error) nerr, ok := err.(net.Error)