common/thrift.git
16 years agoMake fake install target for alterl
David Reiss [Wed, 11 Jun 2008 01:12:58 +0000 (01:12 +0000)] 
Make fake install target for alterl

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666470 13f79535-47bb-0310-9956-ffa450edef68

16 years agoAdd back thrift_server.erl which we still use
David Reiss [Wed, 11 Jun 2008 01:12:52 +0000 (01:12 +0000)] 
Add back thrift_server.erl which we still use

Sorry facebook guys :P We'll switch to thrift_socket_server eventually

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666469 13f79535-47bb-0310-9956-ffa450edef68

16 years agoFix thrift_binary_protocol to be hipe-compatible
David Reiss [Wed, 11 Jun 2008 01:12:45 +0000 (01:12 +0000)] 
Fix thrift_binary_protocol to be hipe-compatible

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666468 13f79535-47bb-0310-9956-ffa450edef68

16 years agoChange thrift_disk_log_transport to not flush when flush/1 is called if sync_every...
David Reiss [Wed, 11 Jun 2008 01:12:38 +0000 (01:12 +0000)] 
Change thrift_disk_log_transport to not flush when flush/1 is called if sync_every is defined

Summary:
  For fast logging we don't want to actually flush to disk after every message.
  There's force_flush/1 now if you actually want to force one

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666467 13f79535-47bb-0310-9956-ffa450edef68

16 years agoAdd thrift_base64_transport which writes base64 encoded data
David Reiss [Wed, 11 Jun 2008 01:12:31 +0000 (01:12 +0000)] 
Add thrift_base64_transport which writes base64 encoded data

Summary:
  This is to make it easy to run Hadoop mapreduces using Hadoop Streaming on thrift-serialized structs
  without implementing any special file splitter or anything

Test plan: test_disklog:t_base64()

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666466 13f79535-47bb-0310-9956-ffa450edef68

16 years agoAdd thrift_client:send_call which sends a function call but doesn't read a response.
David Reiss [Wed, 11 Jun 2008 01:12:20 +0000 (01:12 +0000)] 
Add thrift_client:send_call which sends a function call but doesn't read a response.

Summary:
  This is for logging applications with thrift_disk_log_transport, so the function calls
  logged don't necessarily have to be async void

Test plan:
  Added to test_disklog.erl

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666465 13f79535-47bb-0310-9956-ffa450edef68

16 years agoAdd thrift_disk_log_transport which writes to the disk_log module
David Reiss [Wed, 11 Jun 2008 01:12:09 +0000 (01:12 +0000)] 
Add thrift_disk_log_transport which writes to the disk_log module

Summary:
  See test/erl/src/test_disklog.erl for example usage

Test plan: test_disklog:t(), then hexdump -C /tmp/test_log.1

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666464 13f79535-47bb-0310-9956-ffa450edef68

16 years agoFactory-ize generation of thrift_binary_protocol to clean things up a bit and decoupl...
David Reiss [Wed, 11 Jun 2008 01:11:57 +0000 (01:11 +0000)] 
Factory-ize generation of thrift_binary_protocol to clean things up a bit and decouple thrift_socket_transport's factory from binary protocol

Test plan: tutorial still runs. Someone who actually uses the Options to thrift_client should test this.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666463 13f79535-47bb-0310-9956-ffa450edef68

