     network_connect_state = 'connecting'
 
     reconnect = (msg) ->
+        # reset recent disconnects, and hope that after the reconnection the situation will be better
+        recent_disconnects = []
         reconnection_warning = +new Date()
         console.log("ALERT: connection unstable, notification + attempting to fix it -- #{attempt} attempts and #{num_recent_disconnects()} disconnects")
         alert_message(msg)

        dialog.find(".salvus-connection-hub").hide()

    if last_ping_time
        dialog.find(".salvus-connection-ping").show().find('pre').text("#{ping_time_smooth ? 'N/A'}ms (latest: #{last_ping_time}ms)")
    else
        dialog.find(".salvus-connection-ping").hide()

    recent_disconnects.push(+new Date())
    # avoid buffer overflow
    recent_disconnects = recent_disconnects[-100..]
    # console.log("recent_disconnects:", recent_disconnects)

num_recent_disconnects = (minutes=10) ->
    # note the "+", since we work with timestamps
