...
Source file src/pkg/net/internal/socktest/switch_unix.go
1
2
3
4
5
6
7 package socktest
8
9
10 type Sockets map[int]Status
11
12 func (sw *Switch) sockso(s int) *Status {
13 sw.smu.RLock()
14 defer sw.smu.RUnlock()
15 so, ok := sw.sotab[s]
16 if !ok {
17 return nil
18 }
19 return &so
20 }
21
22
23
24 func (sw *Switch) addLocked(s, family, sotype, proto int) *Status {
25 sw.once.Do(sw.init)
26 so := Status{Cookie: cookie(family, sotype, proto)}
27 sw.sotab[s] = so
28 return &so
29 }
30
View as plain text