code format
This commit is contained in:
parent
130b3b878e
commit
e4b1bd4038
@ -1,14 +1,14 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"net"
|
||||||
|
|
||||||
"q5"
|
|
||||||
"f5"
|
|
||||||
"cs"
|
"cs"
|
||||||
"ss"
|
"f5"
|
||||||
"mt"
|
"mt"
|
||||||
|
"q5"
|
||||||
|
"ss"
|
||||||
|
|
||||||
proto "github.com/golang/protobuf/proto"
|
proto "github.com/golang/protobuf/proto"
|
||||||
)
|
)
|
||||||
@ -87,9 +87,7 @@ func (this *WSPListener) socketRead(conn net.Conn) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if offset > 0 && offset < recvBufLen {
|
if offset > 0 && offset < recvBufLen {
|
||||||
copy(recvBuf[:],
|
copy(recvBuf[:], recvBuf[offset:])
|
||||||
recvBuf[offset:recvBufLen - offset])
|
|
||||||
|
|
||||||
}
|
}
|
||||||
recvBufLen -= offset
|
recvBufLen -= offset
|
||||||
if recvBufLen >= MAX_PACKET_LEN {
|
if recvBufLen >= MAX_PACKET_LEN {
|
||||||
@ -118,8 +116,7 @@ func (this *WSPListener) decodePacket(conn net.Conn, buf []byte, offset *int, bu
|
|||||||
hdr.MsgId = msgHead.MsgId
|
hdr.MsgId = msgHead.MsgId
|
||||||
hdr.SocketHandle = msgHead.SocketHandle
|
hdr.SocketHandle = msgHead.SocketHandle
|
||||||
hdr.SeqId = msgHead.SeqId
|
hdr.SeqId = msgHead.SeqId
|
||||||
hdr.Data = buf[int(*offset) + f5.WSPROXYPACKHEAD_C_SIZE:
|
hdr.Data = buf[int(*offset)+f5.WSPROXYPACKHEAD_C_SIZE : int(*offset)+f5.WSPROXYPACKHEAD_C_SIZE+int(msgHead.PackLen)]
|
||||||
int(*offset) + f5.WSPROXYPACKHEAD_C_SIZE + int(msgHead.PackLen)]
|
|
||||||
this.ch <- hdr
|
this.ch <- hdr
|
||||||
*offset += f5.WSPROXYPACKHEAD_C_SIZE + int(msgHead.PackLen)
|
*offset += f5.WSPROXYPACKHEAD_C_SIZE + int(msgHead.PackLen)
|
||||||
} else {
|
} else {
|
||||||
@ -167,7 +164,7 @@ func (this *WSPListener) sendProxyMsg(conn net.Conn, socketHandle uint16, msg pr
|
|||||||
msgHead.SocketHandle = socketHandle
|
msgHead.SocketHandle = socketHandle
|
||||||
|
|
||||||
buff := make([]byte, len(msgData)+f5.WSPROXYPACKHEAD_S_SIZE)
|
buff := make([]byte, len(msgData)+f5.WSPROXYPACKHEAD_S_SIZE)
|
||||||
msgHead.Write(buff, 0);
|
msgHead.Write(buff, 0)
|
||||||
copy(buff[f5.WSPROXYPACKHEAD_S_SIZE:], msgData[:])
|
copy(buff[f5.WSPROXYPACKHEAD_S_SIZE:], msgData[:])
|
||||||
conn.Write(buff)
|
conn.Write(buff)
|
||||||
}
|
}
|
||||||
|
2
third_party/f5
vendored
2
third_party/f5
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 155220a3b249ce1aa57b3ce6fcefe5b647407c8e
|
Subproject commit fe1acddcc815ffb3359c460c1dff03ad20da42cd
|
Loading…
x
Reference in New Issue
Block a user