summaryrefslogtreecommitdiff
path: root/src/stream_engine.cpp
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2012-06-13 10:25:18 +0200
committerMartin Sustrik <sustrik@250bpm.com>2012-06-13 10:25:18 +0200
commit0a2f88984a4543aa69c15d8d8639180816857a6b (patch)
tree759f4d025d4cb95e010081839197045a7fde9826 /src/stream_engine.cpp
parentb018208d5901873a374d08a98cf31e3bb89d12d0 (diff)
Revert "Implement SP wire protocol"
This reverts commit a34ea4d80609395150742259fd8c9caa4409e961.
Diffstat (limited to 'src/stream_engine.cpp')
-rw-r--r--src/stream_engine.cpp58
1 files changed, 1 insertions, 57 deletions
diff --git a/src/stream_engine.cpp b/src/stream_engine.cpp
index b0f9f20..dc6d345 100644
--- a/src/stream_engine.cpp
+++ b/src/stream_engine.cpp
@@ -53,21 +53,8 @@ xs::stream_engine_t::stream_engine_t (fd_t fd_, const options_t &options_) :
session (NULL),
leftover_session (NULL),
options (options_),
- plugged (false),
- header_pos (in_header),
- header_remaining (sizeof in_header),
- header_received (false),
- header_sent (false)
+ plugged (false)
{
- // Fill in outgoing SP protocol header and the complementary (desired)
- // header.
- if (!options.legacy_protocol) {
- sp_get_header (out_header, options.sp_service, options.sp_pattern,
- options.sp_version, options.sp_role);
- sp_get_header (desired_header, options.sp_service, options.sp_pattern,
- options.sp_version, options.sp_complement);
- }
-
// Get the socket into non-blocking mode.
unblock_socket (s);
@@ -168,35 +155,6 @@ void xs::stream_engine_t::in_event (fd_t fd_)
{
bool disconnection = false;
- // If we have not yet received the full protocol header...
- if (unlikely (!options.legacy_protocol && !header_received)) {
-
- // Read remaining header bytes.
- int hbytes = read (header_pos, header_remaining);
-
- // Check whether the peer has closed the connection.
- if (hbytes == -1) {
- error ();
- return;
- }
-
- header_remaining -= hbytes;
- header_pos += hbytes;
-
- // If we did not read the whole header, poll for more.
- if (header_remaining)
- return;
-
- // If the protocol headers do not match, close the connection.
- if (memcmp (in_header, desired_header, sizeof in_header) != 0) {
- error ();
- return;
- }
-
- // Done with protocol header; proceed to read data.
- header_received = true;
- }
-
// If there's no data to process in the buffer...
if (!insize) {
@@ -252,20 +210,6 @@ void xs::stream_engine_t::out_event (fd_t fd_)
{
bool more_data = true;
- // If protocol header was not yet sent...
- if (unlikely (!options.legacy_protocol && !header_sent)) {
- int hbytes = write (out_header, sizeof out_header);
-
- // It should always be possible to write the full protocol header to a
- // freshly connected TCP socket. Therefore, if we get an error or
- // partial write here the peer has disconnected.
- if (hbytes != sizeof out_header) {
- error ();
- return;
- }
- header_sent = true;
- }
-
// If write buffer is empty, try to read new data from the encoder.
if (!outsize) {