16 years agoParse options to thrift_socket_transport:new_protocol_factory/3 "manually" - O(n...
David Reiss [Wed, 11 Jun 2008 01:03:44 +0000 (01:03 +0000)] 
Parse options to thrift_socket_transport:new_protocol_factory/3 "manually" - O(n) instead of O(n^2)

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666462 13f79535-47bb-0310-9956-ffa450edef68

16 years agoRename "Connector" to "ProtocolFactory" since that's what it is (response to review...
David Reiss [Wed, 11 Jun 2008 01:03:37 +0000 (01:03 +0000)] 
Rename "Connector" to "ProtocolFactory" since that's what it is (response to review by eletuchy)

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666461 13f79535-47bb-0310-9956-ffa450edef68

16 years agoModify thrift_client to take in a "connector" function as a parameter, enabling subst...
David Reiss [Wed, 11 Jun 2008 01:03:29 +0000 (01:03 +0000)] 
Modify thrift_client to take in a "connector" function as a parameter, enabling substitution of different protocol/transports

Summary:
  Left in a backwards-compatible start_link with (Host, Port, Service) args

Test plan:
  tutorial/alterl still works

Notes:
  We may want to go a little further and get rid of the binary_protocol specific stuff from socket_transport as well

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666460 13f79535-47bb-0310-9956-ffa450edef68

16 years agoOops - dont' use server.config anymore for alterl tutorial
David Reiss [Wed, 11 Jun 2008 01:03:22 +0000 (01:03 +0000)] 
Oops - dont' use server.config anymore for alterl tutorial

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666459 13f79535-47bb-0310-9956-ffa450edef68

16 years agoNew tutorial for alterl bindings - include working client + server
David Reiss [Wed, 11 Jun 2008 01:03:16 +0000 (01:03 +0000)] 
New tutorial for alterl bindings - include working client + server

Test plan:

  ./client.sh
  server:start().
  client:t().

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666458 13f79535-47bb-0310-9956-ffa450edef68

16 years agoRemove another TODO - no need to set "id" field of stop markers
David Reiss [Wed, 11 Jun 2008 01:03:10 +0000 (01:03 +0000)] 
Remove another TODO - no need to set "id" field of stop markers

Test plan: tested on our price service

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666457 13f79535-47bb-0310-9956-ffa450edef68

16 years agoRemove two TODO notes for cpiro that are no longer applicable.
David Reiss [Wed, 11 Jun 2008 01:03:03 +0000 (01:03 +0000)] 
Remove two TODO notes for cpiro that are no longer applicable.

Reviewed by: cpiro

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666456 13f79535-47bb-0310-9956-ffa450edef68

16 years agotesting return of empty binary from 0-length thrrift read
David Reiss [Wed, 11 Jun 2008 01:02:55 +0000 (01:02 +0000)] 
testing return of empty binary from 0-length thrrift read

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666455 13f79535-47bb-0310-9956-ffa450edef68

16 years agoadd a case clause to bubble timeouts
David Reiss [Wed, 11 Jun 2008 01:02:47 +0000 (01:02 +0000)] 
add a case clause to bubble timeouts

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666454 13f79535-47bb-0310-9956-ffa450edef68

16 years agoadding explicit timeout handling and error_logging
David Reiss [Wed, 11 Jun 2008 01:02:39 +0000 (01:02 +0000)] 
adding explicit timeout handling and error_logging

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666453 13f79535-47bb-0310-9956-ffa450edef68

16 years agoMake invocation of 'find' in alterl Makefile more compatible
David Reiss [Wed, 11 Jun 2008 01:02:31 +0000 (01:02 +0000)] 
Make invocation of 'find' in alterl Makefile more compatible

Summary: find . -name instead of find -name

Test Plan: still works, now works on Darwin too

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666452 13f79535-47bb-0310-9956-ffa450edef68

16 years agoadding socket options to thrift client
David Reiss [Wed, 11 Jun 2008 01:02:23 +0000 (01:02 +0000)] 
adding socket options to thrift client

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666451 13f79535-47bb-0310-9956-ffa450edef68

16 years agoerlang: move thrift_client connect logic into a handle_call and call it in start_link
David Reiss [Wed, 11 Jun 2008 01:02:10 +0000 (01:02 +0000)] 
erlang: move thrift_client connect logic into a handle_call and call it in start_link

Summary: a failure in thrift_client:init would cause the invoker to exit, but we'd rather just return {error, Error} from start_link and let the invoker crash if it wants

Reviewed By: eletuchy

Test Plan: makes mouths happy

Revert Plan: ok

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666450 13f79535-47bb-0310-9956-ffa450edef68

16 years agoerlang thrift_client: wrap gen_tcp:connect in a catch ... leave nothing to chance
David Reiss [Wed, 11 Jun 2008 01:02:03 +0000 (01:02 +0000)] 
erlang thrift_client: wrap gen_tcp:connect in a catch ... leave nothing to chance

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666449 13f79535-47bb-0310-9956-ffa450edef68

16 years agoerlang thrift_client will return {stop, Error} in start_link on a gen_tcp:connect...
David Reiss [Wed, 11 Jun 2008 01:01:56 +0000 (01:01 +0000)] 
erlang thrift_client will return {stop, Error} in start_link on a gen_tcp:connect error rather than exiting

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666448 13f79535-47bb-0310-9956-ffa450edef68

16 years agoErlang: add framed_transport and non-strict binary_protocol
David Reiss [Wed, 11 Jun 2008 01:01:48 +0000 (01:01 +0000)] 
Erlang: add framed_transport and non-strict binary_protocol

- thrift_client now takes as its fourth parameter Options: framed, strict_{read,write}, connect_timeout (P.S. fourth param used to be Timeout)
- binary protocol now takes options: strict_{read,write}
- buffers in framed and buffered transport are now iolists and not reversed lists of binaries
- rename buffer in buffered transport "write_buffer" to match framed transport

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666447 13f79535-47bb-0310-9956-ffa450edef68

16 years agoreplacing an io format with error_logger call
David Reiss [Wed, 11 Jun 2008 01:01:36 +0000 (01:01 +0000)] 
replacing an io format with error_logger call

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666446 13f79535-47bb-0310-9956-ffa450edef68

16 years agomake read(string) return a binary rather than a list
David Reiss [Wed, 11 Jun 2008 01:01:29 +0000 (01:01 +0000)] 
make read(string) return a binary rather than a list
tested server side ... still need to test client side

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666445 13f79535-47bb-0310-9956-ffa450edef68

16 years agosmall buffered_transport and client improvements
David Reiss [Wed, 11 Jun 2008 01:01:21 +0000 (01:01 +0000)] 
small buffered_transport and client improvements

moved close of wrapped transport into terminate/2
made thrift_client:close into a cast rather than call

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666444 13f79535-47bb-0310-9956-ffa450edef68

16 years agoadd optional (connect) Timeout parameter to thrift_client:start_link
David Reiss [Wed, 11 Jun 2008 01:01:13 +0000 (01:01 +0000)] 
add optional (connect) Timeout parameter to thrift_client:start_link

Summary: will fail ungracefully if the timeout is hit, or anything bad happens.  will fix.

Reviewed By: eletuchy

Test Plan: did some stuff with it

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666443 13f79535-47bb-0310-9956-ffa450edef68

16 years agoremoving more debug_rlogs
David Reiss [Wed, 11 Jun 2008 01:01:06 +0000 (01:01 +0000)] 
removing more debug_rlogs

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666442 13f79535-47bb-0310-9956-ffa450edef68

16 years agook: good to go
David Reiss [Wed, 11 Jun 2008 01:00:59 +0000 (01:00 +0000)] 
ok: good to go

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666441 13f79535-47bb-0310-9956-ffa450edef68

16 years agodon't do an exit(normal)
David Reiss [Wed, 11 Jun 2008 01:00:52 +0000 (01:00 +0000)] 
don't do an exit(normal)

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666440 13f79535-47bb-0310-9956-ffa450edef68

16 years agoadd a close to thrift_client to close the underlying transport
David Reiss [Wed, 11 Jun 2008 01:00:45 +0000 (01:00 +0000)] 
add a close to thrift_client to close the underlying transport

Reviewed By: eletuchy

Notes: the thrift_buffered_transport exits with {normal,{gen_server,call,[Pid,close]}} right now, but it should only exit with normal.  marked todo.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666439 13f79535-47bb-0310-9956-ffa450edef68

16 years agodon't need to use gen_server:reply
David Reiss [Wed, 11 Jun 2008 01:00:37 +0000 (01:00 +0000)] 
don't need to use gen_server:reply

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666438 13f79535-47bb-0310-9956-ffa450edef68

16 years agochanging thrift_processor shutdown to compy with proc_lib standards
David Reiss [Wed, 11 Jun 2008 01:00:30 +0000 (01:00 +0000)] 
changing thrift_processor shutdown to compy with proc_lib standards

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666437 13f79535-47bb-0310-9956-ffa450edef68

16 years agoallow configurable recv_timeouts
David Reiss [Wed, 11 Jun 2008 01:00:20 +0000 (01:00 +0000)] 
allow configurable recv_timeouts

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666435 13f79535-47bb-0310-9956-ffa450edef68

16 years agoremoving two more debug messages
David Reiss [Wed, 11 Jun 2008 01:00:12 +0000 (01:00 +0000)] 
removing two more debug messages

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666434 13f79535-47bb-0310-9956-ffa450edef68

16 years agoremoved extra debugging statements
David Reiss [Wed, 11 Jun 2008 01:00:04 +0000 (01:00 +0000)] 
removed extra debugging statements

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666433 13f79535-47bb-0310-9956-ffa450edef68

16 years agooops forgot a file
David Reiss [Wed, 11 Jun 2008 00:59:55 +0000 (00:59 +0000)] 
oops forgot a file

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666432 13f79535-47bb-0310-9956-ffa450edef68

16 years agomochiweb style avoidance of gen_tcp:controlling_process
David Reiss [Wed, 11 Jun 2008 00:59:48 +0000 (00:59 +0000)] 
mochiweb style avoidance of gen_tcp:controlling_process

TODO: remove extraneous debug_rlogs

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666431 13f79535-47bb-0310-9956-ffa450edef68

16 years agoFix thrift_buffered_transport leak in erl bindings
David Reiss [Wed, 11 Jun 2008 00:59:34 +0000 (00:59 +0000)] 
Fix thrift_buffered_transport leak in erl bindings

Summary:
  - Was leaking processes when the client cleanly disconnected since the
    thrift_processor process was exiting with 'normal' Reason. Changed it
    to 'protocol_closed'

Test plan:
  - Telnet to thrift service port and close (^]close) before the read timeout
    elapses. Verify that erlang:system_info(process_count) does not increase
    after doing this multiple times.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666430 13f79535-47bb-0310-9956-ffa450edef68

