2
0
mirror of https://github.com/soheilhy/cmux.git synced 2024-09-20 11:05:48 +08:00

log.Fatal -> panic

This commit is contained in:
Tamir Duberstein 2016-01-07 10:20:03 -05:00
parent 6c8efedfa1
commit 992f073bb6
4 changed files with 6 additions and 9 deletions

View File

@ -11,7 +11,7 @@ and then match connections:
// Create the main listener. // Create the main listener.
l, err := net.Listen("tcp", ":23456") l, err := net.Listen("tcp", ":23456")
if err != nil { if err != nil {
log.Fatal(err) panic(err)
} }
// Create a cmux. // Create a cmux.

View File

@ -4,7 +4,6 @@ import (
"crypto/rand" "crypto/rand"
"crypto/tls" "crypto/tls"
"fmt" "fmt"
"log"
"net" "net"
"net/http" "net/http"
"net/rpc" "net/rpc"
@ -31,7 +30,7 @@ func tlsListener(l net.Listener) net.Listener {
// Load certificates. // Load certificates.
certificate, err := tls.LoadX509KeyPair("cert.pem", "key.pem") certificate, err := tls.LoadX509KeyPair("cert.pem", "key.pem")
if err != nil { if err != nil {
log.Fatal(err) panic(err)
} }
config := &tls.Config{ config := &tls.Config{
@ -62,7 +61,7 @@ func Example_recursiveCmux() {
// Create the TCP listener. // Create the TCP listener.
l, err := net.Listen("tcp", "127.0.0.1:50051") l, err := net.Listen("tcp", "127.0.0.1:50051")
if err != nil { if err != nil {
log.Fatal(err) panic(err)
} }
// Create a mux. // Create a mux.

View File

@ -3,7 +3,6 @@ package cmux_test
import ( import (
"fmt" "fmt"
"io" "io"
"log"
"net" "net"
"net/http" "net/http"
"net/rpc" "net/rpc"
@ -71,7 +70,7 @@ func serveGRPC(l net.Listener) {
func Example() { func Example() {
l, err := net.Listen("tcp", "127.0.0.1:50051") l, err := net.Listen("tcp", "127.0.0.1:50051")
if err != nil { if err != nil {
log.Fatal(err) panic(err)
} }
m := cmux.New(l) m := cmux.New(l)

View File

@ -4,7 +4,6 @@ import (
"crypto/rand" "crypto/rand"
"crypto/tls" "crypto/tls"
"fmt" "fmt"
"log"
"net" "net"
"net/http" "net/http"
@ -28,7 +27,7 @@ func serveHTTPS(l net.Listener) {
// Load certificates. // Load certificates.
certificate, err := tls.LoadX509KeyPair("cert.pem", "key.pem") certificate, err := tls.LoadX509KeyPair("cert.pem", "key.pem")
if err != nil { if err != nil {
log.Fatal(err) panic(err)
} }
config := &tls.Config{ config := &tls.Config{
@ -48,7 +47,7 @@ func Example_bothHTTPAndHTTPS() {
// Create the TCP listener. // Create the TCP listener.
l, err := net.Listen("tcp", "127.0.0.1:50051") l, err := net.Listen("tcp", "127.0.0.1:50051")
if err != nil { if err != nil {
log.Fatal(err) panic(err)
} }
// Create a mux. // Create a mux.