-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from bdewitt/master
New server/client API introduced
- Loading branch information
Showing
39 changed files
with
1,227 additions
and
611 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,28 @@ | ||
require 'eventmachine' | ||
require 'protobuf/ext/eventmachine' | ||
require 'logger' | ||
require 'socket' | ||
require 'pp' | ||
require 'stringio' | ||
|
||
module Protobuf | ||
end | ||
|
||
# When setting up a client | ||
unless defined?(Protobuf::ConnectorType) && Protobuf::ConnectorType == "Socket" | ||
Protobuf::ConnectorType = "EventMachine" | ||
require 'eventmachine' | ||
require 'protobuf/ext/eventmachine' | ||
require 'protobuf/rpc/connectors/eventmachine' | ||
end | ||
|
||
# For running the rpc_server | ||
unless defined?(Protobuf::ServerType) && Protobuf::ServerType == "SocketServer" | ||
Protobuf::ServerType = "EventedServer" | ||
require 'eventmachine' | ||
require 'protobuf/ext/eventmachine' | ||
require 'protobuf/rpc/servers/evented_server' | ||
end | ||
|
||
require 'protobuf/rpc/client' | ||
require 'protobuf/rpc/server' | ||
require 'protobuf/rpc/connectors/socket' | ||
require 'protobuf/rpc/service' | ||
require 'protobuf/rpc/servers/socket_server' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,14 @@ | ||
require 'fiber' | ||
|
||
# Method and concept from em-synchrony | ||
# Method from em-synchrony | ||
# https://github.com/igrigorik/em-synchrony | ||
# | ||
# A convenience method for wrapping EM.run body within | ||
# a Ruby Fiber such that async operations can be transparently | ||
# paused and resumed based on IO scheduling | ||
module EventMachine | ||
def self.fiber_run(blk=nil, tail=nil, &block) | ||
blk ||= block | ||
context = Proc.new{ Fiber.new{ blk.call }.resume } | ||
|
||
context = Proc.new{ Fiber.new{ (b = blk || block) and b.call }.resume } | ||
self.run(context, tail) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.