Przeglądaj źródła

Add logging for proxy tags

tags/0.9
9seconds 7 lat temu
rodzic
commit
6adc592490
1 zmienionych plików z 10 dodań i 2 usunięć
  1. 10
    2
      wrappers/mtproto_proxy.go

+ 10
- 2
wrappers/mtproto_proxy.go Wyświetl plik

@@ -67,19 +67,27 @@ func (m *MTProtoProxy) readProxyAns(data []byte) ([]byte, error) {
67 67
 	if len(data) < 12 {
68 68
 		return nil, errors.Errorf("Incorrect data of proxy answer: %d", len(data))
69 69
 	}
70
+	data = data[12:]
70 71
 
71
-	return data[12:], nil
72
+	m.logger.Debugw("Read RPC_PROXY_ANS", "length", len(data))
73
+
74
+	return data, nil
72 75
 }
73 76
 
74 77
 func (m *MTProtoProxy) readSimpleAck(data []byte) ([]byte, error) {
75 78
 	if len(data) != 12 {
76 79
 		return nil, errors.Errorf("Incorrect data of simple ack: %d", len(data))
77 80
 	}
81
+	data = data[8:12]
82
+
83
+	m.logger.Debugw("Read RPC_SIMPLE_ACK", "length", len(data))
78 84
 
79
-	return data[8:12], nil // 0:8 - connection id
85
+	return data, nil
80 86
 }
81 87
 
82 88
 func (m *MTProtoProxy) readCloseExt(data []byte) ([]byte, error) {
89
+	m.logger.Debugw("Read RPC_CLOSE_EXT")
90
+
83 91
 	return nil, errors.New("Connection has been closed remotely by RPC call")
84 92
 }
85 93
 

Ładowanie…
Anuluj
Zapisz