196 service MyService {
197 // Operation 1
198 rpc Operation1(OperationRequest) returns (OperationResponse) {
199 option (google.api.http) = {
200 post: "/apiver/myser/oper1"
201 body: "*"
202 };
203 }
--
You received this message because you are subscribed to the Google Groups "grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+unsubscribe@googlegroups.com.
To post to this group, send email to grp...@googlegroups.com.
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/3bfd5b3d-5468-4728-9e60-042e49552069%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
411 func (s *Server) serveStreams(st transport.ServerTransport) {
412 defer s.removeConn(st)
413 defer st.Close()
414 var wg sync.WaitGroup
415 st.HandleStreams(func(stream *transport.Stream) {
416 wg.Add(1)
417 go func() {
418 defer wg.Done()
419 s.handleStream(st, stream, s.traceInfo(st, stream))
420 fmt.Printf("grpc/server.go:Server.serverStream.$handleStream finished")
421 }()
422 })
423 wg.Wait()
424 }
497 func (s *Server) removeConn(c io.Closer) {
498 s.mu.Lock()
499 defer s.mu.Unlock()
500 if s.conns != nil {
501 delete(s.conns, c)
502 s.cv.Signal()
503 }
504 }
498 func (s *Server) removeConn(c io.Closer) {
499 s.mu.Lock()
500 defer s.mu.Unlock()
501 if s.conns != nil {
502 delete(s.conns, c)
503 c.Close()
504 fmt.Printf("grpc/server.go: Server.removeConn() finished \n")
505 s.cv.Signal()
506 }
507 }
144 func (ht *serverHandlerTransport) Close() error {
145 fmt.Printf("grpc/transport/handler_server.go:serverHandlerTransport.Close()")
146 ht.closeOnce.Do(ht.closeCloseChanOnce)
147 return nil
148 }
149
150 func (ht *serverHandlerTransport) closeCloseChanOnce() {
151 close(ht.closedCh)
152 }
More info is needed. How do you do per-connection book keeping on the server side in the first place? The only way I can think of to do per-connection book keeping on server side is to make a custom net.Listener. If you do this way, it is not hard to detect whether the connections accepted by this listener is closed by the client or not.
On Sun, Oct 2, 2016 at 11:13 PM, <vim...@gmail.com> wrote:
I am using grpc goi have an rpc which looks roughly like this
196 service MyService {
197 // Operation 1
198 rpc Operation1(OperationRequest) returns (OperationResponse) {
199 option (google.api.http) = {
200 post: "/apiver/myser/oper1"
201 body: "*"
202 };
203 }Client connects by using grpc.Dial() methodWhen a client connects, the server does some book keeping. when the client disconnects, the bookkeeping needs to be removed.is there any callback that can be registered which can be used to know the session is getting closed.Thanks,Regards,Vimal
--
You received this message because you are subscribed to the Google Groups "grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+u...@googlegroups.com.
To post to this group, send email to grp...@googlegroups.com.
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/3bfd5b3d-5468-4728-9e60-042e49552069%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--Thanks,-Qi
moreover, what can grpc applications do to read from this channel ?
Thanks,Vimal
--
You received this message because you are subscribed to the Google Groups "grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+unsubscribe@googlegroups.com.
To post to this group, send email to grp...@googlegroups.com.
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/82c3ba5b-f084-45f0-86a1-0e4e9d2dd8e4%40googlegroups.com.
moreover, what can grpc applications do to read from this channel ?I actually already provided a solution to you in my first reply. Does it work for you?
moreover, what can grpc applications do to read from this channel ?I actually already provided a solution to you in my first reply. Does it work for you?The solution you provided doesnt work for me. The key for book keeping is obtained from metadata.FromContext(ctx) which is set by grpc client.
i can trap net.Listener.Accept but that doesnt tell me about this metadata.So i need if grpc can tell when one connection is closed by client, and the associated context metadata, so that i can remove the entryregards,Vimal
--
You received this message because you are subscribed to the Google Groups "grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+unsubscribe@googlegroups.com.
To post to this group, send email to grp...@googlegroups.com.
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/d9112f90-befd-49d1-9958-81ea3a2a3077%40googlegroups.com.