@@ -128,8 +128,7 @@ func (mux *Multiplexer) handleConnection(conn net.Conn, sender chan<- *reqContai
128
128
}
129
129
130
130
if logrus .IsLevelEnabled (logrus .DebugLevel ) {
131
- logrus .Debug ("Message from client..." )
132
- spew .Dump (msg )
131
+ logrus .Debug ("Message from client...\n %s" , spew .Sdump (msg ))
133
132
}
134
133
135
134
// enqueue request msg to target conn loop
@@ -142,7 +141,7 @@ func (mux *Multiplexer) handleConnection(conn net.Conn, sender chan<- *reqContai
142
141
// get response from target conn loop
143
142
resp := <- callback
144
143
if resp .err != nil {
145
- logrus .Errorf ("failed to forward message, %v" , err )
144
+ logrus .Errorf ("failed to forward message, %v" , resp . err )
146
145
break
147
146
}
148
147
@@ -183,15 +182,11 @@ func (mux *Multiplexer) targetConnLoop(requestQueue <-chan *reqContainer) {
183
182
switch container .typ {
184
183
case Connection :
185
184
clients ++
186
- if logrus .IsLevelEnabled (logrus .DebugLevel ) {
187
- logrus .Debugf ("Connected clients: %d" , clients )
188
- }
185
+ logrus .Infof ("Connected clients: %d" , clients )
189
186
continue
190
187
case Disconnection :
191
188
clients --
192
- if logrus .IsLevelEnabled (logrus .DebugLevel ) {
193
- logrus .Debugf ("Connected clients: %d" , clients )
194
- }
189
+ logrus .Infof ("Connected clients: %d" , clients )
195
190
if clients == 0 && conn != nil {
196
191
logrus .Info ("closing target connection" )
197
192
err := conn .Close ()
@@ -224,7 +219,7 @@ func (mux *Multiplexer) targetConnLoop(requestQueue <-chan *reqContainer) {
224
219
// renew conn
225
220
err = conn .Close ()
226
221
if err != nil {
227
- logrus .Error (err )
222
+ logrus .Error ("error while closing connection: %v" , err )
228
223
}
229
224
conn = nil
230
225
continue
@@ -242,16 +237,15 @@ func (mux *Multiplexer) targetConnLoop(requestQueue <-chan *reqContainer) {
242
237
}
243
238
244
239
if logrus .IsLevelEnabled (logrus .DebugLevel ) {
245
- logrus .Debug ("Message from target server..." )
246
- spew .Dump (msg )
240
+ logrus .Debug ("Message from target server...\n %s" , spew .Sdump (msg ))
247
241
}
248
242
249
243
if err != nil {
250
244
logrus .Errorf ("target connection: %v" , err )
251
245
// renew conn
252
246
err = conn .Close ()
253
247
if err != nil {
254
- logrus .Error (err )
248
+ logrus .Error ("error while closing connection: %v" , err )
255
249
}
256
250
conn = nil
257
251
continue
0 commit comments