Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into sync_fork_for_rub…
Browse files Browse the repository at this point in the history
…y_3_3
  • Loading branch information
ttstarck committed Jan 19, 2025
2 parents 8be4ef0 + e732041 commit c5aff56
Show file tree
Hide file tree
Showing 140 changed files with 6,556 additions and 2,228 deletions.
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true

[*.{cpp,h}]
indent_style = tab
indent_size = 4
trim_trailing_whitespace = true

[*.rb]
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
116 changes: 116 additions & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
name: CI

on: [ push, pull_request, workflow_dispatch ]

jobs:
build:
name: >-
${{ matrix.os }} ${{ matrix.ruby }}
runs-on: ${{ matrix.os }}
timeout-minutes: ${{ (startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'windows')) && 15 || 10 }}
env:
BUNDLE_WITHOUT: documentation
strategy:
fail-fast: false
matrix:
os:
- ubuntu-20.04
- ubuntu-22.04
- ubuntu-24.04
- macos-13 # amd64
- macos-14 # arm64
- windows-2022

# We currently support four EOL versions of ruby, but only on linux
# versions that were released before that version of ruby went EOL.
ruby: [ '2.5', '2.6', '2.7', '3.0', '3.1', '3.2', '3.3', head ]

include:
- { os: windows-2022, ruby: ucrt } # used instead of "head"
exclude:
- { os: windows-2022, ruby: head } # uses "ucrt" instead

# Ubuntu 20.04 was released just prior to ruby 2.4's EOL
# (no exclusions)

# Ubuntu 22.04 was released just prior to ruby 2.6's EOL
- { os: ubuntu-22.04, ruby: '2.5' }

# Ubuntu 24.04 was released just prior to ruby 3.0's EOL
- { os: ubuntu-24.04, ruby: '2.5' }
- { os: ubuntu-24.04, ruby: '2.6' }
- { os: ubuntu-24.04, ruby: '2.7' }

# No EOL versions for macos-13
- { os: macos-13, ruby: '2.5' }
- { os: macos-13, ruby: '2.6' }
- { os: macos-13, ruby: '2.7' }
- { os: macos-13, ruby: '3.0' }

# No EOL versions for macos-14
- { os: macos-14, ruby: '2.5' }
- { os: macos-14, ruby: '2.6' }
- { os: macos-14, ruby: '2.7' }
- { os: macos-14, ruby: '3.0' }

# No EOL versions for windows-2022
- { os: windows-2022, ruby: '2.5' }
- { os: windows-2022, ruby: '2.6' }
- { os: windows-2022, ruby: '2.7' }
- { os: windows-2022, ruby: '3.0' }

steps:
- name: repo checkout
uses: actions/checkout@v4

- name: load ruby, run bundle install
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
rubygems: ${{ (matrix.ruby < '2.7') && 'latest' || 'default' }}

- name: macOS disable firewall
if: startsWith(matrix.os, 'macos')
run: |
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate off
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --getglobalstate
- name: compile
run: bundle exec rake compile

- name: test
run: bundle exec rake test
env:
CI: true
TESTOPTS: -v --no-show-detail-immediately

pure_ruby:
name: >-
pure ruby (${{ matrix.os }} ${{ matrix.ruby }})
runs-on: ${{ matrix.os }}
timeout-minutes: 10
env:
BUNDLE_WITHOUT: documentation
strategy:
fail-fast: false
matrix:
# TODO: Fix macos-13, macos-14, windows-2022
os: [ ubuntu-20.04, ubuntu-22.04, ubuntu-24.04 ]
ruby: [ '3.1', '3.2', '3.3', head ]
steps:
- name: repo checkout
uses: actions/checkout@v4

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true

- name: test_em_pure_ruby
run: bundle exec rake test_em_pure_ruby
env:
CI: true
EM_PURE_RUBY: true
TESTOPTS: -v --no-show-detail-immediately
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ pkg
rdoc
Makefile

*.idea
*.bundle
*.dll
*.so
Expand All @@ -16,6 +17,16 @@ java/src/.project
*.rbc
Gemfile.lock

