Changeset 2341793


Ignore:
Timestamp:
Sep 6, 2009 12:43:45 AM (11 years ago)
Author:
BlubMail <BlubMail@…>
Branches:
master
Children:
5eccc01
Parents:
1f1d089
Message:

writeString(String str): synchronize using socket write lock to prevent split SAM messages

File:
1 edited

Legend:

Unmodified
Added
Removed
  • apps/sam/java/src/net/i2p/sam/SAMHandler.java

    r1f1d089 r2341793  
    103103   
    104104    static public void writeBytes(ByteBuffer data, SocketChannel out) throws IOException {
    105         while (data.hasRemaining()) out.write(data);           
    106         out.socket().getOutputStream().flush();
     105        while (data.hasRemaining()) out.write(data);           
     106        out.socket().getOutputStream().flush();
    107107    }
    108108   
     
    125125     */
    126126    protected final boolean writeString(String str) {
     127        boolean success;
    127128        if (_log.shouldLog(Log.DEBUG))
    128129            _log.debug("Sending the client: [" + str + "]");
    129         return writeString(str, socket);
     130        synchronized (socketWLock) {
     131            success = writeString(str, socket);
     132        }
     133        return success;
    130134    }
    131135
Note: See TracChangeset for help on using the changeset viewer.