16 years agoif instead of case for a guard comparison
David Reiss [Wed, 11 Jun 2008 00:59:27 +0000 (00:59 +0000)] 
if instead of case for a guard comparison

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666429 13f79535-47bb-0310-9956-ffa450edef68

16 years agofixing behavior declaration for thrift_transport
David Reiss [Wed, 11 Jun 2008 00:59:19 +0000 (00:59 +0000)] 
fixing behavior declaration for thrift_transport

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666428 13f79535-47bb-0310-9956-ffa450edef68

16 years agomicro optimization in thrift_processor
David Reiss [Wed, 11 Jun 2008 00:59:12 +0000 (00:59 +0000)] 
micro optimization in thrift_processor

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666427 13f79535-47bb-0310-9956-ffa450edef68

16 years agouse type-appropriate methods for size and map for dict and set structures
David Reiss [Wed, 11 Jun 2008 00:59:03 +0000 (00:59 +0000)] 
use type-appropriate methods for size and map for dict and set structures

Reviewed By: cpiro

Test Plan: TODO

Revert Plan: sure

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666426 13f79535-47bb-0310-9956-ffa450edef68

16 years agoadding make dialyzer for fun and profit
David Reiss [Wed, 11 Jun 2008 00:58:55 +0000 (00:58 +0000)] 
adding make dialyzer for fun and profit

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666425 13f79535-47bb-0310-9956-ffa450edef68

16 years agoallow writing binaries in thrift_binary_protocol
David Reiss [Wed, 11 Jun 2008 00:58:48 +0000 (00:58 +0000)] 
allow writing binaries in thrift_binary_protocol

Summary: they come packed in {string, Bin} so pull them out

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666424 13f79535-47bb-0310-9956-ffa450edef68

16 years agoFix warning in generated source for alterl bindings
David Reiss [Wed, 11 Jun 2008 00:58:41 +0000 (00:58 +0000)] 
Fix warning in generated source for alterl bindings

Summary:
  - Was previously including both the fall-through to the base service as well as the "dummy" fallthrough function clause. This generated a warning like:

  gen-erl/redacted_thrift.erl:134: Warning: this clause cannot match because a previous clause at line 132 always matches

  Now we only include the "dummy" function if there is no base class to fall through to.

Test plan: Generated tutorial.thrift and shared.thrift, compiled without warnings

Notes: It's probably possible to have a circular inheritance graph, which would cause an infinite loop at runtime. Do we care about this?

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666423 13f79535-47bb-0310-9956-ffa450edef68

16 years agoImplement inheritance in the alterl generator
David Reiss [Wed, 11 Jun 2008 00:58:33 +0000 (00:58 +0000)] 
Implement inheritance in the alterl generator

Summary:
  - Simply forwards function_info calls through to the base service

Test plan: cpiro will test it?

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666422 13f79535-47bb-0310-9956-ffa450edef68

16 years agoImplement TApplicationException handling in alt_erl client
David Reiss [Wed, 11 Jun 2008 00:58:25 +0000 (00:58 +0000)] 
Implement TApplicationException handling in alt_erl client

Summary:
  Throws a 'TApplicationException' record

Test plan:
  Changed cpp TestServer so that if testException is called with "ApplicationException" as an argument, it throws a TException which is serialized back as an EXCEPTION type message

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666421 13f79535-47bb-0310-9956-ffa450edef68

16 years agoAdd a README to alterl which shows how to use thrift_client
David Reiss [Wed, 11 Jun 2008 00:58:13 +0000 (00:58 +0000)] 
Add a README to alterl which shows how to use thrift_client

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666420 13f79535-47bb-0310-9956-ffa450edef68

16 years agoRemove extra debugging from thrift_client.erl
David Reiss [Wed, 11 Jun 2008 00:58:07 +0000 (00:58 +0000)] 
Remove extra debugging from thrift_client.erl

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666419 13f79535-47bb-0310-9956-ffa450edef68

