summaryrefslogtreecommitdiffstats
path: root/plugin/rpcplugin/hooks.go
diff options
context:
space:
mode:
authorMartin Kraft <martinkraft@gmail.com>2018-05-02 07:45:20 -0400
committerMartin Kraft <martinkraft@gmail.com>2018-05-02 07:45:20 -0400
commit7d5e85e4136b0e2e6cf902c48b186d99f0698d13 (patch)
tree84f7256de28eed0fd932f43532c218b385e09642 /plugin/rpcplugin/hooks.go
parentf4dcb4edf2aafca85c9af631131a77888da24bc7 (diff)
parent529807c1ba0c6b5e697d95d35b46865e22b0e62a (diff)
downloadchat-7d5e85e4136b0e2e6cf902c48b186d99f0698d13.tar.gz
chat-7d5e85e4136b0e2e6cf902c48b186d99f0698d13.tar.bz2
chat-7d5e85e4136b0e2e6cf902c48b186d99f0698d13.zip
Merge remote-tracking branch 'origin/master' into advanced-permissions-phase-2
Diffstat (limited to 'plugin/rpcplugin/hooks.go')
-rw-r--r--plugin/rpcplugin/hooks.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/plugin/rpcplugin/hooks.go b/plugin/rpcplugin/hooks.go
index 7b44d0de7..90734fd1c 100644
--- a/plugin/rpcplugin/hooks.go
+++ b/plugin/rpcplugin/hooks.go
@@ -11,6 +11,7 @@ import (
"net/rpc"
"reflect"
+ "github.com/mattermost/mattermost-server/mlog"
"github.com/mattermost/mattermost-server/model"
"github.com/mattermost/mattermost-server/plugin"
)
@@ -165,6 +166,7 @@ type RemoteHooks struct {
muxer *Muxer
apiCloser io.Closer
implemented [maxRemoteHookCount]bool
+ pluginId string
}
var _ plugin.Hooks = (*RemoteHooks)(nil)
@@ -237,6 +239,7 @@ func (h *RemoteHooks) ServeHTTP(w http.ResponseWriter, r *http.Request) {
Request: forwardedRequest,
RequestBodyStream: requestBodyStream,
}, nil); err != nil {
+ mlog.Error("Plugin failed to ServeHTTP", mlog.String("plugin_id", h.pluginId), mlog.Err(err))
http.Error(w, "500 internal server error", http.StatusInternalServerError)
}
}
@@ -260,10 +263,11 @@ func (h *RemoteHooks) Close() error {
return h.client.Close()
}
-func ConnectHooks(conn io.ReadWriteCloser, muxer *Muxer) (*RemoteHooks, error) {
+func ConnectHooks(conn io.ReadWriteCloser, muxer *Muxer, pluginId string) (*RemoteHooks, error) {
remote := &RemoteHooks{
- client: rpc.NewClient(conn),
- muxer: muxer,
+ client: rpc.NewClient(conn),
+ muxer: muxer,
+ pluginId: pluginId,
}
implemented, err := remote.Implemented()
if err != nil {