Merge changes Icdefb5ff,Icd7f5f03

* changes:
  Fix potential race introduced in Icd7f5f03
  SocketClient: add optional reference counting