//
// -- handle protocol
//
548074
func (message *Message) handle() error {
	Logf("MessageId: %d\nCommand: %d\n", message.MessageId, message.Command)

	protocolFunctions := map[int]func(*Message) error{
		CMD_PR:     handlePR,
		CMD_PR_ACK: sendPL,
		CMD_PR_NAK: cancelPR,
		CMD_PL:     handlePL,
		CMD_PL_ACK: sendRP,
		CMD_RP:     handleRP,
		CMD_RP_ACK: requestRRs,
		CMD_RP_NAK: concludePR,
		CMD_PR_OK:  finishPR,
	}

	if function, ok := protocolFunctions[message.Command]; ok {
		return function(message)
	}
	Logln("Protocol command not currently supported.")
	return nil
}
1191413
func (h HandlerFunc) Handle(ctx *Context, res *http.Response, err error) {
	h(ctx, res, err)
}
1362910
func (eh messageUpdateEventHandler) Handle(s *Session, i interface{}) {
	if t, ok := i.(*MessageUpdate); ok {
		eh(s, t)
	}
}
1256731
func Handle(route string, method string, httpHandler http.Handler) {
	mainServer.Handle(route, method, httpHandler)
}
86941
func (n *Node) Handle(method string, handler interface{}) {
	if n.GetHandler(method) != nil {
		panic(fmt.Errorf(`"%s" already defined`, n.getSegments()))
	}
	n.handlers[method] = handler
	n.allow = append(n.allow, method)
}
89344
func (r *Router) Handle(method, path string, mc MiddlewareChain, h Handler) {
	p := makeBasePath(r.BasePath, path)
	handle := r.adapt(mc, h, p)
	r.hrouter.Handle(method, p, handle)
}
253296
func (h *Handler) Handle(err error) {
	var interfaces []raven.Interface

	// Get HTTP request (if any)
	if req, ok := httperr.HTTPRequest(err); ok {
		interfaces = append(interfaces, raven.NewHttp(req))
	}

	packet := raven.NewPacketWithExtra(
		err.Error(),
		keyvals.ToMap(emperror.Context(err)),
		append(
			interfaces,
			raven.NewException(
				err,
				raven.GetOrNewStacktrace(emperror.ExposeStackTrace(err), 1, 3, h.client.IncludePaths()),
			),
		)...,
	)

	eventID, ch := h.client.Capture(packet, nil)

	if h.sendSynchronously && eventID != "" {
		<-ch
	}
}
701339
func (eh guildIntegrationsUpdateEventHandler) Handle(s *Session, i interface{}) {
	if t, ok := i.(*GuildIntegrationsUpdate); ok {
		eh(s, t)
	}
}
483494
func (eh voiceServerUpdateEventHandler) Handle(s *Session, i interface{}) {
	if t, ok := i.(*VoiceServerUpdate); ok {
		eh(s, t)
	}
}
45904
func (s *Server) Handle(route string, method string, httpHandler http.Handler) {
	s.addRoute(route, method, httpHandler)
}
217961
func (eh messageReactionRemoveAllEventHandler) Handle(s *Session, i interface{}) {
	if t, ok := i.(*MessageReactionRemoveAll); ok {
		eh(s, t)
	}
}
65804
func (g *routeGroup) Handle(method string, path string, h http.HandlerFunc) {
	g.handle(method, path, h)
}
1068471
func (eh guildEmojisUpdateEventHandler) Handle(s *Session, i interface{}) {
	if t, ok := i.(*GuildEmojisUpdate); ok {
		eh(s, t)
	}
}
841132
func (eh channelDeleteEventHandler) Handle(s *Session, i interface{}) {
	if t, ok := i.(*ChannelDelete); ok {
		eh(s, t)
	}
}
1090193
func (h *Handler) Handle(w http.ResponseWriter, r *http.Request) error {
	var newExpiryTime = 7 * helpers.OneDay

	certs, err := h.dbAccessor.GetRevokedAndUnexpiredCertificates()
	if err != nil {
		return err
	}

	queryExpiryTime := r.URL.Query().Get("expiry")
	if queryExpiryTime != "" {
		log.Infof("requested expiry time of %s", queryExpiryTime)
		newExpiryTime, err = time.ParseDuration(queryExpiryTime)
		if err != nil {
			return err
		}
	}

	result, err := crl.NewCRLFromDB(certs, h.ca, h.key, newExpiryTime)
	if err != nil {
		return err
	}

	return api.SendResponse(w, result)
}
758164
func (ctx *Context) Protocol() string {
	if ctx.Req.TLS != nil {
		return "https"
	}
	switch p := ctx.GetHeader(HeaderXForwardedProto); p {
	case "http", "https":
		return p
	default:
		return "http"
	}
}
1350124
func (eh resumedEventHandler) Handle(s *Session, i interface{}) {
	if t, ok := i.(*Resumed); ok {
		eh(s, t)
	}
}