16 years agoAdd a thrift client to alterl bindings
David Reiss [Wed, 11 Jun 2008 00:58:00 +0000 (00:58 +0000)] 
Add a thrift client to alterl bindings

Test plan:
  f(), {ok, C} = thrift_client:start_link("localhost", 9090, thriftTest_thrift).
  thrift_client:call(C, testAsync, [1234]).
  thrift_client:call(C, testVoid, []).
  thrift_client:call(C, testList, [[1,2,3,4,5]]).

  - Should write an actual test suite that exercises all of ThriftTest but I'm lazy right now

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666418 13f79535-47bb-0310-9956-ffa450edef68

16 years agoChange alterl thrift_server to use non-blocking TCP calls and properly set the proces...
David Reiss [Wed, 11 Jun 2008 00:57:54 +0000 (00:57 +0000)] 
Change alterl thrift_server to use non-blocking TCP calls and properly set the processor as the controlling process for the client sockets.

Summary:
  - Removes the non-OTP "acceptor" process
  - The processor becomes the socket's controlling process instead of the transport, which is kind of messy, but it means we don't have to make a process for the socket_transport.
  - See http://www.trapexit.org/Building_a_Non-blocking_TCP_server_using_OTP_principles for non-blocking server info

Test plan:
  - Ran ThriftTest and StressTest

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666417 13f79535-47bb-0310-9956-ffa450edef68

16 years agoFix thrift_processor so that exceptions thrown in async void functions don't get...
David Reiss [Wed, 11 Jun 2008 00:57:42 +0000 (00:57 +0000)] 
Fix thrift_processor so that exceptions thrown in async void functions don't get serialized

Test plan: Made testAsync() in test_server always crash with a badmatch 1 = 0,
           and made sure that the badmatch was caught and logged but not
   serialized back to the client

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666416 13f79535-47bb-0310-9956-ffa450edef68

16 years agoImplement async_void in alterl bindings
David Reiss [Wed, 11 Jun 2008 00:57:35 +0000 (00:57 +0000)] 
Implement async_void in alterl bindings

Summary:
  - reply_type for async void functions is now async_void instead of
    the empty struct definition
  - async void functions should return "ok". otherwise the processor
    will crash and the connection will be killed. Is this behaviour
    expected?

Test Plan: tested using testAsync() in ThriftTest. Didn't used to work
           but works now

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666415 13f79535-47bb-0310-9956-ffa450edef68

16 years agoComment out some noisy output from thrift_processor and thrift_server
David Reiss [Wed, 11 Jun 2008 00:57:19 +0000 (00:57 +0000)] 
Comment out some noisy output from thrift_processor and thrift_server

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666414 13f79535-47bb-0310-9956-ffa450edef68

16 years agoAdd build/ dir for alterl bindings and remove them from .gitignore
David Reiss [Wed, 11 Jun 2008 00:57:11 +0000 (00:57 +0000)] 
Add build/ dir for alterl bindings and remove them from .gitignore

Summary: These files are copied from the erl/build dir. I don't know why
         I accidentally gitignored them before.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666413 13f79535-47bb-0310-9956-ffa450edef68

16 years agoImplement testAsync for python tests
David Reiss [Wed, 11 Jun 2008 00:57:01 +0000 (00:57 +0000)] 
Implement testAsync for python tests

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666412 13f79535-47bb-0310-9956-ffa450edef68

16 years agoAdd mkdir ${TARGET_DIR} to erl test Makefile since the empty ebin/ dir doesn't stay...
David Reiss [Wed, 11 Jun 2008 00:56:55 +0000 (00:56 +0000)] 
Add mkdir ${TARGET_DIR} to erl test Makefile since the empty ebin/ dir doesn't stay in git

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666411 13f79535-47bb-0310-9956-ffa450edef68

16 years agoFix thrift_server to create transport and protocol inside the processor rather than...
David Reiss [Wed, 11 Jun 2008 00:56:49 +0000 (00:56 +0000)] 
Fix thrift_server to create transport and protocol inside the processor rather than inside the acceptor.

This fixes a process and file descriptor leak -- previously, the thrift_buffered_transport process was linked to the acceptor, which never died.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666409 13f79535-47bb-0310-9956-ffa450edef68

16 years agoFix error logging to actually print error and stack trace for caught errors
David Reiss [Wed, 11 Jun 2008 00:56:42 +0000 (00:56 +0000)] 
Fix error logging to actually print error and stack trace for caught errors

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666408 13f79535-47bb-0310-9956-ffa450edef68

