SSLSocket Object Leak?

Whenever I close a socket and remove it from an array from the SSLSocket Error event, the object count does not decrease.

This issue does not happen if I change it to a normal TCPSocket.

This issue also doesn’t happen if a use a timer in the error event: “Timer1.Period = 0”

Given that this issue doesn’t happen with a TCPSocket, and that it doesn’t happen with a timer, it would seem to be a bug.
But I could certainly be doing something wrong.

Tested with the latest version: 2014r2.1



Sub Action()
  TextArea1.Text = ""
  Dim s As new sckSSL
  s.Address = TextField4.Text
  s.Port = Val(TextField5.Text)
  if CheckBox1.Value = True Then
    s.Secure = True
    s.Secure = False
  End If = + 1 =
  sckSSL.sslArray.Append s
  me.Enabled = False
End Sub

Sub Error()
  Window1.Listbox1.AddRow "Disconnected: " + CStr(
  If Window1.CheckBox2.Value = True Then // Use workaround
    timerID =
    Window1.Timer1.Period = 0
    Window1.Timer1.Mode = timer.ModeSingle
    Window1.Timer1.Enabled = True
  Else // No workaround
  End If
End Sub

 Shared Sub SockKill(sockID As Integer)
  for i As Integer = UBound(sslArray) DownTo 0
    if sckSSL.sslArray(i) <> nil Then
      if sckSSL.sslArray(i).id = sockID Then
        sckSSL.sslArray(i) = nil
        sckSSL.sslArray.Remove i
        Window1.Listbox1.AddRow "Killed: " + CStr(sockID)
        Window1.PushButton1.Enabled = True
      End If
    End If
  next i
End Sub

You’re testing the object count from within an event of the object, so of course the count hasn’t gone down, the object is still in use. Try testing the count from outside the object. Put Window1.Objects in a timer that you start in SockKill.

I created a timer on Window1: TimerObjectUpdate which updates the object count every 1 second.
I stopped using the method.

The issue remains. Object count raises by 1 every time I make a connection.
If I set “.secure = False”, and connect to port 80, the count goes up one and drops back to where it was after the socket is killed.

When it is set to “.secure = True”, the count rises seemingly indefinitely with each connection.

No change in code aside from toggling the “secure” property and switching between ports 80 and 443.

Fill a feedback case?

I think this is the same issue I raised recently… see: