[ https://issues.apache.org/jira/browse/DIRMINA-1123?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17084172#comment-17084172 ]
Marcin L edited comment on DIRMINA-1123 at 4/15/20, 5:00 PM: ------------------------------------------------------------- ??In NioSocketAcceptor the SessionConfig is inherited by the NioSocketSession at config.setAll(service.getSessionConfig()); line 61.?? Looked more at the code and this is exactly the problem. When you get to this point the the connection with the client has been already established and window scale was advertised by both parties. Even though the server socket is not used for the communication as you mentioned in the previous comment, the receive buffer must be set so when client attempts to connect and server socket creates new client socket it needs to know this size. This is definitely a bug. Similar thing with simple server socket. You need to tell the server socket what WS to advertise. {{ServerSocket serverSocket = new ServerSocket();}} {{// this needs to go here no matter what}} {{serverSocket.setReceiveBufferSize(65535 * 10);}} {{serverSocket.bind(new InetSocketAddress(InetAddress.getByName("localhost"), 12345));}} {{Socket clientSocket = serverSocket.accept();}} {{// TCP handshake already done here, setting it here will not help ( you can resize it up to 64kb * <window_scale>}} was (Author: the-thing): ??In NioSocketAcceptor the SessionConfig is inherited by the NioSocketSession at config.setAll(service.getSessionConfig()); line 61.?? Looked more at the code and this is exactly the problem. When you get to this point the the connection with the client has been already established and window scale was advertised by both parties. Even though the server socket is not used for the communication as you mentioned in the previous comment, the receive buffer must be set so when client attempts to connect and server socket creates new client socket it needs to know this size. This is definitely a bug. Similar thing with simple server socket. You need to tell the server socket what WS to advertise. {{ServerSocket serverSocket = new ServerSocket();}} {{// this needs to go here no matter what}} {{serverSocket.setReceiveBufferSize(65535 * 10);}} {{serverSocket.bind(new InetSocketAddress(InetAddress.getByName("localhost"), 12345));}} {{Socket clientSocket = serverSocket.accept();}} {{// TCP handshake already done here, setting it here will not help}} > Receive buffer size is never set for NIO acceptor > ------------------------------------------------- > > Key: DIRMINA-1123 > URL: https://issues.apache.org/jira/browse/DIRMINA-1123 > Project: MINA > Issue Type: Bug > Components: Transport > Affects Versions: 2.0.22, 2.1.3 > Reporter: Marcin L > Assignee: Jonathan Valliere > Priority: Minor > Attachments: case dumps.png, case1.pcap, case2.pcap, case3.pcap > > > Acceptor window size can't be increased beyond OS defaults. > It seems the receive buffer size is properly set for > org.apache.mina.transport.socket.nio.NioSocketConnector, but it is not set at > all forĀ org.apache.mina.transport.socket.nio.NioSocketAcceptor before socket > is bound. > org.apache.mina.core.polling.AbstractPollingIoAcceptor.Acceptor#registerHandles > comment states that receive buffer size should be initialised, but thenĀ > org.apache.mina.transport.socket.nio.NioSocketAcceptor#open does not do it., -- This message was sent by Atlassian Jira (v8.3.4#803005) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org For additional commands, e-mail: dev-h...@mina.apache.org