MCPcopy Create free account
hub / github.com/nsf/gocode / loop

Method loop

server.go:89–120  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

87)
88
89func (this *daemon) loop() {
90 conn_in := make(chan net.Conn)
91 go func() {
92 for {
93 c, err := this.listener.Accept()
94 if err != nil {
95 panic(err)
96 }
97 conn_in <- c
98 }
99 }()
100
101 timeout := time.Duration(g_config.CloseTimeout) * time.Second
102 countdown := time.NewTimer(timeout)
103
104 for {
105 // handle connections or server CMDs (currently one CMD)
106 select {
107 case c := <-conn_in:
108 rpc.ServeConn(c)
109 countdown.Reset(timeout)
110 runtime.GC()
111 case cmd := <-this.cmd_in:
112 switch cmd {
113 case daemon_close:
114 return
115 }
116 case <-countdown.C:
117 return
118 }
119 }
120}
121
122func (this *daemon) close() {
123 this.cmd_in <- daemon_close

Callers 1

do_serverFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected