MCPcopy Create free account
hub / github.com/eventure/hide.client.linux / shutdown

Method shutdown

control/methods.go:120–129  ·  view source on GitHub ↗
( writer http.ResponseWriter, request *http.Request )

Source from the content-addressed store, hash-verified

118}
119
120func ( s *Server ) shutdown( writer http.ResponseWriter, request *http.Request ) {
121 if request.Method != "GET" { http.Error( writer, http.StatusText( http.StatusNotFound ), http.StatusNotFound ); return }
122 select {
123 case s.connectionOpsLock<-struct{}{}: defer func() { <-s.connectionOpsLock }(); break
124 case <-time.NewTimer( time.Second ).C: http.Error( writer, http.StatusText( http.StatusConflict ), http.StatusConflict ); return
125 }
126 writer.Header().Add( "content-type", "application/json" )
127 s.connection.Shutdown()
128 writer.Write( Result{ Result: s.connection.State() }.Json() )
129}
130
131// destroy is harsh, disconnects and removes everything set up by Init()
132func ( s *Server ) destroy( writer http.ResponseWriter, request *http.Request ) {

Callers

nothing calls this directly

Calls 5

WriteMethod · 0.80
JsonMethod · 0.80
StateMethod · 0.80
ErrorMethod · 0.45
ShutdownMethod · 0.45

Tested by

no test coverage detected