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

Method destroy

control/methods.go:132–143  ·  view source on GitHub ↗

destroy is harsh, disconnects and removes everything set up by Init()

( writer http.ResponseWriter, request *http.Request )

Source from the content-addressed store, hash-verified

130
131// destroy is harsh, disconnects and removes everything set up by Init()
132func ( s *Server ) destroy( writer http.ResponseWriter, request *http.Request ) {
133 if request.Method != "GET" { http.Error( writer, http.StatusText( http.StatusNotFound ), http.StatusNotFound ); return }
134 select {
135 case s.connectionOpsLock<-struct{}{}: defer func() { <-s.connectionOpsLock }(); break
136 case <-time.NewTimer( time.Second ).C: http.Error( writer, http.StatusText( http.StatusConflict ), http.StatusConflict ); return
137 }
138
139 writer.Header().Add( "content-type", "application/json" )
140 s.connection.Disconnect()
141 s.connection.Shutdown()
142 writer.Write( Result{ Result: s.connection.State() }.Json() )
143}
144
145func ( s *Server ) state( writer http.ResponseWriter, request *http.Request ) {
146 if request.Method != "GET" { http.Error( writer, http.StatusText( http.StatusNotFound ), http.StatusNotFound ); return }

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected