Commit 2f745cb5 authored by OptimismBot's avatar OptimismBot Committed by GitHub

Merge pull request #6853 from Flocqst/op-service/http-util-cleanup

Op service : http util cleanup
parents 65fe9cf9 8538d0b6
......@@ -18,8 +18,8 @@ import (
"sync"
"time"
ophttp "github.com/ethereum-optimism/optimism/op-node/http"
"github.com/ethereum-optimism/optimism/op-service/eth"
ophttp "github.com/ethereum-optimism/optimism/op-service/httputil"
"github.com/ethereum/go-ethereum/log"
)
......
......@@ -10,8 +10,8 @@ import (
"strconv"
"time"
ophttp "github.com/ethereum-optimism/optimism/op-node/http"
"github.com/ethereum-optimism/optimism/op-node/p2p/store"
ophttp "github.com/ethereum-optimism/optimism/op-service/httputil"
"github.com/ethereum-optimism/optimism/op-service/metrics"
pb "github.com/libp2p/go-libp2p-pubsub/pb"
......
......@@ -7,7 +7,7 @@ import (
"net/http"
"strconv"
ophttp "github.com/ethereum-optimism/optimism/op-node/http"
ophttp "github.com/ethereum-optimism/optimism/op-service/httputil"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/rpc"
......
package http
package httputil
import (
"net/http"
......
......@@ -3,9 +3,7 @@ package httputil
import (
"context"
"errors"
"fmt"
"net/http"
"time"
)
func ListenAndServeContext(ctx context.Context, server *http.Server) error {
......@@ -14,15 +12,6 @@ func ListenAndServeContext(ctx context.Context, server *http.Server) error {
errCh <- server.ListenAndServe()
}()
// verify that the server comes up
tick := time.NewTimer(10 * time.Millisecond)
select {
case err := <-errCh:
return fmt.Errorf("http server failed: %w", err)
case <-tick.C:
break
}
select {
case err := <-errCh:
if errors.Is(err, http.ErrServerClosed) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment