removed old broadcast implementation

pull/5/head
Jordan Orelli 10 years ago
parent 731e9be13c
commit 47a54c939b

@ -193,5 +193,6 @@ func init() {
registerCommand(nearbyCommand)
registerCommand(scanCommand)
registerCommand(gotoCommand)
registerCommand(broadcastCommand)
// registerCommand(bombCommand)
}

@ -70,24 +70,6 @@ func handleConnection(conn *Connection) {
}
switch parts[0] {
case "broadcast":
msg := strings.Join(parts[1:], " ")
log_info("player %s is broadcasting message %s", conn.PlayerName(), msg)
for _, otherSystem := range index {
if otherSystem.name == system.name {
log_info("skpping duplicate system %s", system.name)
continue
}
go func(s *System) {
log_info("message reached system %s with %d inhabitants", s.name, s.NumInhabitants())
dist := system.DistanceTo(s) * 0.5
delay := time.Duration(int64(dist * 100000000))
time.Sleep(delay)
s.EachConn(func(conn *Connection) {
fmt.Fprintln(conn, msg)
})
}(otherSystem)
}
case "quit":
return
default:

@ -56,7 +56,7 @@ func RunQueue() {
heap.Init(&queue)
for {
if len(queue) == 0 {
time.Sleep(100 * time.Microsecond)
time.Sleep(10 * time.Microsecond)
continue
}
future, ok := heap.Pop(&queue).(*Future)
@ -64,7 +64,6 @@ func RunQueue() {
log_error("there's shit on the work heap")
continue
}
log_info("we have a work item with delay %v", time.Since(future.ts))
if future.ts.After(time.Now()) {
time.Sleep(future.ts.Sub(time.Now()))
}

Loading…
Cancel
Save