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 ( ...@@ -18,8 +18,8 @@ import (
"sync" "sync"
"time" "time"
ophttp "github.com/ethereum-optimism/optimism/op-node/http"
"github.com/ethereum-optimism/optimism/op-service/eth" "github.com/ethereum-optimism/optimism/op-service/eth"
ophttp "github.com/ethereum-optimism/optimism/op-service/httputil"
"github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/log"
) )
......
...@@ -10,8 +10,8 @@ import ( ...@@ -10,8 +10,8 @@ import (
"strconv" "strconv"
"time" "time"
ophttp "github.com/ethereum-optimism/optimism/op-node/http"
"github.com/ethereum-optimism/optimism/op-node/p2p/store" "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" "github.com/ethereum-optimism/optimism/op-service/metrics"
pb "github.com/libp2p/go-libp2p-pubsub/pb" pb "github.com/libp2p/go-libp2p-pubsub/pb"
......
...@@ -7,7 +7,7 @@ import ( ...@@ -7,7 +7,7 @@ import (
"net/http" "net/http"
"strconv" "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/log"
"github.com/ethereum/go-ethereum/node" "github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/rpc" "github.com/ethereum/go-ethereum/rpc"
......
package http package httputil
import ( import (
"net/http" "net/http"
......
...@@ -3,9 +3,7 @@ package httputil ...@@ -3,9 +3,7 @@ package httputil
import ( import (
"context" "context"
"errors" "errors"
"fmt"
"net/http" "net/http"
"time"
) )
func ListenAndServeContext(ctx context.Context, server *http.Server) error { func ListenAndServeContext(ctx context.Context, server *http.Server) error {
...@@ -14,15 +12,6 @@ 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() 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 { select {
case err := <-errCh: case err := <-errCh:
if errors.Is(err, http.ErrServerClosed) { 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