home · contact · privacy
Server/py: Fix out file writing bug.
authorChristian Heller <c.heller@plomlompom.de>
Tue, 3 Mar 2015 00:37:57 +0000 (01:37 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Tue, 3 Mar 2015 00:37:57 +0000 (01:37 +0100)
plomrogue-server.py

index b921f4baa0ee9c6e8c3a122270f65ab718dfe73d..d6c1930da2613a88c98e844b830b861c9fd2c482 100755 (executable)
@@ -270,7 +270,9 @@ def try_worldstate_update():
             string = string + line + "\n"
         # TODO: no proper user-subjective map
         atomic_write(io_db["path_worldstate"], string)
             string = string + line + "\n"
         # TODO: no proper user-subjective map
         atomic_write(io_db["path_worldstate"], string)
-        atomic_write(io_db["path_out"], "WORLD_UPDATED\n", do_append=True)
+        io_db["file_out"].write("WORLD_UPDATED\n")
+        io_db["file_out"].flush()
+        os.fsync(io_db["file_out"])
         io_db["worldstate_updateable"] = False
 
 
         io_db["worldstate_updateable"] = False
 
 
@@ -416,6 +418,7 @@ def command_ping():
     """Send PONG line to server output file."""
     io_db["file_out"].write("PONG\n")
     io_db["file_out"].flush()
     """Send PONG line to server output file."""
     io_db["file_out"].write("PONG\n")
     io_db["file_out"].flush()
+    os.fsync(io_db["file_out"].fileno())
 
 
 def command_quit():
 
 
 def command_quit():