iodine 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of iodine might be problematic. Click here for more details.

@@ -13,7 +13,7 @@ typedef struct Websocket ws_s;
13
13
  /**
14
14
  The protocol / service identifier for `libserver`.
15
15
  */
16
- extern char* WEBSOCKET_ID_STR;
16
+ extern char *WEBSOCKET_ID_STR;
17
17
  /**
18
18
  The Websocket Handler contains all the settings required for new websocket
19
19
  connections.
@@ -31,26 +31,37 @@ typedef struct {
31
31
  overwritten once the function exits (it cannot be saved for later, but it can
32
32
  be copied).
33
33
  */
34
- void (*on_message)(ws_s* ws, char* data, size_t size, uint8_t is_text);
34
+ void (*on_message)(ws_s *ws, char *data, size_t size, uint8_t is_text);
35
35
  /**
36
36
  The (optional) on_open callback will be called once the websocket connection
37
37
  is
38
38
  established.
39
39
  */
40
- void (*on_open)(ws_s* ws);
40
+ void (*on_open)(ws_s *ws);
41
+ /**
42
+ The (optional) on_ready callback will be after a the underlying socket's
43
+ buffer changes it's state from full to available.
44
+
45
+ If the socket's buffer is never full, the callback is never called.
46
+
47
+ It should be noted that `libsock` manages the socket's buffer overflow and
48
+ implements and augmenting user-land buffer, allowing data to be safely written
49
+ to the websocket without worrying over the socket's buffer.
50
+ */
51
+ void (*on_ready)(ws_s *ws);
41
52
  /**
42
53
  The (optional) on_shutdown callback will be called if a websocket connection
43
54
  is still open while the server is shutting down (called before `on_close`).
44
55
  */
45
- void (*on_shutdown)(ws_s* ws);
56
+ void (*on_shutdown)(ws_s *ws);
46
57
  /**
47
58
  The (optional) on_close callback will be called once a websocket connection is
48
59
  terminated or failed to be established.
49
60
  */
50
- void (*on_close)(ws_s* ws);
61
+ void (*on_close)(ws_s *ws);
51
62
  /** The `http_request_s` to be converted ("upgraded") to a websocket
52
63
  * connection. Either a request or a response object is required.*/
53
- http_request_s* request;
64
+ http_request_s *request;
54
65
  /**
55
66
  The (optional) HttpResponse to be used for sending the upgrade response.
56
67
 
@@ -59,13 +70,13 @@ typedef struct {
59
70
  The ownership of the response object will remain unchanged - so if you have
60
71
  created the response object, you should free it.
61
72
  */
62
- http_response_s* response;
73
+ http_response_s *response;
63
74
  /**
64
75
  The maximum websocket message size/buffer (in bytes) for this connection.
65
76
  */
66
77
  size_t max_msg_size;
67
78
  /** Opaque user data. */
68
- void* udata;
79
+ void *udata;
69
80
  /**
70
81
  Timeout for the websocket connections, a ping will be sent
71
82
  whenever the timeout is reached. Connections are only closed when a ping
@@ -90,31 +101,30 @@ typedef struct {
90
101
  * Returns 0 on sucess and -1 on failure. A response is always sent.
91
102
  */
92
103
  ssize_t websocket_upgrade(websocket_settings_s settings);
93
- #define websocket_upgrade(...) \
104
+ #define websocket_upgrade(...) \
94
105
  websocket_upgrade((websocket_settings_s){__VA_ARGS__})
95
106
 
96
107
  /** Returns the opaque user data associated with the websocket. */
97
- void* websocket_get_udata(ws_s* ws);
108
+ void *websocket_get_udata(ws_s *ws);
98
109
  /** Returns the the process specific connection's UUID (see `libsock`). */
99
- intptr_t websocket_get_fduuid(ws_s* ws);
110
+ intptr_t websocket_get_fduuid(ws_s *ws);
100
111
  /** Sets the opaque user data associated with the websocket.
101
112
  * Returns the old value, if any. */
102
- void* websocket_set_udata(ws_s* ws, void* udata);
113
+ void *websocket_set_udata(ws_s *ws, void *udata);
103
114
  /** Writes data to the websocket. Returns -1 on failure (0 on success). */
104
- int websocket_write(ws_s* ws, void* data, size_t size, uint8_t is_text);
115
+ int websocket_write(ws_s *ws, void *data, size_t size, uint8_t is_text);
105
116
  /** Closes a websocket connection. */
106
- void websocket_close(ws_s* ws);
117
+ void websocket_close(ws_s *ws);
107
118
  /**
108
119
  Performs a task on each websocket connection that shares the same process
109
120
  (except the originating `ws_s` connection which is allowed to be NULL).
110
121
  */
111
- void websocket_each(ws_s* ws_originator,
112
- void (*task)(ws_s* ws_target, void* arg),
113
- void* arg,
114
- void (*on_finish)(ws_s* ws_originator, void* arg));
122
+ void websocket_each(ws_s *ws_originator,
123
+ void (*task)(ws_s *ws_target, void *arg), void *arg,
124
+ void (*on_finish)(ws_s *ws_originator, void *arg));
115
125
  /**
116
126
  Counts the number of websocket connections.
117
127
  */
118
- size_t websocket_count(ws_s* ws);
128
+ size_t websocket_count(ws_s *ws);
119
129
 
120
130
  #endif
@@ -42,7 +42,7 @@ Gem::Specification.new do |spec|
42
42
  spec.add_development_dependency 'rake', '~> 10.0'
43
43
  spec.add_development_dependency 'minitest'
44
44
 
45
- spec.post_install_message = "** WARNING!\n" \
46
- "Iodine 0.2.0 is NOT an upgrade - it's a total rewrite, it's written in C specifically for Ruby MRI.\n\n" \
47
- 'If your application was using Iodine 0.1.x, it might not work after this "upgrade".'
45
+ # spec.post_install_message = "** WARNING!\n" \
46
+ # "Iodine 0.2.0 is NOT an upgrade - it's a total rewrite, it's written in C specifically for Ruby MRI.\n\n" \
47
+ # 'If your application was using Iodine 0.1.x, it might not work after this "upgrade".'
48
48
  end
@@ -1,3 +1,3 @@
1
1
  module Iodine
2
- VERSION = '0.2.0'.freeze
2
+ VERSION = '0.2.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iodine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Boaz Segev
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-08-18 00:00:00.000000000 Z
11
+ date: 2016-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -177,11 +177,7 @@ licenses:
177
177
  - MIT
178
178
  metadata:
179
179
  allowed_push_host: https://rubygems.org
180
- post_install_message: |-
181
- ** WARNING!
182
- Iodine 0.2.0 is NOT an upgrade - it's a total rewrite, it's written in C specifically for Ruby MRI.
183
-
184
- If your application was using Iodine 0.1.x, it might not work after this "upgrade".
180
+ post_install_message:
185
181
  rdoc_options: []
186
182
  require_paths:
187
183
  - lib