tcp-server 1.0.1-java → 1.0.2-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +48 -4
- data/lib/server/channel_initializer.rb +5 -9
- data/lib/server/modular_handler.rb +1 -1
- data/lib/server/shutdown_hook.rb +1 -1
- data/lib/server/version.rb +1 -1
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 9b184708a43ed78e29a2668c85b546b34120f0358f6224bc6bf8c7895dbb1eb6
         | 
| 4 | 
            +
              data.tar.gz: 176d29aab7223469f089f54d2f0d90e3dcec2bda8fd5dbe054af90783a619138
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 417b281f16bfd53faf2be531c23c22e98c2e3ed92b64cb393f6d51d98d3d8ec2c895336aae7b87fa7fcd500fa3eaa279804e0ab1e8415aa3b547ab8fd35b6859
         | 
| 7 | 
            +
              data.tar.gz: 49855312f85969ed83a8d254b500f73b01c5448948bd75dab6e337aad0582104359cd366ad03be4d74e33faaccb26fff094e64bab81338a7ec4a4a43da7cf805
         | 
    
        data/README.md
    CHANGED
    
    | @@ -2,7 +2,7 @@ | |
| 2 2 |  | 
| 3 3 | 
             
            [][license]
         | 
| 4 4 |  | 
| 5 | 
            -
            This is a small tcp server for [JRuby].
         | 
