Skip to content

Commit

Permalink
Fixed:
Browse files Browse the repository at this point in the history
  * updated function signature for sendDatagram to accept a byte[] for data
    instead of a String.  this matches the behavior of the sendData() function
    for TCP and prevents mangling of your packets due to UTF-safety problems.
  * updated send_datagram in jeventmachine.rb to call .to_java_bytes on data
    for compatibility with above.
  • Loading branch information
cturner committed Feb 25, 2011
1 parent 89c88eb commit 8986927
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions java/src/com/rubyeventmachine/EmReactor.java
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,8 @@ public void setCommInactivityTimeout (long sig, long mills) {
Connections.get(sig).setCommInactivityTimeout (mills);
}

public void sendDatagram (long sig, String data, int length, String recipAddress, int recipPort) {
sendDatagram (sig, ByteBuffer.wrap(data.getBytes()), recipAddress, recipPort);
public void sendDatagram (long sig, byte[] data, int length, String recipAddress, int recipPort) {
sendDatagram (sig, ByteBuffer.wrap(data), recipAddress, recipPort);
}

public void sendDatagram (long sig, ByteBuffer bb, String recipAddress, int recipPort) {
Expand Down
2 changes: 1 addition & 1 deletion lib/jeventmachine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def self.send_data sig, data, length
@em.sendData sig, data.to_java_bytes
end
def self.send_datagram sig, data, length, address, port
@em.sendDatagram sig, data, length, address, port
@em.sendDatagram sig, data.to_java_bytes, length, address, port
end
def self.connect_server server, port
bind_connect_server nil, nil, server, port
Expand Down

0 comments on commit 8986927

Please sign in to comment.