implement statuscode in packets
All checks were successful
Build and Publish / BuildAndDeploy (push) Successful in 2m2s
All checks were successful
Build and Publish / BuildAndDeploy (push) Successful in 2m2s
This commit is contained in:
@@ -77,7 +77,8 @@ func (m *TCPClient) SendPacket(messageType uint32, data []byte) error {
|
||||
err = binary.Write(m.Conn, binary.LittleEndian, Packet{
|
||||
Version: CurrentPacketVersion,
|
||||
MessageType: messageType,
|
||||
DataLength: uint64(len(data)),
|
||||
StatusCode: 0,
|
||||
DataLength: uint32(len(data)),
|
||||
})
|
||||
if err != nil {
|
||||
return m.HandleConnectionError(err)
|
||||
@@ -94,7 +95,7 @@ func (m *TCPClient) SendPacket(messageType uint32, data []byte) error {
|
||||
// return m.SendPacket(messageType, data)
|
||||
// }
|
||||
|
||||
func (m *TCPClient) Call(messageType uint32, responseType uint32, data []byte) ([]byte, error) {
|
||||
func (m *TCPClient) Call(messageType uint32, responseType uint32, data []byte) (*CallResult, error) {
|
||||
packetChan := m.Expect(responseType)
|
||||
err := m.SendPacket(messageType, data)
|
||||
if err != nil {
|
||||
@@ -103,7 +104,7 @@ func (m *TCPClient) Call(messageType uint32, responseType uint32, data []byte) (
|
||||
|
||||
select {
|
||||
case ret := <-packetChan:
|
||||
return ret, nil
|
||||
return &ret, nil
|
||||
case <-time.After(time.Second):
|
||||
return nil, fmt.Errorf("timeout")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user