RegisterServer registers the given server s in channelz database. It returns the unique channelz tracking id assigned to this server. If channelz is not turned ON, the channelz database is not mutated.
(ref string)
| 166 | // |
| 167 | // If channelz is not turned ON, the channelz database is not mutated. |
| 168 | func RegisterServer(ref string) *Server { |
| 169 | id := IDGen.genID() |
| 170 | if !IsOn() { |
| 171 | return &Server{ID: id} |
| 172 | } |
| 173 | |
| 174 | svr := &Server{ |
| 175 | RefName: ref, |
| 176 | sockets: make(map[int64]string), |
| 177 | listenSockets: make(map[int64]string), |
| 178 | ID: id, |
| 179 | } |
| 180 | db.addServer(id, svr) |
| 181 | return svr |
| 182 | } |
| 183 | |
| 184 | // RegisterSocket registers the given normal socket s in channelz database |
| 185 | // with ref as its reference name, and adds it to the child list of its parent |