Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Unified Diff: third_party/mojo/src/mojo/public/go/bindings/router.go

Issue 1127293003: Update mojo sdk to rev f84766d3b6420b7cf6a113d9d65d73cb5fe18d90 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: formatting Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/mojo/src/mojo/public/go/bindings/router.go
diff --git a/third_party/mojo/src/mojo/public/go/bindings/router.go b/third_party/mojo/src/mojo/public/go/bindings/router.go
index 64849455103ac7b01c67330967999dbdda219886..1e8daba6e36eef78ca4fbcd226854b02499d1b21 100644
--- a/third_party/mojo/src/mojo/public/go/bindings/router.go
+++ b/third_party/mojo/src/mojo/public/go/bindings/router.go
@@ -59,7 +59,7 @@ func (w *routerWorker) readAndDispatchOutstandingMessages() error {
return nil
}
if result != system.MOJO_RESULT_OK {
- return fmt.Errorf("error reading message: %v", result)
+ return &ConnectionError{result}
}
message, err := ParseMessage(bytes, handles)
if err != nil {
@@ -88,7 +88,7 @@ func (w *routerWorker) runLoop() error {
case waitResponse := <-w.waitChan:
w.waitId = 0
if waitResponse.Result != system.MOJO_RESULT_OK {
- return fmt.Errorf("error waiting for message: %v", waitResponse.Result)
+ return &ConnectionError{waitResponse.Result}
}
case request := <-w.requestChan:
if err := WriteMessage(w.handle, request.message); err != nil {
@@ -98,7 +98,7 @@ func (w *routerWorker) runLoop() error {
w.responders[request.message.Header.RequestId] = request.responseChan
}
case <-w.done:
- return fmt.Errorf("message pipe is closed")
+ return errConnectionClosed
}
// Returns immediately without an error if still waiting for
// a new message.
@@ -164,9 +164,8 @@ func (r *Router) Accept(message *Message) error {
}
r.mu.Lock()
defer r.mu.Unlock()
- // This can also mean that the router is closed.
if !r.handle.IsValid() {
- return fmt.Errorf("can't write a message to an invalid handle")
+ return errConnectionClosed
}
r.requestChan <- routeRequest{message, nil}
return nil
@@ -221,7 +220,7 @@ func (r *Router) AcceptWithResponse(message *Message) <-chan MessageReadResult {
// is closed so that we can safely close responseChan once we close the
// router.
if !r.handle.IsValid() {
- responseChan <- MessageReadResult{nil, fmt.Errorf("can't write a message to an invalid handle")}
+ responseChan <- MessageReadResult{nil, errConnectionClosed}
return responseChan
}
r.requestChan <- routeRequest{message, responseChan}
« no previous file with comments | « third_party/mojo/src/mojo/public/go/bindings/message.go ('k') | third_party/mojo/src/mojo/public/go/bindings/util.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698