16 years agoHandle crashes/errors in the processor by sending back a serialized exception
David Reiss [Wed, 11 Jun 2008 00:56:35 +0000 (00:56 +0000)] 
Handle crashes/errors in the processor by sending back a serialized exception

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666407 13f79535-47bb-0310-9956-ffa450edef68

16 years agoAdd thrift_server:stop/1 to stop a running server
David Reiss [Wed, 11 Jun 2008 00:56:25 +0000 (00:56 +0000)] 
Add thrift_server:stop/1 to stop a running server

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666405 13f79535-47bb-0310-9956-ffa450edef68

16 years agoAdd stress test implementation for new Erlang
David Reiss [Tue, 10 Jun 2008 22:59:10 +0000 (22:59 +0000)] 
Add stress test implementation for new Erlang

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666389 13f79535-47bb-0310-9956-ffa450edef68

16 years agoDon't actually ignore all makefiles in .gitignore -- erl makefiles are important!
David Reiss [Tue, 10 Jun 2008 22:59:02 +0000 (22:59 +0000)] 
Don't actually ignore all makefiles in .gitignore -- erl makefiles are important!

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666388 13f79535-47bb-0310-9956-ffa450edef68

16 years agoOops - forgot to add the test/erl/Makefile to git
David Reiss [Tue, 10 Jun 2008 22:58:58 +0000 (22:58 +0000)] 
Oops - forgot to add the test/erl/Makefile to git

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666387 13f79535-47bb-0310-9956-ffa450edef68

16 years agoImplement buffered transport
David Reiss [Tue, 10 Jun 2008 22:58:52 +0000 (22:58 +0000)] 
Implement buffered transport

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666386 13f79535-47bb-0310-9956-ffa450edef68

16 years agoTest server for erlang
David Reiss [Tue, 10 Jun 2008 22:58:39 +0000 (22:58 +0000)] 
Test server for erlang

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666385 13f79535-47bb-0310-9956-ffa450edef68

16 years agoProperly handle exceptions
David Reiss [Tue, 10 Jun 2008 22:58:33 +0000 (22:58 +0000)] 
Properly handle exceptions

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666384 13f79535-47bb-0310-9956-ffa450edef68

16 years agoFix reading of empty structs/arg lists
David Reiss [Tue, 10 Jun 2008 22:58:21 +0000 (22:58 +0000)] 
Fix reading of empty structs/arg lists

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666383 13f79535-47bb-0310-9956-ffa450edef68

16 years agoFix responses for void functions
David Reiss [Tue, 10 Jun 2008 22:58:14 +0000 (22:58 +0000)] 
Fix responses for void functions

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666382 13f79535-47bb-0310-9956-ffa450edef68

16 years agoMake strings read as lists, not as binary
David Reiss [Tue, 10 Jun 2008 22:58:07 +0000 (22:58 +0000)] 
Make strings read as lists, not as binary

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666381 13f79535-47bb-0310-9956-ffa450edef68

16 years agoMake signedness of integers explicit, and fix double read/write.
David Reiss [Tue, 10 Jun 2008 22:57:59 +0000 (22:57 +0000)] 
Make signedness of integers explicit, and fix double read/write.
Also fix typo of i63 for i64

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666380 13f79535-47bb-0310-9956-ffa450edef68

16 years agoProperly uncapitalize package names when referencing structs
David Reiss [Tue, 10 Jun 2008 22:57:52 +0000 (22:57 +0000)] 
Properly uncapitalize package names when referencing structs

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666379 13f79535-47bb-0310-9956-ffa450edef68

16 years agoFix generation when multiple services are in the same service definition
David Reiss [Tue, 10 Jun 2008 22:57:44 +0000 (22:57 +0000)] 
Fix generation when multiple services are in the same service definition

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666378 13f79535-47bb-0310-9956-ffa450edef68

16 years agoGenerator for alternative erl bindings, as well as a few more changes to lib code.
David Reiss [Tue, 10 Jun 2008 22:57:35 +0000 (22:57 +0000)] 
Generator for alternative erl bindings, as well as a few more changes to lib code.

- Exceptions don't work yet, but it looks like everything else does.
- Seems to work fine on our pricing service
- Code could need some cleanup

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666377 13f79535-47bb-0310-9956-ffa450edef68

16 years agoMake processor use a service definition and handler to determine types
David Reiss [Tue, 10 Jun 2008 22:57:21 +0000 (22:57 +0000)] 
Make processor use a service definition and handler to determine types

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666376 13f79535-47bb-0310-9956-ffa450edef68

16 years agoRead and write of structs, lists, maps, and sets
David Reiss [Tue, 10 Jun 2008 22:57:11 +0000 (22:57 +0000)] 
Read and write of structs, lists, maps, and sets

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666375 13f79535-47bb-0310-9956-ffa450edef68

