RegisterSocket registers the given normal socket s in channelz database with ref as its reference name, and adds it to the child list of its parent (identified by skt.Parent, which must be set). It returns the unique channelz tracking id assigned to this normal socket. If channelz is not turned ON,
(skt *Socket)
| 188 | // |
| 189 | // If channelz is not turned ON, the channelz database is not mutated. |
| 190 | func RegisterSocket(skt *Socket) *Socket { |
| 191 | skt.ID = IDGen.genID() |
| 192 | if IsOn() { |
| 193 | db.addSocket(skt) |
| 194 | } |
| 195 | return skt |
| 196 | } |
| 197 | |
| 198 | // RemoveEntry removes an entry with unique channelz tracking id to be id from |
| 199 | // channelz database. |