INNER CODE UNIT · Go

newClients

yahoo/vssh · client_mem.go:26

func newClients() clients {
	c := make(clients, clientsShardNum)
	for i := 0; i < clientsShardNum; i++ {
		c[i] = &clientsShard{}
		c[i].clients = make(map[string]*clientAttr)
	}
	return c
}

func (c clients) add(client *clientAttr) {
	shard := c.getShard(client.addr)
	c[shard].Lock()
	defer c[shard].Unlock()
	c[shard].clients[client.addr] = client
}
func (c clients) del(key string) {
	shard := c.getShard(key)
	c[shard].Lock()

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…