16 years agoInitial commit of alternative erlang lib
David Reiss [Tue, 10 Jun 2008 22:56:59 +0000 (22:56 +0000)] 
Initial commit of alternative erlang lib

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666374 13f79535-47bb-0310-9956-ffa450edef68

16 years agoAvoid a filename collision on case-insensitive filesystems.
David Reiss [Tue, 10 Jun 2008 22:56:48 +0000 (22:56 +0000)] 
Avoid a filename collision on case-insensitive filesystems.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666373 13f79535-47bb-0310-9956-ffa450edef68

16 years agoDon't generate a constants file if there are no constants (Java only).
David Reiss [Tue, 10 Jun 2008 22:56:43 +0000 (22:56 +0000)] 
Don't generate a constants file if there are no constants (Java only).

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666372 13f79535-47bb-0310-9956-ffa450edef68

16 years agoFix a bug with initialization in JavaBean-style generated code.
David Reiss [Tue, 10 Jun 2008 22:56:34 +0000 (22:56 +0000)] 
Fix a bug with initialization in JavaBean-style generated code.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666371 13f79535-47bb-0310-9956-ffa450edef68

16 years agoPrint an error instead of segfaulting with a bad compiler command line.
David Reiss [Tue, 10 Jun 2008 22:56:26 +0000 (22:56 +0000)] 
Print an error instead of segfaulting with a bad compiler command line.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666370 13f79535-47bb-0310-9956-ffa450edef68

16 years agoAdd newlines to some warning messages in the compiler.
David Reiss [Tue, 10 Jun 2008 22:56:19 +0000 (22:56 +0000)] 
Add newlines to some warning messages in the compiler.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666369 13f79535-47bb-0310-9956-ffa450edef68

16 years agoFix some warnings caused by treating string literals as non-const.
David Reiss [Tue, 10 Jun 2008 22:56:12 +0000 (22:56 +0000)] 
Fix some warnings caused by treating string literals as non-const.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666368 13f79535-47bb-0310-9956-ffa450edef68

16 years agoFix IPv6 on FreeBSD.
David Reiss [Tue, 10 Jun 2008 22:56:04 +0000 (22:56 +0000)] 
Fix IPv6 on FreeBSD.

On FreeBSD (and possibly other BSDs), binding to ipv6 is restricted unless the
sysctl net.inet6.ip6.v6only=0 or the socket option IPV6_V6ONLY is turned off.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666367 13f79535-47bb-0310-9956-ffa450edef68

16 years agoFix some indentation in the PHP generator.
David Reiss [Tue, 10 Jun 2008 22:55:54 +0000 (22:55 +0000)] 
Fix some indentation in the PHP generator.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666366 13f79535-47bb-0310-9956-ffa450edef68

16 years agoPHP Generator: Throw an exception on bad types.
David Reiss [Tue, 10 Jun 2008 22:55:46 +0000 (22:55 +0000)] 
PHP Generator: Throw an exception on bad types.

Summary:
Previously, if you set a structure field to, say, an int when it was
supposed to be a container (array) or struct (object), the serialization
code would either produce corrupt output (container) or cause a fatal
error (struct).  Now they both throw exceptions.

Reviewed By: mcslee

Test Plan: Looked at generated code.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666365 13f79535-47bb-0310-9956-ffa450edef68

16 years agoChange Python servers to use the standard logging module.
David Reiss [Tue, 10 Jun 2008 22:55:38 +0000 (22:55 +0000)] 
Change Python servers to use the standard logging module.

Previously Thrift was using `print` to report errors.  Thrift is infrastructure
and should not impose its error logging mechanism on the apps that use it.  For
example, [elided] uses the logging module to send logs to a particular file.

I ran the unit test.  That exercises most of the error handling routines.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666364 13f79535-47bb-0310-9956-ffa450edef68

16 years agoPython forking server should close connection in parent.
David Reiss [Tue, 10 Jun 2008 22:55:26 +0000 (22:55 +0000)] 
Python forking server should close connection in parent.

When a function called by the forking python thrift server throws an
exception the client will hang.  This happens because the parent of the
forked process does not properly close the socket fd.

Under normal operation the server operation completes and returns a value to
the client.  However, when an exception occurs the 'end' message is never
sent to the client so the client relies on a connection close to abort the
call (this is how the threading server works I believe).

This fails with the forking server because the parent process never closes
the socket fd.  The child has closed the fd at this point, but the
connection will not actually be closed until all open instances of the fd
are closed. Since the client is waiting for a message and the server never
closes it the client is forced to wait until a read timeout occurs many
minutes later.

