Commits

Yaron Minsky committed 4e86c40

more and better debugging info

Comments (0)

Files changed (1)

     Tcp.Server.create
       ~on_handler_error:`Raise
       (Tcp.on_port port)
-      (fun _addr r w ->
+      (fun addr r w ->
          Reader.read_line r
          >>= function
            | `Eof -> Deferred.unit
            | `Ok pname ->
-             Log.debug "user logon %s" pname;
+             Log.debug "user logon %s, %s" pname (Socket.Address.Inet.to_string addr);
              let pname = Player_name.of_string pname in
              state := State.register_player !state pname;
              let rec loop () =
                Reader.read_line r >>= function
                  | `Eof -> Deferred.unit
                  | `Ok line ->
-                   Log.debug "line: %s" line;
+                   Log.debug "(%s) line: %s" (Player_name.to_string pname) line;
                    begin match Action.of_line line with
                    | Error e ->
                      let u = Update.of_error e in
              in
              loop ()
              >>| fun () ->
-             Log.debug "Client disconnected"
+             Log.debug "Client %s disconnected" (Socket.Address.Inet.to_string addr)
       )
   in
   ignore (host_and_port : (Socket.Address.Inet.t, int) Tcp.Server.t Deferred.t);