// Handle handles an incoming TChannel call and forwards it to the correct handler. func (s *Server) Handle(ctx context.Context, call *tchannel.InboundCall) { parts := strings.Split(string(call.Operation()), "::") if len(parts) != 2 { log.Fatalf("Handle got call for %v which does not match the expected call format", parts) } service, method := parts[0], parts[1] s.mut.RLock() handler, ok := s.handlers[service] s.mut.RUnlock() if !ok { log.Fatalf("Handle got call for service %v which is not registered", service) } if err := s.handle(ctx, handler, method, call); err != nil { s.onError(err) } }