| 5 | 
            +
            This is a small tcp server for [JRuby] available as a [ruby gem](https://rubygems.org/gems/tcp-server).
         | 
| 6 6 |  | 
| 7 7 | 
             
            It is based on the [Netty project].  Netty is written in java, but I wanted to write ruby.
         | 
| 8 8 |  | 
| @@ -14,7 +14,7 @@ Follow these instructions to get a tcp server echo program running. | |
| 14 14 |  | 
| 15 15 | 
             
            ### Docker
         | 
| 16 16 |  | 
| 17 | 
            -
            You may run the websocket server in a container.
         | 
| 17 | 
            +
            You may run the websocket server in a container. The [`colima`](https://github.com/abiosoft/colima) for a container runtime is recommended.
         | 
| 18 18 |  | 
| 19 19 | 
             
            ```sh
         | 
| 20 20 | 
             
            colima start
         | 
| @@ -24,7 +24,7 @@ docker-compose up | |
| 24 24 | 
             
            Building the image or running the container:
         | 
| 25 25 |  | 
| 26 26 | 
             
            ```sh
         | 
| 27 | 
            -
            docker build -- | 
| 27 | 
            +
            docker build --tag tcp-server-jruby .
         | 
| 28 28 | 
             
            docker run --detach --publish 4000:4000 --name tcp-server-jruby tcp-server-jruby
         | 
| 29 29 | 
             
            ```
         | 
| 30 30 |  | 
| @@ -76,7 +76,7 @@ bundle install | |
| 76 76 | 
             
            The entrypoint for the web application service may now be invoked from a command line interface terminal shell.
         | 
| 77 77 |  | 
| 78 78 | 
             
            ```sh
         | 
| 79 | 
            -
            bundle exec ./ | 
| 79 | 
            +
            bundle exec ./tcp_server.rb
         | 
| 80 80 | 
             
            ```
         | 
| 81 81 |  | 
| 82 82 |  | 
| @@ -114,6 +114,50 @@ Here is a bird's-eye view of the project layout. | |
| 114 114 |  | 
| 115 115 | 
             
            ```sh
         | 
| 116 116 | 
             
            # date && tree
         | 
| 117 | 
            +
            Wed May  4 22:41:11 CDT 2022
         | 
| 118 | 
            +
            .
         | 
| 119 | 
            +
            ├── Dockerfile
         | 
| 120 | 
            +
            ├── Gemfile
         | 
| 121 | 
            +
            ├── Gemfile.lock
         | 
| 122 | 
            +
            ├── LICENSE
         | 
| 123 | 
            +
            ├── README.md
         | 
| 124 | 
            +
            ├── Rakefile
         | 
| 125 | 
            +
            ├── docker-compose.yaml
         | 
| 126 | 
            +
            ├── exe
         | 
| 127 | 
            +
            │   └── tcp_server
         | 
| 128 | 
            +
            ├── lib
         | 
| 129 | 
            +
            │   ├── client.rb
         | 
| 130 | 
            +
            │   ├── log.rb
         | 
| 131 | 
            +
            │   ├── server
         | 
| 132 | 
            +
            │   │   ├── argument_parser.rb
         | 
| 133 | 
            +
            │   │   ├── channel_initializer.rb
         | 
| 134 | 
            +
            │   │   ├── config.rb
         | 
| 135 | 
            +
            │   │   ├── instance_methods.rb
         | 
| 136 | 
            +
            │   │   ├── listenable.rb
         | 
| 137 | 
            +
            │   │   ├── message_handler.rb
         | 
| 138 | 
            +
            │   │   ├── modular_handler.rb
         | 
| 139 | 
            +
            │   │   ├── server.rb
         | 
| 140 | 
            +
            │   │   ├── shutdown_hook.rb
         | 
| 141 | 
            +
            │   │   └── version.rb
         | 
| 142 | 
            +
            │   └── server.rb
         | 
| 143 | 
            +
            ├── logs
         | 
| 144 | 
            +
            ├── spec
         | 
| 145 | 
            +
            │   ├── spec_helper.rb
         | 
| 146 | 
            +
            │   ├── test_spec.rb
         | 
| 147 | 
            +
            │   └── verify
         | 
| 148 | 
            +
            │       └── verify_spec.rb
         | 
| 149 | 
            +
            ├── tcp-server-jruby.gemspec
         | 
| 150 | 
            +
            └── tcp_server.rb
         | 
| 151 | 
            +
             | 
| 152 | 
            +
            6 directories, 26 files
         | 
| 153 | 
            +
            ```
         | 
| 154 | 
            +
             | 
| 155 | 
            +
            ## CI linting
         | 
| 156 | 
            +
             | 
| 157 | 
            +
            Use the GitLab CI Linting API to validate the syntax of a CI definition file.
         | 
| 158 | 
            +
             | 
| 159 | 
            +
            ```sh
         | 
| 160 | 
            +
            jq --null-input --arg yaml "$(<.gitlab/ci/gem.gitlab-ci.yml)" '.content=$yaml' | curl --silent --location https://gitlab.com/api/v4/ci/lint --header "PRIVATE-TOKEN: ${GITLAB_COM_API_PRIVATE_TOKEN}" --header "Content-Type: application/json" --data @- | jq --raw-output '.errors[0]'
         | 
| 117 161 | 
             
            ```
         | 
| 118 162 |  | 
| 119 163 | 
             
            [license]: https://gitlab.com/nelsnelson/tcp-server-jruby/blob/master/LICENSE
         | 
| @@ -93,23 +93,19 @@ module Server | |
| 93 93 |  | 
| 94 94 | 
             
                def ssl_handler(channel)
         | 
| 95 95 | 
             
                  handler = ssl_handler_instance(channel)
         | 
| 96 | 
            -
                  handler.handshake_future.addListener( | 
| 96 | 
            +
                  handler.handshake_future.addListener(ssl_handshake_future_listener)
         | 
| 97 97 | 
             
                  handler
         | 
| 98 98 | 
             
                end
         | 
| 99 99 |  | 
| 100 | 
            -
                 | 
| 101 | 
            -
             | 
| 102 | 
            -
                  include FutureListener
         | 
| 103 | 
            -
                  # @Override
         | 
| 104 | 
            -
                  #
         | 
| 105 | 
            -
                  # public void operationComplete(Future<Channel> future) throws Exception
         | 
| 106 | 
            -
                  def operationComplete(future)
         | 
| 100 | 
            +
                def ssl_handshake_future_listener(listener = Object.new.extend(FutureListener))
         | 
| 101 | 
            +
                  listener.define_singleton_method(:operationComplete) do |future|
         | 
| 107 102 | 
             
                    raise future.cause unless future.success?
         | 
| 108 103 | 
             
                    session = future.now.pipeline.get('SslHandler#0')&.engine&.session
         | 
| 109 104 | 
             
                    ::Server.log.info "Channel protocol: #{session.protocol}, cipher suite: #{session.cipher_suite}"
         | 
| 110 105 | 
             
                  rescue StandardError => e
         | 
| 111 | 
            -
                    ::Server.log.warn e.message
         | 
| 106 | 
            +
                    ::Server.log.warn "Error handling operation complete event: #{e.message}"
         | 
| 112 107 | 
             
                  end
         | 
| 108 | 
            +
                  listener
         | 
| 113 109 | 
             
                end
         | 
| 114 110 |  | 
| 115 111 | 
             
                def ssl_engine(ssl_ctx)
         | 
| @@ -104,7 +104,7 @@ module Server | |
| 104 104 | 
             
                  ::Server.log.warn "##{__method__} channel: #{ctx.channel}, cause: #{cause.message}"
         | 
| 105 105 | 
             
                  cause.backtrace.each { |t| ::Server.log.error t }
         | 
| 106 106 | 
             
                  listeners = notify :exception_caught, ctx, cause
         | 
| 107 | 
            -
                  super(ctx, cause) if listeners.empty?
         | 
| 107 | 
            +
                  super(ctx, cause) if listeners.nil? || listeners.empty?
         | 
| 108 108 | 
             
                end
         | 
| 109 109 |  | 
| 110 110 | 
             
                IdentiferTemplate = '#<%<class>s:0x%<id>s>'.freeze
         | 
    
        data/lib/server/shutdown_hook.rb
    CHANGED
    
    
    
        data/lib/server/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: tcp-server
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1.0. | 
| 4 | 
            +
              version: 1.0.2
         | 
| 5 5 | 
             
            platform: java
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Nels Nelson
         | 
| 8 8 | 
             
            autorequire:
         | 
| 9 9 | 
             
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2022- | 
| 11 | 
            +
            date: 2022-05-22 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              requirement: !ruby/object:Gem::Requirement
         |