Skip to content

Commit

Permalink
coding style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Jackneill committed Jul 14, 2013
1 parent 1c1cdf7 commit bb105be
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions socket.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
package main

import (
"io"
"fmt"
"io"
"net"
"strconv"
"strings"
Expand All @@ -45,18 +45,18 @@ const (
)

var conn net.Conn
var isconnected bool
var isConnected bool

func connectToSocket(host string) {
fmt.Print("[SOCKET] Connecting to ", host, "...\n")
var err error
conn, err = net.Dial("tcp", host)
if err != nil {
isconnected = false
isConnected = false
fmt.Println(err)
fmt.Println("[SOCKET] Fail.")
} else {
isconnected = true
isConnected = true
fmt.Print("[SOCKET] Done. ")
go regConnection()
listenToSocket()
Expand All @@ -67,7 +67,7 @@ func listenToSocket() {
fmt.Printf("Listening...\n")
buffer := make([]byte, MAX_BUFFER_SIZE)
for {
if !isconnected || shutdown {
if !isConnected || shutdown {
break
}

Expand All @@ -89,7 +89,7 @@ func handlePacket(data string, size int) {
packet := strings.Split(data, PACKET_SEPARATOR)

if packet[0] == "" {
fmt.Print("Null packet.")
fmt.Print("Empty packet.")
return
}

Expand All @@ -100,10 +100,10 @@ func handlePacket(data string, size int) {
case SMSG_AUTH_APPROVED:
fmt.Print("Auth request approved.")
case SMSG_AUTH_DENIED:
isconnected = false
isConnected = false
fmt.Print("Auth request denied.")
case SMSG_CLOSE_CONNECTION:
isconnected = false
isConnected = false
fmt.Print("Server sent closing signal. Connection closed.")
conn.Close()
case SMSG_PING:
Expand All @@ -122,7 +122,7 @@ func handlePacket(data string, size int) {
}

func shutdownSocket() {
if isconnected {
if isConnected {
fmt.Println("Shutting down socket connection...")
sendCloseSignal()
conn.Close()
Expand Down

0 comments on commit bb105be

Please sign in to comment.