run on x86 for a while
This commit is contained in:
@@ -26,10 +26,10 @@ func Dial(address string) (*Client, error) {
|
||||
}
|
||||
|
||||
type TCPClient struct {
|
||||
*PersistentConnection
|
||||
sendMux sync.Mutex
|
||||
ErrorCount int
|
||||
address string
|
||||
PersistentConnection *PersistentConnection
|
||||
sendMux sync.Mutex
|
||||
ErrorCount int
|
||||
address string
|
||||
*PacketQueue
|
||||
}
|
||||
|
||||
@@ -103,18 +103,18 @@ var (
|
||||
func (m *TCPClient) SendPacket(messageType PoolMessage, data []byte) error {
|
||||
m.sendMux.Lock()
|
||||
defer m.sendMux.Unlock()
|
||||
m.Conn.Write(header[:])
|
||||
err := binary.Write(m.Conn, binary.LittleEndian, Packet{
|
||||
m.PersistentConnection.Write(header[:])
|
||||
err := binary.Write(m.PersistentConnection, binary.LittleEndian, Packet{
|
||||
Version: CurrentPacketVersion,
|
||||
MessageType: messageType,
|
||||
StatusCode: 0,
|
||||
DataLength: uint32(len(data)),
|
||||
})
|
||||
if err != nil {
|
||||
return m.HandleConnectionError(err)
|
||||
return m.PersistentConnection.HandleConnectionError(err)
|
||||
}
|
||||
_, err = m.Conn.Write(data)
|
||||
return m.HandleConnectionError(err)
|
||||
_, err = m.PersistentConnection.Write(data)
|
||||
return m.PersistentConnection.HandleConnectionError(err)
|
||||
}
|
||||
|
||||
func (m *TCPClient) Call(messageType PoolMessage, responseType PoolMessage, data []byte) (*CallResult, error) {
|
||||
@@ -122,7 +122,7 @@ func (m *TCPClient) Call(messageType PoolMessage, responseType PoolMessage, data
|
||||
err := m.SendPacket(messageType, data)
|
||||
if err != nil {
|
||||
m.RemoveListeners()
|
||||
return nil, m.HandleConnectionError(err)
|
||||
return nil, m.PersistentConnection.HandleConnectionError(err)
|
||||
}
|
||||
|
||||
select {
|
||||
@@ -130,6 +130,6 @@ func (m *TCPClient) Call(messageType PoolMessage, responseType PoolMessage, data
|
||||
return &ret, nil
|
||||
case <-time.After(time.Second):
|
||||
log.Printf("Timeout waiting for cart response to message type %d\n", responseType)
|
||||
return nil, m.HandleConnectionError(fmt.Errorf("timeout"))
|
||||
return nil, m.PersistentConnection.HandleConnectionError(fmt.Errorf("timeout"))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user