Commit Graph

1147 Commits

Author SHA1 Message Date
David Reiss
4ec777e998 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
2008-06-11 01:01:29 +00:00
David Reiss
6f1cd53a1e 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
2008-06-11 01:01:21 +00:00
David Reiss
4fd7818efa 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
2008-06-11 01:01:13 +00:00
David Reiss
af652d2f51 removing more debug_rlogs
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666442 13f79535-47bb-0310-9956-ffa450edef68
2008-06-11 01:01:06 +00:00
David Reiss
4cf5a6a81f ok: good to go
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666441 13f79535-47bb-0310-9956-ffa450edef68
2008-06-11 01:00:59 +00:00
David Reiss
190d769481 don't do an exit(normal)
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666440 13f79535-47bb-0310-9956-ffa450edef68
2008-06-11 01:00:52 +00:00
David Reiss
464e300054 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
2008-06-11 01:00:45 +00:00
David Reiss
06272addb1 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
2008-06-11 01:00:37 +00:00
David Reiss
80664fe233 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
2008-06-11 01:00:30 +00:00
David Reiss
b7c8802d36 allow configurable recv_timeouts
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666435 13f79535-47bb-0310-9956-ffa450edef68
2008-06-11 01:00:20 +00:00
David Reiss
919a801a28 removing two more debug messages
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666434 13f79535-47bb-0310-9956-ffa450edef68
2008-06-11 01:00:12 +00:00
David Reiss
7255ed4c46 removed extra debugging statements
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666433 13f79535-47bb-0310-9956-ffa450edef68
2008-06-11 01:00:04 +00:00
David Reiss
80862313de oops forgot a file
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666432 13f79535-47bb-0310-9956-ffa450edef68
2008-06-11 00:59:55 +00:00
David Reiss
c11734efac 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
2008-06-11 00:59:48 +00:00
David Reiss
a5a53dbfcc 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
2008-06-11 00:59:34 +00:00
David Reiss
c525745c0e 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
2008-06-11 00:59:27 +00:00
David Reiss
3b9c342fa4 fixing behavior declaration for thrift_transport
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666428 13f79535-47bb-0310-9956-ffa450edef68
2008-06-11 00:59:19 +00:00
David Reiss
11d855c837 micro optimization in thrift_processor
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666427 13f79535-47bb-0310-9956-ffa450edef68
2008-06-11 00:59:12 +00:00
David Reiss
6b3e40fd73 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
2008-06-11 00:59:03 +00:00
David Reiss
6563f34263 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
2008-06-11 00:58:55 +00:00
David Reiss
225db732c2 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
2008-06-11 00:58:48 +00:00
David Reiss
81b473b4a1 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
2008-06-11 00:58:41 +00:00
David Reiss
1d8b752971 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
2008-06-11 00:58:33 +00:00
David Reiss
55ff70f8d6 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
2008-06-11 00:58:25 +00:00
David Reiss
702019c914 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
2008-06-11 00:58:13 +00:00
David Reiss
8cadf3e0fa 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
2008-06-11 00:58:07 +00:00
David Reiss
2c534031ee 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
2008-06-11 00:58:00 +00:00
David Reiss
8cf694d62d 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
2008-06-11 00:57:54 +00:00
David Reiss
5541d65864 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
2008-06-11 00:57:42 +00:00
David Reiss
cdf8d1994a 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
2008-06-11 00:57:35 +00:00
David Reiss
fc44c41253 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
2008-06-11 00:57:19 +00:00
David Reiss
77f6f7f567 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
2008-06-11 00:57:11 +00:00
David Reiss
abded23ed4 Implement testAsync for python tests
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666412 13f79535-47bb-0310-9956-ffa450edef68
2008-06-11 00:57:01 +00:00
David Reiss
c85a695588 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
2008-06-11 00:56:55 +00:00
David Reiss
f4761e324e 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
2008-06-11 00:56:49 +00:00
David Reiss
da07067489 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
2008-06-11 00:56:42 +00:00
David Reiss
920959a655 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
2008-06-11 00:56:35 +00:00
David Reiss
c308d6989e 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
2008-06-11 00:56:25 +00:00
David Reiss
60b50cf385 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
2008-06-10 22:59:10 +00:00
David Reiss
cc10b8a80c 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
2008-06-10 22:59:02 +00:00
David Reiss
c0cce962ac 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
2008-06-10 22:58:58 +00:00
David Reiss
90b4083d4c Implement buffered transport
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666386 13f79535-47bb-0310-9956-ffa450edef68
2008-06-10 22:58:52 +00:00
David Reiss
57b4d9a4ac Test server for erlang
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666385 13f79535-47bb-0310-9956-ffa450edef68
2008-06-10 22:58:39 +00:00
David Reiss
982c72de7b Properly handle exceptions
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666384 13f79535-47bb-0310-9956-ffa450edef68
2008-06-10 22:58:33 +00:00
David Reiss
eea8298ee3 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
2008-06-10 22:58:21 +00:00
David Reiss
e1a7998837 Fix responses for void functions
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666382 13f79535-47bb-0310-9956-ffa450edef68
2008-06-10 22:58:14 +00:00
David Reiss
d93521b880 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
2008-06-10 22:58:07 +00:00
David Reiss
07a725f038 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
2008-06-10 22:57:59 +00:00
David Reiss
11300fe872 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
2008-06-10 22:57:52 +00:00
David Reiss
0c9b516506 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
2008-06-10 22:57:44 +00:00