Skip to content

Commit

Permalink
Fixed fork rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
momoshell authored and 0xSasaPrsic committed Dec 3, 2021
1 parent f3bc0ac commit 4e6bcd4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
3 changes: 2 additions & 1 deletion bridge/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ func StartBridgeWithCtx(shutdownCtx context.Context) error {
// Start http client
err := _httpClient.Start()
if err != nil {
panic(fmt.Sprintf("Error connecting to server %v", err))
logger.Error("Error connecting to server: %v", err)
return err
}

// cli context
Expand Down
14 changes: 5 additions & 9 deletions server/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,6 @@ import (

const shutdownTimeout = 10 * time.Second

type options struct {
listenAddr string
maxOpen int
readTimeout uint
writeTimeout uint
}

func StartRestServer(mainCtx ctx.Context, cdc *codec.Codec, registerRoutesFn func(ctx client.CLIContext, mux *mux.Router), restCh chan struct{}) error {
// init vars for the Light Client Rest server
cliCtx := context.NewCLIContext().WithCodec(cdc)
Expand All @@ -61,7 +54,7 @@ func StartRestServer(mainCtx ctx.Context, cdc *codec.Codec, registerRoutesFn fun
// and returns with the details we use to proxy orders to that socket
listener, err := rpcserver.Listen(listenAddr, cfg)
if err != nil {
// TODO: log here
logger.Error("RPC could not listen: %v", err)
return err
}
// no err? -> signal here that server is open for business
Expand Down Expand Up @@ -110,7 +103,10 @@ func (h maxBytesHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
func recoverAndLog(handler http.Handler, logger tmLog.Logger) func(w http.ResponseWriter, r *http.Request) {
return func(w http.ResponseWriter, r *http.Request) {
// Wrap the ResponseWriter to remember the status
rww := &rpcserver.ResponseWriterWrapper{-1, w}
rww := &rpcserver.ResponseWriterWrapper{
Status: -1,
ResponseWriter: w,
}
begin := time.Now()

rww.Header().Set("X-Server-Time", fmt.Sprintf("%v", begin.Unix()))
Expand Down

0 comments on commit 4e6bcd4

Please sign in to comment.