vendor/bundle/
.yardoc/*
doc/*
tmp/*

# windows local build artifacts
/win_gem_test/shared/
/win_gem_test/packages/
/win_gem_test/test_logs/
/Rakefile_wintest
*.gem
/lib/fastfilereaderext.rb
/lib/rubyeventmachine.rb
22 changes: 0 additions & 22 deletions .travis.yml

This file was deleted.

74 changes: 74 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,79 @@
# Changelog

## 1.2.7 (May 12, 2018)
* Fix segfault on large numbers of connections [#843]

## 1.2.6 (April 30, 2018)
* *Fix segfault when an Exception is raised from unbind callback (for real this time!)*
* Fix race condition while initializing the machine [#756]
* Fix for newer compilers where bind() and std::bind() conflict [#830, #831]
* Be verbose about SSL connection errors [#807]
* Avoid explicitly calling class methods when in class scope
* Java: Add EM_PROTO_SSL/TLS definitions [#773, #791]
* Java: return zero when sending data to a closed connection [#475, #804]
* Pure Ruby: Connection::error? calls report_connection_error_status [#801]

## 1.2.5 (July 27, 2017)
* Java: Use long for larger values in oneshot timer intervals [#784, #794]

## 1.2.4 (July 27, 2017)
* Java: Add EM_PROTO_SSL/TLS definitions [#773, #791]
* Fix IPv6 UDP get_peername [#788]
* Allow for larger values in oneshot timer intervals [#784, #793]
* Update extconf.rb to allow MinGW builds with OpenSSL 1.1.0 [#785]

## 1.2.3 (February 22, 2017)
* Pure Ruby: Add get_sockname [#308, #772]
* Fix segfault when an Exception is raised from unbind callback [#765, #766]
* Allow destructors to throw when compiling in >= C++11 [#767]

## 1.2.2 (January 23, 2017)
* Java: Fix Fixnum deprecated warning in Ruby 2.4+ [#759]
* Fix uncaught C++ exception in file watcher and raise InvalidSignature [#512, #757]
* Fix connection count off-by-one for epoll and kqueue [#750]
* Fix uninitialized variable warning in EM::P::HttpClient [#749]
* Fix missing initial value for EventableDescriptor NextHeartbeat [#748]
* Fix hostname resolution on Solaris, Ilumos, SmartOS, et al [#745, #746]
* Improve reliability of tests, reduce public Internet accesses in tests [#656, #666, #749]

## 1.2.1 (November 15, 2016)
* Throw strerror(errno) when getsockname or getpeername fail [#683]
* Use a single concrete implementation of getpeername/getsockname, the rest pure virtuals [#683]
* Use gai_strerror to get the failure string from getaddrinfo [#744]
* Fix deregistering descriptor when using KQUEUE [#728]
* Fix to enable to work an example code in EM::Pool [#731]
* LineText2: Add regular expression delimiter support [#706]
* Pure Ruby: EM rescue ECONNREFUSED on initial TCP connect [#741]
* Pure Ruby: EM SSL (working start_tls) [#712]
* Pure Ruby: EM fixes [#707]
* Java: Use Acceptors to get peer and sock names if not present in Connections [#743]

## 1.2.0.1 (March 15, 2016)
* Fix crash when accepting IPv6 connections due to struct sockaddr_in [#698, #699]

## 1.2.0 (March 15, 2016)
* Integrate work from the EventMachine-LE 1.1.x versions [#570]
* Add start_tls options :ecdh_curve, :dhparam, :fail_if_no_peer_cert [#195, #275, #399, #665]
* Add start_tls option :ssl_version for choosing SSL/TLS versions and ciphers [#359, #348, #603, #654]
* Add start_tls option :sni_hostname to be passed to TLS params [#593]
* Add method EM::Channel#num_subscribers to get the number of subscribers to a channel [#640]
* Add support for proc-sources in EM::Iterator [#639]
* Factor out method cleanup_machine to cleanup code from EM.run [#650]
* Replace Exception class with StandardError [#637]
* Close socket on close_connection even after close_connection_after_writing [#694]
* Allow reusing of datagram socket/setting bind device [#662]
* Handle deferred exceptions in reactor thread [#486]
* Reimplement Queue to avoid shift/push performance problem [#311]
* Windows: Switch from gethostbyname to getaddrinfo, support IPv6 addresses [#303, #630]
* Windows: Use rake-compiler-dock to cross-compile gems [#627]
* Windows: Add AppVeyor configuration for Windows CI testing [#578]
* Windows: Bump rake-compiler to version 0.9.x [#542]
* Fix compilation on AIX (w/ XLC) [#693]
* Fix build on OpenBSD [#690]
* Fix OpenSSL compile issue on AIX 7.1 [#678]
* Fix EventMachine.fork_reactor keeps the threadpool of the original process [#425]
* Fix to prevent event machine from stopping when a raise is done in an unbind [#327]

## 1.0.9.1 (January 14, 2016)
* Fix EPROTO not defined on Windows [#676]
* Fix missing cast to struct sockaddr * [#671]
Expand Down
17 changes: 17 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,19 @@
source 'https://rubygems.org'

gemspec

gem 'rake'

install_if -> { RUBY_VERSION > '3.1' } do
gem 'net-smtp'
end

# switch to install_if when ruby 2.2 support is dropped
if RUBY_VERSION >= '3.0'
gem 'sorted_set'
end

group :documentation do
gem 'yard', '>= 0.8.5.2'
gem 'redcarpet' unless RUBY_PLATFORM =~ /java|mswin/
end
55 changes: 29 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# About EventMachine [![Code Climate](https://codeclimate.com/github/eventmachine/eventmachine.png)](https://codeclimate.com/github/eventmachine/eventmachine)
# About EventMachine [![Build Status](https://github.com/eventmachine/eventmachine/actions/workflows/workflow.yml/badge.svg)](https://github.com/eventmachine/eventmachine/actions) [![Code Climate Maintainability](https://api.codeclimate.com/v1/badges/e9b0603462905d5b9118/maintainability)](https://codeclimate.com/github/eventmachine/eventmachine/maintainability)


## What is EventMachine ##
Expand All @@ -18,12 +18,12 @@ This unique combination makes EventMachine a premier choice for designers of cri
applications, including Web servers and proxies, email and IM production systems, authentication/authorization
processors, and many more.

EventMachine has been around since the early 2000s and is a mature and battle tested library.
EventMachine has been around since the early 2000s and is a mature and battle-tested library.


## What EventMachine is good for? ##

* Scalable event-driven servers. Examples: [Thin](http://code.macournoyer.com/thin/) or [Goliath](https://github.com/postrank-labs/goliath/).
* Scalable event-driven servers. Examples: [Thin](https://github.com/macournoyer/thin/) or [Goliath](https://github.com/postrank-labs/goliath/).
* Scalable asynchronous clients for various protocols, RESTful APIs and so on. Examples: [em-http-request](https://github.com/igrigorik/em-http-request) or [amqp gem](https://github.com/ruby-amqp/amqp).
* Efficient network proxies with custom logic. Examples: [Proxymachine](https://github.com/mojombo/proxymachine/).
* File and network monitoring tools. Examples: [eventmachine-tail](https://github.com/jordansissel/eventmachine-tail) and [logstash](https://github.com/logstash/logstash).
Expand All @@ -32,8 +32,9 @@ EventMachine has been around since the early 2000s and is a mature and battle te

## What platforms are supported by EventMachine? ##

EventMachine supports Ruby >= 1.8.7 and <= 2.2 REE, JRuby and **works well on Windows** as well
as many operating systems from the Unix family (Linux, Mac OS X, BSD flavors).
EventMachine supports Ruby 2.0.0 and later (see tested versions at
[.github/workflows/workflow.yml](.github/workflows/workflow.yml)). It runs on JRuby and **works well on Windows**
as well as many operating systems from the Unix family (Linux, Mac OS X, BSD flavors).



Expand All @@ -45,7 +46,7 @@ Install it with [RubyGems](https://rubygems.org/)

or add this to your Gemfile if you use [Bundler](http://gembundler.com/):

gem "eventmachine"
gem 'eventmachine'



Expand All @@ -54,39 +55,41 @@ or add this to your Gemfile if you use [Bundler](http://gembundler.com/):
For an introduction to EventMachine, check out:

* [blog post about EventMachine by Ilya Grigorik](http://www.igvita.com/2008/05/27/ruby-eventmachine-the-speed-demon/).
* [EventMachine Introductions by Dan Sinclair](http://everburning.com/news/eventmachine-introductions/).
* [EventMachine Introductions by Dan Sinclair](http://everburning.com/news/eventmachine-introductions.html).


### Server example: Echo server ###

Here's a fully-functional echo server written with EventMachine:

require 'eventmachine'
```ruby
require 'eventmachine'

module EchoServer
def post_init
puts "-- someone connected to the echo server!"
end
module EchoServer
def post_init
puts "-- someone connected to the echo server!"
end

def receive_data data
send_data ">>>you sent: #{data}"
close_connection if data =~ /quit/i
end
def receive_data data
send_data ">>>you sent: #{data}"
close_connection if data =~ /quit/i
end

def unbind
puts "-- someone disconnected from the echo server!"
end
end
def unbind
puts "-- someone disconnected from the echo server!"
end
end

# Note that this will block current thread.
EventMachine.run {
EventMachine.start_server "127.0.0.1", 8081, EchoServer
}
# Note that this will block current thread.
EventMachine.run {
EventMachine.start_server "127.0.0.1", 8081, EchoServer
}
```


## EventMachine documentation ##

Currently we only have [reference documentation](http://rdoc.info/github/eventmachine/eventmachine/frames) and a [wiki](https://github.com/eventmachine/eventmachine/wiki).
Currently we only have [reference documentation](http://rubydoc.info/github/eventmachine/eventmachine/frames) and a [wiki](https://github.com/eventmachine/eventmachine/wiki).


## Community and where to get help ##
Expand All @@ -105,4 +108,4 @@ Copyright: (C) 2006-07 by Francis Cianfrocca. All Rights Reserved.

## Alternatives ##

If you are unhappy with EventMachine and want to use Ruby, check out [Celluloid](https://celluloid.io/).
If you are unhappy with EventMachine and want to use Ruby, check out [Celluloid](https://github.com/celluloid/celluloid).
Loading

0 comments on commit c5aff56

Please sign in to comment.