@@ -74,7 +74,6 @@ func API_ask(c *gin.Context) {
74
74
// Find connection with the lowest load and where heartbeat is after last message time
75
75
connectionPool .Mu .RLock ()
76
76
for _ , conn := range connectionPool .Connections {
77
- println (conn .Id )
78
77
if connection == nil || conn .LastMessageTime .Before (connection .LastMessageTime ) {
79
78
if conn .Heartbeat .After (conn .LastMessageTime ) {
80
79
connection = conn
@@ -90,17 +89,14 @@ func API_ask(c *gin.Context) {
90
89
return
91
90
}
92
91
// Ping before sending request
93
- println (connection .Id )
94
92
var pingSucceeded bool = ping (connection .Id )
95
93
if ! pingSucceeded {
96
94
// Ping failed. Try again
97
95
connectionPool .Delete (connection .Id )
98
- println ("Ping failed" )
99
96
succeeded = false
100
97
connection = nil
101
98
continue
102
99
} else {
103
- println ("Ping succeeded" )
104
100
succeeded = true
105
101
break
106
102
}
@@ -224,7 +220,6 @@ func API_getConnections(c *gin.Context) {
224
220
}
225
221
226
222
func ping (connection_id string ) bool {
227
- println ("Starting ping" )
228
223
// Get connection
229
224
connection , ok := connectionPool .Get (connection_id )
230
225
// Send "ping" to the connection
@@ -236,7 +231,6 @@ func ping(connection_id string) bool {
236
231
}
237
232
connection .Ws .SetReadDeadline (time .Now ().Add (5 * time .Second ))
238
233
err := connection .Ws .WriteJSON (send )
239
- println ("Sent ping" )
240
234
if err != nil {
241
235
return false
242
236
}
@@ -245,9 +239,7 @@ func ping(connection_id string) bool {
245
239
// Read message
246
240
var receive types.Message
247
241
err = connection .Ws .ReadJSON (& receive )
248
- println ("Received ping response" )
249
242
if err != nil {
250
- println ("There was an error" )
251
243
return false
252
244
}
253
245
// Check if the message is the response
0 commit comments