This diff closes the parent's copy of the socket fd immediately after the
fork occurs.

I modified my load test server to throw an exception.  The client did not hang.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666363 13f79535-47bb-0310-9956-ffa450edef68

16 years agoThrift: Allow for alternative Mutex initializers.
David Reiss [Tue, 10 Jun 2008 22:55:13 +0000 (22:55 +0000)] 
Thrift: Allow for alternative Mutex initializers.

Summary:
Add an argument to the Mutex constructor.
It takes a pointer to a function that initializes the internal pthread_mutex_t.
We provide initializers for default pthread_mutex_t (which is our default),
adaptive mutexes, and recursive mutexes.

Reviewed By: hzhao, psaab, mcslee

Test Plan: Built libthrift.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666362 13f79535-47bb-0310-9956-ffa450edef68

16 years agoFix locking bug in ThreadManager.
David Reiss [Tue, 10 Jun 2008 22:55:04 +0000 (22:55 +0000)] 
Fix locking bug in ThreadManager.

It looks like the scheduler waits on monitor_, but the worker notifies
workerMonitor_. Also, it does so out of critical section.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666361 13f79535-47bb-0310-9956-ffa450edef68

16 years agoFunctionRunner Utility Class.
David Reiss [Tue, 10 Jun 2008 22:54:56 +0000 (22:54 +0000)] 
FunctionRunner Utility Class.

Runs arbitrary functions of form 'void(void)' and 'void*(void*)'
without need to create custom Runnable classes.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666360 13f79535-47bb-0310-9956-ffa450edef68

16 years agoForking Python server.
David Reiss [Tue, 10 Jun 2008 22:54:49 +0000 (22:54 +0000)] 
Forking Python server.

The python threading model does not provide concurrency for CPU-bound
processes.  Process forking is the current recommended way of writing
scalable Python servers.

Harry Wang ran the [elided] backend with this change for 3 days and observed
no errors.  The threaded backend caused unexplained lockups under this load
after 24 hours.

I also ran a CPU-bound load test against this server with 32 concurrent
clients.  It completed 5X faster than the threaded implementation.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666359 13f79535-47bb-0310-9956-ffa450edef68

16 years agoAdd ProfilerRegisterThead() to PosixThread.
David Reiss [Tue, 10 Jun 2008 22:54:40 +0000 (22:54 +0000)] 
Add ProfilerRegisterThead() to PosixThread.

Adds an #ifdef'd block that calls ProfilerRegisterThread() if
"REGISTER_THREAD_GOOGLE_PERFTOOLS" is set.  Apparently, this makes the
Google perftools CPU profiler work much better on x86-64.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666358 13f79535-47bb-0310-9956-ffa450edef68

16 years agoMake sure list<byte> is List<Byte> in Java gen'd code.
David Reiss [Tue, 10 Jun 2008 22:54:32 +0000 (22:54 +0000)] 
Make sure list<byte> is List<Byte> in Java gen'd code.

Reviewed By: dreiss

Test Plan: Generate list<byte> into Java

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666357 13f79535-47bb-0310-9956-ffa450edef68

17 years agoFix a few copy-paste errors in TBufferTransports (not code).
David Reiss [Fri, 9 May 2008 19:18:29 +0000 (19:18 +0000)] 
Fix a few copy-paste errors in TBufferTransports (not code).

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665684 13f79535-47bb-0310-9956-ffa450edef68

17 years agoTweak Java Makefile.ams to fix "make distclean".
David Reiss [Fri, 9 May 2008 07:17:35 +0000 (07:17 +0000)] 
Tweak Java Makefile.ams to fix "make distclean".

The Java Makefile.ams assume the existence of ANT, but "make distclean"
runs in the Java directories even if ENABLE_JAVA is off.  This change
makes the clean-local target handle the absence of ANT, fixing
"make distclean".

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665683 13f79535-47bb-0310-9956-ffa450edef68

17 years agoCheck for ptrdiff_t and fail if we don't have it.
David Reiss [Fri, 9 May 2008 07:17:34 +0000 (07:17 +0000)] 
Check for ptrdiff_t and fail if we don't have it.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665682 13f79535-47bb-0310-9956-ffa450edef68

17 years agoC++/TFramedTransport: Don't write an empty frame on flush.
David Reiss [Fri, 9 May 2008 07:14:10 +0000 (07:14 +0000)] 
C++/TFramedTransport: Don't write an empty frame on flush.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665681 13f79535-47bb-0310-9956-ffa450edef68